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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 8 years 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/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "chrome/browser/metrics/variations/variations_service.h" 60 #include "chrome/browser/metrics/variations/variations_service.h"
61 #include "chrome/browser/nacl_host/nacl_process_host.h" 61 #include "chrome/browser/nacl_host/nacl_process_host.h"
62 #include "chrome/browser/net/chrome_net_log.h" 62 #include "chrome/browser/net/chrome_net_log.h"
63 #include "chrome/browser/notifications/desktop_notification_service.h" 63 #include "chrome/browser/notifications/desktop_notification_service.h"
64 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 64 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
65 #include "chrome/browser/page_cycler/page_cycler.h" 65 #include "chrome/browser/page_cycler/page_cycler.h"
66 #include "chrome/browser/performance_monitor/performance_monitor.h" 66 #include "chrome/browser/performance_monitor/performance_monitor.h"
67 #include "chrome/browser/performance_monitor/startup_timer.h" 67 #include "chrome/browser/performance_monitor/startup_timer.h"
68 #include "chrome/browser/plugins/plugin_prefs.h" 68 #include "chrome/browser/plugins/plugin_prefs.h"
69 #include "chrome/browser/policy/policy_service.h" 69 #include "chrome/browser/policy/policy_service.h"
70 #include "chrome/browser/prefs/chrome_pref_service_builder.h" 70 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
71 #include "chrome/browser/prefs/command_line_pref_store.h"
71 #include "chrome/browser/prefs/pref_service.h" 72 #include "chrome/browser/prefs/pref_service.h"
72 #include "chrome/browser/prefs/pref_value_store.h" 73 #include "chrome/browser/prefs/pref_value_store.h"
73 #include "chrome/browser/prefs/scoped_user_pref_update.h" 74 #include "chrome/browser/prefs/scoped_user_pref_update.h"
74 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 75 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
75 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" 76 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
76 #include "chrome/browser/process_singleton.h" 77 #include "chrome/browser/process_singleton.h"
77 #include "chrome/browser/profiles/profile.h" 78 #include "chrome/browser/profiles/profile.h"
78 #include "chrome/browser/profiles/profile_manager.h" 79 #include "chrome/browser/profiles/profile_manager.h"
79 #include "chrome/browser/search_engines/search_engine_type.h" 80 #include "chrome/browser/search_engines/search_engine_type.h"
80 #include "chrome/browser/search_engines/template_url.h" 81 #include "chrome/browser/search_engines/template_url.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 PrefService* InitializeLocalState( 227 PrefService* InitializeLocalState(
227 base::SequencedTaskRunner* local_state_task_runner, 228 base::SequencedTaskRunner* local_state_task_runner,
228 const CommandLine& parsed_command_line, 229 const CommandLine& parsed_command_line,
229 bool is_first_run) { 230 bool is_first_run) {
230 FilePath local_state_path; 231 FilePath local_state_path;
231 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 232 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
232 bool local_state_file_exists = file_util::PathExists(local_state_path); 233 bool local_state_file_exists = file_util::PathExists(local_state_path);
233 234
234 // Load local state. This includes the application locale so we know which 235 // Load local state. This includes the application locale so we know which
235 // locale dll to load. 236 // locale dll to load.
236 PrefService* local_state = g_browser_process->local_state(); 237 PrefServiceSimple* local_state = g_browser_process->local_state();
237 DCHECK(local_state); 238 DCHECK(local_state);
238 239
239 // TODO(brettw,*): this comment about ResourceBundle was here since 240 // TODO(brettw,*): this comment about ResourceBundle was here since
240 // initial commit. This comment seems unrelated, bit-rotten and 241 // initial commit. This comment seems unrelated, bit-rotten and
241 // a candidate for removal. 242 // a candidate for removal.
242 // Initialize ResourceBundle which handles files loaded from external 243 // Initialize ResourceBundle which handles files loaded from external
243 // sources. This has to be done before uninstall code path and before prefs 244 // sources. This has to be done before uninstall code path and before prefs
244 // are registered. 245 // are registered.
245 local_state->RegisterStringPref(prefs::kApplicationLocale, std::string()); 246 local_state->RegisterStringPref(prefs::kApplicationLocale, std::string());
246 #if defined(OS_CHROMEOS) 247 #if defined(OS_CHROMEOS)
(...skipping 28 matching lines...) Expand all
275 // since the parent profile command line flag can be present even when the 276 // since the parent profile command line flag can be present even when the
276 // current profile is not a new one, and in that case we do not want to 277 // current profile is not a new one, and in that case we do not want to
277 // inherit and reset the user's setting. 278 // inherit and reset the user's setting.
278 // 279 //
279 // TODO(mnissler): We should probably just instantiate a 280 // TODO(mnissler): We should probably just instantiate a
280 // JSONPrefStore here instead of an entire PrefService. 281 // JSONPrefStore here instead of an entire PrefService.
281 if (!local_state_file_exists && 282 if (!local_state_file_exists &&
282 parsed_command_line.HasSwitch(switches::kParentProfile)) { 283 parsed_command_line.HasSwitch(switches::kParentProfile)) {
283 FilePath parent_profile = 284 FilePath parent_profile =
284 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); 285 parsed_command_line.GetSwitchValuePath(switches::kParentProfile);
285 scoped_ptr<PrefService> parent_local_state( 286 scoped_ptr<PrefServiceSimple> parent_local_state(
286 ChromePrefServiceBuilder().CreateChromePrefs( 287 chrome_prefs::CreateLocalState(
287 parent_profile, 288 parent_profile,
288 local_state_task_runner, 289 local_state_task_runner,
289 g_browser_process->policy_service(), 290 g_browser_process->policy_service(),
290 NULL, false)); 291 NULL, false));
291 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, 292 parent_local_state->RegisterStringPref(prefs::kApplicationLocale,
292 std::string()); 293 std::string());
293 // Right now, we only inherit the locale setting from the parent profile. 294 // Right now, we only inherit the locale setting from the parent profile.
294 local_state->SetString( 295 local_state->SetString(
295 prefs::kApplicationLocale, 296 prefs::kApplicationLocale,
296 parent_local_state->GetString(prefs::kApplicationLocale)); 297 parent_local_state->GetString(prefs::kApplicationLocale));
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver 744 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver
744 chrome::UMABrowsingActivityObserver::Init(); 745 chrome::UMABrowsingActivityObserver::Init();
745 #endif 746 #endif
746 747
747 // Convert active labs into switches. This needs to be done before 748 // Convert active labs into switches. This needs to be done before
748 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are 749 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are
749 // affected by experiment flags (--touch-optimized-ui in particular). Not 750 // affected by experiment flags (--touch-optimized-ui in particular). Not
750 // needed on Android as there aren't experimental flags. 751 // needed on Android as there aren't experimental flags.
751 about_flags::ConvertFlagsToSwitches(local_state_, 752 about_flags::ConvertFlagsToSwitches(local_state_,
752 CommandLine::ForCurrentProcess()); 753 CommandLine::ForCurrentProcess());
753 local_state_->UpdateCommandLinePrefStore(CommandLine::ForCurrentProcess()); 754 local_state_->UpdateCommandLinePrefStore(
755 new CommandLinePrefStore(CommandLine::ForCurrentProcess()));
754 756
755 // Reset the command line in the crash report details, since we may have 757 // Reset the command line in the crash report details, since we may have
756 // just changed it to include experiments. 758 // just changed it to include experiments.
757 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); 759 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess());
758 760
759 // If we're running tests (ui_task is non-null), then the ResourceBundle 761 // If we're running tests (ui_task is non-null), then the ResourceBundle
760 // has already been initialized. 762 // has already been initialized.
761 if (parameters().ui_task && 763 if (parameters().ui_task &&
762 !local_state_->IsManagedPreference(prefs::kApplicationLocale)) { 764 !local_state_->IsManagedPreference(prefs::kApplicationLocale)) {
763 browser_process_->SetApplicationLocale("en-US"); 765 browser_process_->SetApplicationLocale("en-US");
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 if (base::win::GetVersion() <= base::win::VERSION_XP) 1683 if (base::win::GetVersion() <= base::win::VERSION_XP)
1682 uma_name += "_XP"; 1684 uma_name += "_XP";
1683 1685
1684 uma_name += "_PreRead_"; 1686 uma_name += "_PreRead_";
1685 uma_name += pre_read_percentage; 1687 uma_name += pre_read_percentage;
1686 AddPreReadHistogramTime(uma_name.c_str(), time); 1688 AddPreReadHistogramTime(uma_name.c_str(), time);
1687 } 1689 }
1688 #endif 1690 #endif
1689 #endif 1691 #endif
1690 } 1692 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/cookies_tree_model_unittest.cc ('k') | chrome/browser/chrome_browser_main_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698