summaryrefslogtreecommitdiffstats
path: root/components/search_engines/util.h
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-04 05:00:12 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-04 05:00:12 +0000
commiteaee4dfa5afc6a1699befb07bf945dd7599c7889 (patch)
treec34517f3c1a95c1bd71d1b0454b061ccd8eb5a03 /components/search_engines/util.h
parent916fbf7cb8bbdb397e324e8649c61e95dc20f72a (diff)
downloadchromium_src-eaee4dfa5afc6a1699befb07bf945dd7599c7889.zip
chromium_src-eaee4dfa5afc6a1699befb07bf945dd7599c7889.tar.gz
chromium_src-eaee4dfa5afc6a1699befb07bf945dd7599c7889.tar.bz2
Revert of Componentize TemplateURLService (https://codereview.chromium.org/367023002/)
Reason for revert: Failed on android_aosp: http://build.chromium.org/p/chromium.linux/builders/Android%20Webview%20AOSP%20Builder/builds/12338 Original issue's description: > Componentize TemplateURLService > > Move TemplateURLService, SearchHostToURLsMap, util.cc from chrome/browser/search_engines to components/search_engines > Move KeywordTable and KeywordWeDataService from chrome/browser/webdata to components/search_engines > Fix DEPS, OWNERS and gyp. > Replace HistoryDatabase in keyword_table.cc with URLDatabase. > > BUG=386367 > TEST=build and checkdeps > R=blundell@chromium.org, jochen@chromium.org, pkasting@chromium.org > TBR=jochen@chromium.org for include fix, erikwright@chromium.org as an owner of sql, atwilson@chromium.org as an owner of sync > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=281350 TBR=pkasting@chromium.org,blundell@chromium.org,jochen@chromium.org,erikwright@chromium.org,atwilson@chromium.org NOTREECHECKS=true NOTRY=true BUG=386367 Review URL: https://codereview.chromium.org/363323007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/search_engines/util.h')
-rw-r--r--components/search_engines/util.h136
1 files changed, 0 insertions, 136 deletions
diff --git a/components/search_engines/util.h b/components/search_engines/util.h
deleted file mode 100644
index 4d0b643..0000000
--- a/components/search_engines/util.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SEARCH_ENGINES_UTIL_H_
-#define COMPONENTS_SEARCH_ENGINES_UTIL_H_
-
-// This file contains utility functions for search engine functionality.
-#include <set>
-#include <string>
-#include <vector>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/strings/string16.h"
-#include "components/search_engines/template_url_service.h"
-
-class KeywordWebDataService;
-class PrefService;
-class TemplateURL;
-class WDTypedResult;
-
-// Returns the short name of the default search engine, or the empty string if
-// none is set.
-base::string16 GetDefaultSearchEngineName(TemplateURLService* service);
-
-// Returns a GURL that searches for |terms| using the default search engine of
-// |service|.
-GURL GetDefaultSearchURLForSearchTerms(TemplateURLService* service,
- const base::string16& terms);
-
-// Returns matching URL from |template_urls| or NULL.
-TemplateURL* FindURLByPrepopulateID(
- const TemplateURLService::TemplateURLVector& template_urls,
- int prepopulate_id);
-
-// Modifies |prepopulated_url| so that it contains user-modified fields from
-// |original_turl|. Both URLs must have the same prepopulate_id.
-void MergeIntoPrepopulatedEngineData(const TemplateURL* original_turl,
- TemplateURLData* prepopulated_url);
-
-// CreateActionsFromCurrentPrepopulateData() (see below) takes in the current
-// prepopulated URLs as well as the user's current URLs, and returns an instance
-// of the following struct representing the changes necessary to bring the
-// user's URLs in line with the prepopulated URLs.
-//
-// There are three types of changes:
-// (1) Previous prepopulated engines that no longer exist in the current set of
-// prepopulated engines and thus should be removed from the user's current
-// URLs.
-// (2) Previous prepopulated engines whose data has changed. The existing
-// entries for these engines should be updated to reflect the new data,
-// except for any user-set names and keywords, which can be preserved.
-// (3) New prepopulated engines not in the user's engine list, which should be
-// added.
-
-// The pair of current search engine and its new value.
-typedef std::pair<TemplateURL*, TemplateURLData> EditedSearchEngine;
-typedef std::vector<EditedSearchEngine> EditedEngines;
-
-struct ActionsFromPrepopulateData {
- ActionsFromPrepopulateData();
- ~ActionsFromPrepopulateData();
-
- TemplateURLService::TemplateURLVector removed_engines;
- EditedEngines edited_engines;
- std::vector<TemplateURLData> added_engines;
-};
-
-// Given the user's current URLs and the current set of prepopulated URLs,
-// produces the set of actions (see above) required to make the user's URLs
-// reflect the prepopulate data. |default_search_provider| is used to avoid
-// placing the current default provider on the "to be removed" list.
-//
-// NOTE: Takes ownership of, and clears, |prepopulated_urls|.
-ActionsFromPrepopulateData CreateActionsFromCurrentPrepopulateData(
- ScopedVector<TemplateURLData>* prepopulated_urls,
- const TemplateURLService::TemplateURLVector& existing_urls,
- const TemplateURL* default_search_provider);
-
-// Processes the results of KeywordWebDataService::GetKeywords, combining it
-// with prepopulated search providers to result in:
-// * a set of template_urls (search providers). The caller owns the
-// TemplateURL* returned in template_urls.
-// * whether there is a new resource keyword version (and the value).
-// |*new_resource_keyword_version| is set to 0 if no new value. Otherwise,
-// it is the new value.
-// Only pass in a non-NULL value for service if the KeywordWebDataService should
-// be updated. If |removed_keyword_guids| is not NULL, any TemplateURLs removed
-// from the keyword table in the KeywordWebDataService will have their Sync
-// GUIDs added to it. |default_search_provider| will be used to prevent removing
-// the current user-selected DSE, regardless of changes in prepopulate data.
-void GetSearchProvidersUsingKeywordResult(
- const WDTypedResult& result,
- KeywordWebDataService* service,
- PrefService* prefs,
- TemplateURLService::TemplateURLVector* template_urls,
- TemplateURL* default_search_provider,
- const SearchTermsData& search_terms_data,
- int* new_resource_keyword_version,
- std::set<std::string>* removed_keyword_guids);
-
-// Like GetSearchProvidersUsingKeywordResult(), but allows the caller to pass in
-// engines in |template_urls| instead of getting them via processing a web data
-// service request.
-// |resource_keyword_version| should contain the version number of the current
-// keyword data, i.e. the version number of the most recent prepopulate data
-// that has been merged into the current keyword data. On exit, this will be
-// set as in GetSearchProvidersUsingKeywordResult().
-void GetSearchProvidersUsingLoadedEngines(
- KeywordWebDataService* service,
- PrefService* prefs,
- TemplateURLService::TemplateURLVector* template_urls,
- TemplateURL* default_search_provider,
- const SearchTermsData& search_terms_data,
- int* resource_keyword_version,
- std::set<std::string>* removed_keyword_guids);
-
-// Due to a bug, the |input_encodings| field of TemplateURLData could have
-// contained duplicate entries. This removes those entries and returns whether
-// any were found.
-bool DeDupeEncodings(std::vector<std::string>* encodings);
-
-// Removes (and deletes) TemplateURLs from |template_urls| and |service| if they
-// have duplicate prepopulate ids. If |removed_keyword_guids| is not NULL, the
-// Sync GUID of each item removed from the DB will be added to it. This is a
-// helper used by GetSearchProvidersUsingKeywordResult(), but is declared here
-// so it's accessible by unittests.
-void RemoveDuplicatePrepopulateIDs(
- KeywordWebDataService* service,
- const ScopedVector<TemplateURLData>& prepopulated_urls,
- TemplateURL* default_search_provider,
- TemplateURLService::TemplateURLVector* template_urls,
- const SearchTermsData& search_terms_data,
- std::set<std::string>* removed_keyword_guids);
-
-#endif // COMPONENTS_SEARCH_ENGINES_UTIL_H_