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

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

Issue 10381016: Remove the "autogenerate keyword" bit on TemplateURL. (Closed) Base URL: svn://chrome-svn/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 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 #include "chrome/browser/search_engines/search_provider_install_data.h" 5 #include "chrome/browser/search_engines/search_provider_install_data.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 } 138 }
139 139
140 // Indicates if the two inputs have the same security origin. 140 // Indicates if the two inputs have the same security origin.
141 // |requested_origin| should only be a security origin (no path, etc.). 141 // |requested_origin| should only be a security origin (no path, etc.).
142 // It is ok if |template_url| is NULL. 142 // It is ok if |template_url| is NULL.
143 static bool IsSameOrigin(const GURL& requested_origin, 143 static bool IsSameOrigin(const GURL& requested_origin,
144 TemplateURL* template_url, 144 TemplateURL* template_url,
145 const SearchTermsData& search_terms_data) { 145 const SearchTermsData& search_terms_data) {
146 DCHECK(requested_origin == requested_origin.GetOrigin()); 146 DCHECK(requested_origin == requested_origin.GetOrigin());
147 DCHECK(!template_url->IsExtensionKeyword());
147 return requested_origin == 148 return requested_origin ==
148 TemplateURLService::GenerateSearchURLUsingTermsData(template_url, 149 TemplateURLService::GenerateSearchURLUsingTermsData(template_url,
149 search_terms_data).GetOrigin(); 150 search_terms_data).GetOrigin();
150 } 151 }
151 152
152 } // namespace 153 } // namespace
153 154
154 SearchProviderInstallData::SearchProviderInstallData( 155 SearchProviderInstallData::SearchProviderInstallData(
155 Profile* profile, 156 Profile* profile,
156 int ui_death_notification, 157 int ui_death_notification,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 258 }
258 259
259 void SearchProviderInstallData::SetDefault(const TemplateURL* template_url) { 260 void SearchProviderInstallData::SetDefault(const TemplateURL* template_url) {
260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 261 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
261 262
262 if (!template_url) { 263 if (!template_url) {
263 default_search_origin_.clear(); 264 default_search_origin_.clear();
264 return; 265 return;
265 } 266 }
266 267
268 DCHECK(!template_url->IsExtensionKeyword());
269
267 IOThreadSearchTermsData search_terms_data(google_base_url_); 270 IOThreadSearchTermsData search_terms_data(google_base_url_);
268 const GURL url(TemplateURLService::GenerateSearchURLUsingTermsData( 271 const GURL url(TemplateURLService::GenerateSearchURLUsingTermsData(
269 template_url, search_terms_data)); 272 template_url, search_terms_data));
270 if (!url.is_valid() || !url.has_host()) { 273 if (!url.is_valid() || !url.has_host()) {
271 default_search_origin_.clear(); 274 default_search_origin_.clear();
272 return; 275 return;
273 } 276 }
274 default_search_origin_ = url.GetOrigin().spec(); 277 default_search_origin_ = url.GetOrigin().spec();
275 } 278 }
276 279
(...skipping 15 matching lines...) Expand all
292 295
293 std::for_each(closure_queue.begin(), 296 std::for_each(closure_queue.begin(),
294 closure_queue.end(), 297 closure_queue.end(),
295 std::mem_fun_ref(&base::Closure::Run)); 298 std::mem_fun_ref(&base::Closure::Run));
296 299
297 // Since we expect this request to be rare, clear out the information. This 300 // Since we expect this request to be rare, clear out the information. This
298 // also keeps the responses current as the search providers change. 301 // also keeps the responses current as the search providers change.
299 provider_map_.reset(); 302 provider_map_.reset();
300 SetDefault(NULL); 303 SetDefault(NULL);
301 } 304 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698