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

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

Issue 10537154: A working implementation of AQS (Assisted Query Stats). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed SupportsAssistedQueryStats. Created 8 years, 6 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/template_url_service.h" 5 #include "chrome/browser/search_engines/template_url_service.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 DCHECK(!t_url->IsExtensionKeyword()); 308 DCHECK(!t_url->IsExtensionKeyword());
309 309
310 const TemplateURLRef& search_ref = t_url->url_ref(); 310 const TemplateURLRef& search_ref = t_url->url_ref();
311 if (!search_ref.IsValidUsingTermsData(search_terms_data)) 311 if (!search_ref.IsValidUsingTermsData(search_terms_data))
312 return GURL(); 312 return GURL();
313 313
314 if (!search_ref.SupportsReplacementUsingTermsData(search_terms_data)) 314 if (!search_ref.SupportsReplacementUsingTermsData(search_terms_data))
315 return GURL(t_url->url()); 315 return GURL(t_url->url());
316 316
317 return GURL(search_ref.ReplaceSearchTermsUsingTermsData( 317 return GURL(search_ref.ReplaceSearchTermsUsingTermsData(
318 ASCIIToUTF16(kReplacementTerm), TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, 318 SearchTermsArgs(ASCIIToUTF16(kReplacementTerm)), search_terms_data));
319 string16(), search_terms_data));
320 } 319 }
321 320
322 bool TemplateURLService::CanReplaceKeyword( 321 bool TemplateURLService::CanReplaceKeyword(
323 const string16& keyword, 322 const string16& keyword,
324 const GURL& url, 323 const GURL& url,
325 TemplateURL** template_url_to_replace) { 324 TemplateURL** template_url_to_replace) {
326 DCHECK(!keyword.empty()); // This should only be called for non-empty 325 DCHECK(!keyword.empty()); // This should only be called for non-empty
327 // keywords. If we need to support empty kewords 326 // keywords. If we need to support empty kewords
328 // the code needs to change slightly. 327 // the code needs to change slightly.
329 TemplateURL* existing_url = GetTemplateURLForKeyword(keyword); 328 TemplateURL* existing_url = GetTemplateURLForKeyword(keyword);
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 // TODO(mpcomplete): If we allow editing extension keywords, then those 2369 // TODO(mpcomplete): If we allow editing extension keywords, then those
2371 // should be persisted to disk and synced. 2370 // should be persisted to disk and synced.
2372 if (template_url->sync_guid().empty() && 2371 if (template_url->sync_guid().empty() &&
2373 !template_url->IsExtensionKeyword()) { 2372 !template_url->IsExtensionKeyword()) {
2374 template_url->data_.sync_guid = base::GenerateGUID(); 2373 template_url->data_.sync_guid = base::GenerateGUID();
2375 if (service_.get()) 2374 if (service_.get())
2376 service_->UpdateKeyword(template_url->data()); 2375 service_->UpdateKeyword(template_url->data());
2377 } 2376 }
2378 } 2377 }
2379 } 2378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698