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

Side by Side Diff: chrome/browser/search_engines/search_host_to_urls_map.cc

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « chrome/browser/protector/histograms.cc ('k') | chrome/browser/search_engines/template_url.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/search_engines/search_host_to_urls_map.h" 5 #include "chrome/browser/search_engines/search_host_to_urls_map.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/search_engines/template_url.h" 8 #include "chrome/browser/search_engines/template_url.h"
9 #include "chrome/browser/search_engines/template_url_service.h" 9 #include "chrome/browser/search_engines/template_url_service.h"
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 DCHECK(initialized_); 81 DCHECK(initialized_);
82 82
83 // Create a list of the the TemplateURLs to update. 83 // Create a list of the the TemplateURLs to update.
84 std::vector<const TemplateURL*> t_urls_using_base_url; 84 std::vector<const TemplateURL*> t_urls_using_base_url;
85 for (HostToURLsMap::iterator host_map_iterator = host_to_urls_map_.begin(); 85 for (HostToURLsMap::iterator host_map_iterator = host_to_urls_map_.begin();
86 host_map_iterator != host_to_urls_map_.end(); ++host_map_iterator) { 86 host_map_iterator != host_to_urls_map_.end(); ++host_map_iterator) {
87 const TemplateURLSet& urls = host_map_iterator->second; 87 const TemplateURLSet& urls = host_map_iterator->second;
88 for (TemplateURLSet::const_iterator url_set_iterator = urls.begin(); 88 for (TemplateURLSet::const_iterator url_set_iterator = urls.begin();
89 url_set_iterator != urls.end(); ++url_set_iterator) { 89 url_set_iterator != urls.end(); ++url_set_iterator) {
90 const TemplateURL* t_url = *url_set_iterator; 90 const TemplateURL* t_url = *url_set_iterator;
91 if ((t_url->url() && t_url->url()->HasGoogleBaseURLs()) || 91 if (t_url->url_ref().HasGoogleBaseURLs() ||
92 (t_url->suggestions_url() && 92 t_url->suggestions_url_ref().HasGoogleBaseURLs()) {
93 t_url->suggestions_url()->HasGoogleBaseURLs())) {
94 t_urls_using_base_url.push_back(t_url); 93 t_urls_using_base_url.push_back(t_url);
95 } 94 }
96 } 95 }
97 } 96 }
98 97
99 for (size_t i = 0; i < t_urls_using_base_url.size(); ++i) 98 for (size_t i = 0; i < t_urls_using_base_url.size(); ++i)
100 RemoveByPointer(t_urls_using_base_url[i]); 99 RemoveByPointer(t_urls_using_base_url[i]);
101 100
102 for (size_t i = 0; i < t_urls_using_base_url.size(); ++i) 101 for (size_t i = 0; i < t_urls_using_base_url.size(); ++i)
103 Add(t_urls_using_base_url[i], search_terms_data); 102 Add(t_urls_using_base_url[i], search_terms_data);
(...skipping 27 matching lines...) Expand all
131 if (url_set_iterator != i->second.end()) { 130 if (url_set_iterator != i->second.end()) {
132 i->second.erase(url_set_iterator); 131 i->second.erase(url_set_iterator);
133 if (i->second.empty()) 132 if (i->second.empty())
134 host_to_urls_map_.erase(i); 133 host_to_urls_map_.erase(i);
135 // A given TemplateURL only occurs once in the map. As soon as we find the 134 // A given TemplateURL only occurs once in the map. As soon as we find the
136 // entry, stop. 135 // entry, stop.
137 return; 136 return;
138 } 137 }
139 } 138 }
140 } 139 }
OLDNEW
« no previous file with comments | « chrome/browser/protector/histograms.cc ('k') | chrome/browser/search_engines/template_url.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698