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

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

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix. And rebase Created 9 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) 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/template_url_model.h" 5 #include "chrome/browser/search_engines/template_url_model.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/environment.h" 8 #include "base/environment.h"
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // Update the model if needed. 582 // Update the model if needed.
583 UpdateDefaultSearch(); 583 UpdateDefaultSearch();
584 } 584 }
585 } else { 585 } else {
586 NOTREACHED(); 586 NOTREACHED();
587 } 587 }
588 } 588 }
589 589
590 // static 590 // static
591 void TemplateURLModel::RegisterUserPrefs(PrefService* prefs) { 591 void TemplateURLModel::RegisterUserPrefs(PrefService* prefs) {
592 prefs->RegisterBooleanPref( 592 prefs->RegisterBooleanPref(prefs::kDefaultSearchProviderEnabled,
593 prefs::kDefaultSearchProviderEnabled, true); 593 true,
594 prefs->RegisterStringPref( 594 PrefService::UNSYNCABLE_PREF);
595 prefs::kDefaultSearchProviderName, std::string()); 595 prefs->RegisterStringPref(prefs::kDefaultSearchProviderName,
596 prefs->RegisterStringPref( 596 std::string(),
597 prefs::kDefaultSearchProviderID, std::string()); 597 PrefService::UNSYNCABLE_PREF);
598 prefs->RegisterStringPref( 598 prefs->RegisterStringPref(prefs::kDefaultSearchProviderID,
599 prefs::kDefaultSearchProviderPrepopulateID, std::string()); 599 std::string(),
600 prefs->RegisterStringPref( 600 PrefService::UNSYNCABLE_PREF);
601 prefs::kDefaultSearchProviderSuggestURL, std::string()); 601 prefs->RegisterStringPref(prefs::kDefaultSearchProviderPrepopulateID,
602 prefs->RegisterStringPref( 602 std::string(),
603 prefs::kDefaultSearchProviderSearchURL, std::string()); 603 PrefService::UNSYNCABLE_PREF);
604 prefs->RegisterStringPref( 604 prefs->RegisterStringPref(prefs::kDefaultSearchProviderSuggestURL,
605 prefs::kDefaultSearchProviderInstantURL, std::string()); 605 std::string(),
606 prefs->RegisterStringPref( 606 PrefService::UNSYNCABLE_PREF);
607 prefs::kDefaultSearchProviderKeyword, std::string()); 607 prefs->RegisterStringPref(prefs::kDefaultSearchProviderSearchURL,
608 prefs->RegisterStringPref( 608 std::string(),
609 prefs::kDefaultSearchProviderIconURL, std::string()); 609 PrefService::UNSYNCABLE_PREF);
610 prefs->RegisterStringPref( 610 prefs->RegisterStringPref(prefs::kDefaultSearchProviderInstantURL,
611 prefs::kDefaultSearchProviderEncodings, std::string()); 611 std::string(),
612 PrefService::UNSYNCABLE_PREF);
613 prefs->RegisterStringPref(prefs::kDefaultSearchProviderKeyword,
614 std::string(),
615 PrefService::UNSYNCABLE_PREF);
616 prefs->RegisterStringPref(prefs::kDefaultSearchProviderIconURL,
617 std::string(),
618 PrefService::UNSYNCABLE_PREF);
619 prefs->RegisterStringPref(prefs::kDefaultSearchProviderEncodings,
620 std::string(),
621 PrefService::UNSYNCABLE_PREF);
612 } 622 }
613 623
614 void TemplateURLModel::SetKeywordSearchTermsForURL(const TemplateURL* t_url, 624 void TemplateURLModel::SetKeywordSearchTermsForURL(const TemplateURL* t_url,
615 const GURL& url, 625 const GURL& url,
616 const string16& term) { 626 const string16& term) {
617 HistoryService* history = profile_ ? 627 HistoryService* history = profile_ ?
618 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS) : NULL; 628 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS) : NULL;
619 if (!history) 629 if (!history)
620 return; 630 return;
621 history->SetKeywordSearchTermsForURL(url, t_url->id(), term); 631 history->SetKeywordSearchTermsForURL(url, t_url->id(), term);
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 delete template_url; 1273 delete template_url;
1264 } 1274 }
1265 1275
1266 void TemplateURLModel::NotifyObservers() { 1276 void TemplateURLModel::NotifyObservers() {
1267 if (!loaded_) 1277 if (!loaded_)
1268 return; 1278 return;
1269 1279
1270 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, 1280 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_,
1271 OnTemplateURLModelChanged()); 1281 OnTemplateURLModelChanged());
1272 } 1282 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/search_engines/template_url_prepopulate_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698