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

Unified Diff: chrome/browser/search_engines/search_host_to_urls_map.cc

Issue 10458077: When the Google base URL changes and causes keyword updates, save those to the database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/search_host_to_urls_map.cc
===================================================================
--- chrome/browser/search_engines/search_host_to_urls_map.cc (revision 139570)
+++ chrome/browser/search_engines/search_host_to_urls_map.cc (working copy)
@@ -37,12 +37,14 @@
host_to_urls_map_[url.host()].insert(template_url);
}
-void SearchHostToURLsMap::Remove(TemplateURL* template_url) {
+void SearchHostToURLsMap::Remove(TemplateURL* template_url,
+ const SearchTermsData& search_terms_data) {
DCHECK(initialized_);
DCHECK(template_url);
DCHECK(!template_url->IsExtensionKeyword());
- const GURL url(TemplateURLService::GenerateSearchURL(template_url));
+ const GURL url(TemplateURLService::GenerateSearchURLUsingTermsData(
+ template_url, search_terms_data));
if (!url.is_valid() || !url.has_host())
return;
@@ -57,29 +59,6 @@
host_to_urls_map_.erase(host_to_urls_map_.find(host));
}
-void SearchHostToURLsMap::UpdateGoogleBaseURLs(
- const SearchTermsData& search_terms_data) {
- DCHECK(initialized_);
-
- // Create a list of the the TemplateURLs to update.
- TemplateURLService::TemplateURLVector t_urls_using_base_url;
- for (HostToURLsMap::iterator i(host_to_urls_map_.begin());
- i != host_to_urls_map_.end(); ++i) {
- for (TemplateURLSet::const_iterator j(i->second.begin());
- j != i->second.end(); ++j) {
- if ((*j)->url_ref().HasGoogleBaseURLs() ||
- (*j)->suggestions_url_ref().HasGoogleBaseURLs())
- t_urls_using_base_url.push_back(*j);
- }
- }
-
- for (TemplateURLService::TemplateURLVector::const_iterator i(
- t_urls_using_base_url.begin()); i != t_urls_using_base_url.end(); ++i)
- RemoveByPointer(*i);
-
- Add(t_urls_using_base_url, search_terms_data);
-}
-
TemplateURL* SearchHostToURLsMap::GetTemplateURLForHost(
const std::string& host) {
DCHECK(initialized_);

Powered by Google App Engine
This is Rietveld 408576698