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

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 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
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/browser_process_impl.h" 5 #include "chrome/browser/browser_process_impl.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 local_state_.reset( 836 local_state_.reset(
837 PrefService::CreatePrefService(local_state_path, NULL, NULL)); 837 PrefService::CreatePrefService(local_state_path, NULL, NULL));
838 838
839 // Initialize the prefs of the local state. 839 // Initialize the prefs of the local state.
840 browser::RegisterLocalState(local_state_.get()); 840 browser::RegisterLocalState(local_state_.get());
841 841
842 pref_change_registrar_.Init(local_state_.get()); 842 pref_change_registrar_.Init(local_state_.get());
843 843
844 // Make sure the the plugin updater gets notifications of changes 844 // Make sure the the plugin updater gets notifications of changes
845 // in the plugin policy lists. 845 // in the plugin policy lists.
846 local_state_->RegisterListPref(prefs::kPluginsDisabledPlugins); 846 local_state_->RegisterListPref(prefs::kPluginsDisabledPlugins,
847 false /* don't sync pref */);
847 pref_change_registrar_.Add(prefs::kPluginsDisabledPlugins, 848 pref_change_registrar_.Add(prefs::kPluginsDisabledPlugins,
848 PluginUpdater::GetInstance()); 849 PluginUpdater::GetInstance());
849 local_state_->RegisterListPref(prefs::kPluginsDisabledPluginsExceptions); 850 local_state_->RegisterListPref(prefs::kPluginsDisabledPluginsExceptions,
851 false /* don't sync pref */);
850 pref_change_registrar_.Add(prefs::kPluginsDisabledPluginsExceptions, 852 pref_change_registrar_.Add(prefs::kPluginsDisabledPluginsExceptions,
851 PluginUpdater::GetInstance()); 853 PluginUpdater::GetInstance());
852 local_state_->RegisterListPref(prefs::kPluginsEnabledPlugins); 854 local_state_->RegisterListPref(prefs::kPluginsEnabledPlugins,
855 false /* don't sync pref */);
853 pref_change_registrar_.Add(prefs::kPluginsEnabledPlugins, 856 pref_change_registrar_.Add(prefs::kPluginsEnabledPlugins,
854 PluginUpdater::GetInstance()); 857 PluginUpdater::GetInstance());
855 858
856 // Initialize and set up notifications for the printing enabled 859 // Initialize and set up notifications for the printing enabled
857 // preference. 860 // preference.
858 local_state_->RegisterBooleanPref(prefs::kPrintingEnabled, true); 861 local_state_->RegisterBooleanPref(prefs::kPrintingEnabled,
862 true,
863 false /* don't sync pref */);
859 bool printing_enabled = 864 bool printing_enabled =
860 local_state_->GetBoolean(prefs::kPrintingEnabled); 865 local_state_->GetBoolean(prefs::kPrintingEnabled);
861 print_job_manager_->set_printing_enabled(printing_enabled); 866 print_job_manager_->set_printing_enabled(printing_enabled);
862 pref_change_registrar_.Add(prefs::kPrintingEnabled, 867 pref_change_registrar_.Add(prefs::kPrintingEnabled,
863 print_job_manager_.get()); 868 print_job_manager_.get());
864 869
865 // Initialize the notification for the default browser setting policy. 870 // Initialize the notification for the default browser setting policy.
866 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, 871 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled,
867 false); 872 false,
873 false /* don't sync pref */);
868 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) { 874 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) {
869 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) 875 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled))
870 ShellIntegration::SetAsDefaultBrowser(); 876 ShellIntegration::SetAsDefaultBrowser();
871 } 877 }
872 pref_change_registrar_.Add(prefs::kDefaultBrowserSettingEnabled, this); 878 pref_change_registrar_.Add(prefs::kDefaultBrowserSettingEnabled, this);
873 879
874 // Initialize the preference for the plugin finder policy. 880 // Initialize the preference for the plugin finder policy.
875 // This preference is only needed on the IO thread so make it available there. 881 // This preference is only needed on the IO thread so make it available there.
876 local_state_->RegisterBooleanPref(prefs::kDisablePluginFinder, false); 882 local_state_->RegisterBooleanPref(prefs::kDisablePluginFinder,
883 false,
884 false /* don't sync pref */);
877 plugin_finder_disabled_pref_.Init(prefs::kDisablePluginFinder, 885 plugin_finder_disabled_pref_.Init(prefs::kDisablePluginFinder,
878 local_state_.get(), NULL); 886 local_state_.get(), NULL);
879 plugin_finder_disabled_pref_.MoveToThread(BrowserThread::IO); 887 plugin_finder_disabled_pref_.MoveToThread(BrowserThread::IO);
880 888
881 // Initialize the preference for the disabled schemes policy, and 889 // Initialize the preference for the disabled schemes policy, and
882 // load the initial policy on startup. 890 // load the initial policy on startup.
883 local_state_->RegisterListPref(prefs::kDisabledSchemes); 891 local_state_->RegisterListPref(prefs::kDisabledSchemes,
892 false /* don't sync pref */);
884 disabled_schemes_pref_.Init(prefs::kDisabledSchemes, local_state_.get(), 893 disabled_schemes_pref_.Init(prefs::kDisabledSchemes, local_state_.get(),
885 this); 894 this);
886 ApplyDisabledSchemesPolicy(); 895 ApplyDisabledSchemesPolicy();
887 } 896 }
888 897
889 void BrowserProcessImpl::CreateIconManager() { 898 void BrowserProcessImpl::CreateIconManager() {
890 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); 899 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL);
891 created_icon_manager_ = true; 900 created_icon_manager_ = true;
892 icon_manager_.reset(new IconManager); 901 icon_manager_.reset(new IconManager);
893 } 902 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 } 1078 }
1070 1079
1071 void BrowserProcessImpl::OnAutoupdateTimer() { 1080 void BrowserProcessImpl::OnAutoupdateTimer() {
1072 if (CanAutorestartForUpdate()) { 1081 if (CanAutorestartForUpdate()) {
1073 DLOG(WARNING) << "Detected update. Restarting browser."; 1082 DLOG(WARNING) << "Detected update. Restarting browser.";
1074 RestartPersistentInstance(); 1083 RestartPersistentInstance();
1075 } 1084 }
1076 } 1085 }
1077 1086
1078 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1087 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698