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

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: Self review 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/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // Update the model if needed. 581 // Update the model if needed.
582 UpdateDefaultSearch(); 582 UpdateDefaultSearch();
583 } 583 }
584 } else { 584 } else {
585 NOTREACHED(); 585 NOTREACHED();
586 } 586 }
587 } 587 }
588 588
589 // static 589 // static
590 void TemplateURLModel::RegisterUserPrefs(PrefService* prefs) { 590 void TemplateURLModel::RegisterUserPrefs(PrefService* prefs) {
591 prefs->RegisterBooleanPref( 591 prefs->RegisterBooleanPref(prefs::kDefaultSearchProviderEnabled,
592 prefs::kDefaultSearchProviderEnabled, true); 592 true,
593 prefs->RegisterStringPref( 593 false /* don't sync pref */);
594 prefs::kDefaultSearchProviderName, std::string()); 594 prefs->RegisterStringPref(prefs::kDefaultSearchProviderName,
595 prefs->RegisterStringPref( 595 std::string(),
596 prefs::kDefaultSearchProviderID, std::string()); 596 false /* don't sync pref */);
597 prefs->RegisterStringPref( 597 prefs->RegisterStringPref(prefs::kDefaultSearchProviderID,
598 prefs::kDefaultSearchProviderPrepopulateID, std::string()); 598 std::string(),
599 prefs->RegisterStringPref( 599 false /* don't sync pref */);
600 prefs::kDefaultSearchProviderSuggestURL, std::string()); 600 prefs->RegisterStringPref(prefs::kDefaultSearchProviderPrepopulateID,
601 prefs->RegisterStringPref( 601 std::string(),
602 prefs::kDefaultSearchProviderSearchURL, std::string()); 602 false /* don't sync pref */);
603 prefs->RegisterStringPref( 603 prefs->RegisterStringPref(prefs::kDefaultSearchProviderSuggestURL,
604 prefs::kDefaultSearchProviderInstantURL, std::string()); 604 std::string(),
605 prefs->RegisterStringPref( 605 false /* don't sync pref */);
606 prefs::kDefaultSearchProviderKeyword, std::string()); 606 prefs->RegisterStringPref(prefs::kDefaultSearchProviderSearchURL,
607 prefs->RegisterStringPref( 607 std::string(),
608 prefs::kDefaultSearchProviderIconURL, std::string()); 608 false /* don't sync pref */);
609 prefs->RegisterStringPref( 609 prefs->RegisterStringPref(prefs::kDefaultSearchProviderInstantURL,
610 prefs::kDefaultSearchProviderEncodings, std::string()); 610 std::string(),
611 false /* don't sync pref */);
612 prefs->RegisterStringPref(prefs::kDefaultSearchProviderKeyword,
613 std::string(),
614 false /* don't sync pref */);
615 prefs->RegisterStringPref(prefs::kDefaultSearchProviderIconURL,
616 std::string(),
617 false /* don't sync pref */);
618 prefs->RegisterStringPref(prefs::kDefaultSearchProviderEncodings,
619 std::string(),
620 false /* don't sync pref */);
611 } 621 }
612 622
613 void TemplateURLModel::SetKeywordSearchTermsForURL(const TemplateURL* t_url, 623 void TemplateURLModel::SetKeywordSearchTermsForURL(const TemplateURL* t_url,
614 const GURL& url, 624 const GURL& url,
615 const string16& term) { 625 const string16& term) {
616 HistoryService* history = profile_ ? 626 HistoryService* history = profile_ ?
617 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS) : NULL; 627 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS) : NULL;
618 if (!history) 628 if (!history)
619 return; 629 return;
620 history->SetKeywordSearchTermsForURL(url, t_url->id(), term); 630 history->SetKeywordSearchTermsForURL(url, t_url->id(), term);
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 delete template_url; 1272 delete template_url;
1263 } 1273 }
1264 1274
1265 void TemplateURLModel::NotifyObservers() { 1275 void TemplateURLModel::NotifyObservers() {
1266 if (!loaded_) 1276 if (!loaded_)
1267 return; 1277 return;
1268 1278
1269 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, 1279 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_,
1270 OnTemplateURLModelChanged()); 1280 OnTemplateURLModelChanged());
1271 } 1281 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698