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

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

Issue 10184009: Add missing checks that default search contains search term replacement. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 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 | « no previous file | no next file » | 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) 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/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 TemplateURLData data(default_from_prefs->data()); 605 TemplateURLData data(default_from_prefs->data());
606 data.created_by_policy = true; 606 data.created_by_policy = true;
607 data.id = kInvalidTemplateURLID; 607 data.id = kInvalidTemplateURLID;
608 TemplateURL* managed_default = new TemplateURL(profile_, data); 608 TemplateURL* managed_default = new TemplateURL(profile_, data);
609 AddNoNotify(managed_default, true); 609 AddNoNotify(managed_default, true);
610 default_search_provider = managed_default; 610 default_search_provider = managed_default;
611 } 611 }
612 } 612 }
613 // Note that this saves the default search provider to prefs. 613 // Note that this saves the default search provider to prefs.
614 if (!default_search_provider || 614 if (!default_search_provider ||
615 !default_search_provider->IsExtensionKeyword()) 615 (!default_search_provider->IsExtensionKeyword() &&
616 default_search_provider->SupportsReplacement()))
616 SetDefaultSearchProviderNoNotify(default_search_provider); 617 SetDefaultSearchProviderNoNotify(default_search_provider);
617 } else { 618 } else {
618 // If we had a managed default, replace it with the synced default if 619 // If we had a managed default, replace it with the synced default if
619 // applicable, or the first provider of the list. 620 // applicable, or the first provider of the list.
620 const TemplateURL* synced_default = GetPendingSyncedDefaultSearchProvider(); 621 const TemplateURL* synced_default = GetPendingSyncedDefaultSearchProvider();
621 if (synced_default) { 622 if (synced_default) {
622 default_search_provider = synced_default; 623 default_search_provider = synced_default;
623 pending_synced_default_search_ = false; 624 pending_synced_default_search_ = false;
624 } else if (database_specified_a_default && 625 } else if (database_specified_a_default &&
625 default_search_provider == NULL) { 626 default_search_provider == NULL) {
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 // TODO(mpcomplete): If we allow editing extension keywords, then those 2003 // TODO(mpcomplete): If we allow editing extension keywords, then those
2003 // should be persisted to disk and synced. 2004 // should be persisted to disk and synced.
2004 if (template_url->sync_guid().empty() && 2005 if (template_url->sync_guid().empty() &&
2005 !template_url->IsExtensionKeyword()) { 2006 !template_url->IsExtensionKeyword()) {
2006 template_url->data_.sync_guid = guid::GenerateGUID(); 2007 template_url->data_.sync_guid = guid::GenerateGUID();
2007 if (service_.get()) 2008 if (service_.get())
2008 service_->UpdateKeyword(*template_url); 2009 service_->UpdateKeyword(*template_url);
2009 } 2010 }
2010 } 2011 }
2011 } 2012 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698