Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(638)

Side by Side Diff: chrome/browser/search_engines/util.h

Issue 268643002: Use the DefaultSearchManager as the exclusive authority on DSE, ignoring Web Data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final review nits. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_
7 7
8 // This file contains utility functions for search engine functionality. 8 // This file contains utility functions for search engine functionality.
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // NOTE: Takes ownership of, and clears, |prepopulated_urls|. 74 // NOTE: Takes ownership of, and clears, |prepopulated_urls|.
75 ActionsFromPrepopulateData CreateActionsFromCurrentPrepopulateData( 75 ActionsFromPrepopulateData CreateActionsFromCurrentPrepopulateData(
76 ScopedVector<TemplateURLData>* prepopulated_urls, 76 ScopedVector<TemplateURLData>* prepopulated_urls,
77 const TemplateURLService::TemplateURLVector& existing_urls, 77 const TemplateURLService::TemplateURLVector& existing_urls,
78 const TemplateURL* default_search_provider); 78 const TemplateURL* default_search_provider);
79 79
80 // Processes the results of WebDataService::GetKeywords, combining it with 80 // Processes the results of WebDataService::GetKeywords, combining it with
81 // prepopulated search providers to result in: 81 // prepopulated search providers to result in:
82 // * a set of template_urls (search providers). The caller owns the 82 // * a set of template_urls (search providers). The caller owns the
83 // TemplateURL* returned in template_urls. 83 // TemplateURL* returned in template_urls.
84 // * the default search provider (and if *default_search_provider is not NULL,
85 // it is contained in template_urls).
86 // * whether there is a new resource keyword version (and the value). 84 // * whether there is a new resource keyword version (and the value).
87 // |*new_resource_keyword_version| is set to 0 if no new value. Otherwise, 85 // |*new_resource_keyword_version| is set to 0 if no new value. Otherwise,
88 // it is the new value. 86 // it is the new value.
89 // Only pass in a non-NULL value for service if the WebDataService should be 87 // Only pass in a non-NULL value for service if the WebDataService should be
90 // updated. If |removed_keyword_guids| is not NULL, any TemplateURLs removed 88 // updated. If |removed_keyword_guids| is not NULL, any TemplateURLs removed
91 // from the keyword table in the WebDataService will have their Sync GUIDs 89 // from the keyword table in the WebDataService will have their Sync GUIDs
92 // added to it. 90 // added to it. |default_search_provider| will be used to prevent removing the
91 // current user-selected DSE, regardless of changes in prepopulate data.
93 void GetSearchProvidersUsingKeywordResult( 92 void GetSearchProvidersUsingKeywordResult(
94 const WDTypedResult& result, 93 const WDTypedResult& result,
95 WebDataService* service, 94 WebDataService* service,
96 Profile* profile, 95 Profile* profile,
97 TemplateURLService::TemplateURLVector* template_urls, 96 TemplateURLService::TemplateURLVector* template_urls,
98 TemplateURL** default_search_provider, 97 TemplateURL* default_search_provider,
99 int* new_resource_keyword_version, 98 int* new_resource_keyword_version,
100 std::set<std::string>* removed_keyword_guids); 99 std::set<std::string>* removed_keyword_guids);
101 100
102 // Like GetSearchProvidersUsingKeywordResult(), but allows the caller to pass in 101 // Like GetSearchProvidersUsingKeywordResult(), but allows the caller to pass in
103 // engines in |template_urls| instead of getting them via processing a web data 102 // engines in |template_urls| instead of getting them via processing a web data
104 // service request. 103 // service request.
105 // |resource_keyword_version| should contain the version number of the current 104 // |resource_keyword_version| should contain the version number of the current
106 // keyword data, i.e. the version number of the most recent prepopulate data 105 // keyword data, i.e. the version number of the most recent prepopulate data
107 // that has been merged into the current keyword data. On exit, this will be 106 // that has been merged into the current keyword data. On exit, this will be
108 // set as in GetSearchProvidersUsingKeywordResult(). 107 // set as in GetSearchProvidersUsingKeywordResult().
109 void GetSearchProvidersUsingLoadedEngines( 108 void GetSearchProvidersUsingLoadedEngines(
110 WebDataService* service, 109 WebDataService* service,
111 Profile* profile, 110 Profile* profile,
112 TemplateURLService::TemplateURLVector* template_urls, 111 TemplateURLService::TemplateURLVector* template_urls,
113 TemplateURL** default_search_provider, 112 TemplateURL* default_search_provider,
114 int* resource_keyword_version, 113 int* resource_keyword_version,
115 std::set<std::string>* removed_keyword_guids); 114 std::set<std::string>* removed_keyword_guids);
116 115
117 // Due to a bug, the |input_encodings| field of TemplateURLData could have 116 // Due to a bug, the |input_encodings| field of TemplateURLData could have
118 // contained duplicate entries. This removes those entries and returns whether 117 // contained duplicate entries. This removes those entries and returns whether
119 // any were found. 118 // any were found.
120 bool DeDupeEncodings(std::vector<std::string>* encodings); 119 bool DeDupeEncodings(std::vector<std::string>* encodings);
121 120
122 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they 121 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they
123 // have duplicate prepopulate ids. If |removed_keyword_guids| is not NULL, the 122 // have duplicate prepopulate ids. If |removed_keyword_guids| is not NULL, the
124 // Sync GUID of each item removed from the DB will be added to it. This is a 123 // Sync GUID of each item removed from the DB will be added to it. This is a
125 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here 124 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here
126 // so it's accessible by unittests. 125 // so it's accessible by unittests.
127 void RemoveDuplicatePrepopulateIDs( 126 void RemoveDuplicatePrepopulateIDs(
128 WebDataService* service, 127 WebDataService* service,
129 const ScopedVector<TemplateURLData>& prepopulated_urls, 128 const ScopedVector<TemplateURLData>& prepopulated_urls,
130 TemplateURL* default_search_provider, 129 TemplateURL* default_search_provider,
131 TemplateURLService::TemplateURLVector* template_urls, 130 TemplateURLService::TemplateURLVector* template_urls,
132 std::set<std::string>* removed_keyword_guids); 131 std::set<std::string>* removed_keyword_guids);
133 132
134 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ 133 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_service_unittest.cc ('k') | chrome/browser/search_engines/util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698