Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 #include "chrome/browser/metrics/variations/variations_service.h" | 59 #include "chrome/browser/metrics/variations/variations_service.h" |
| 60 #include "chrome/browser/nacl_host/nacl_process_host.h" | 60 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 61 #include "chrome/browser/net/chrome_net_log.h" | 61 #include "chrome/browser/net/chrome_net_log.h" |
| 62 #include "chrome/browser/notifications/desktop_notification_service.h" | 62 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 63 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 63 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 64 #include "chrome/browser/page_cycler/page_cycler.h" | 64 #include "chrome/browser/page_cycler/page_cycler.h" |
| 65 #include "chrome/browser/performance_monitor/performance_monitor.h" | 65 #include "chrome/browser/performance_monitor/performance_monitor.h" |
| 66 #include "chrome/browser/performance_monitor/startup_timer.h" | 66 #include "chrome/browser/performance_monitor/startup_timer.h" |
| 67 #include "chrome/browser/plugins/plugin_prefs.h" | 67 #include "chrome/browser/plugins/plugin_prefs.h" |
| 68 #include "chrome/browser/policy/policy_service.h" | 68 #include "chrome/browser/policy/policy_service.h" |
| 69 #include "chrome/browser/prefs/chrome_pref_service_builder.h" | 69 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 70 #include "chrome/browser/prefs/command_line_pref_store.h" | |
| 70 #include "chrome/browser/prefs/pref_service.h" | 71 #include "chrome/browser/prefs/pref_service.h" |
| 71 #include "chrome/browser/prefs/pref_value_store.h" | 72 #include "chrome/browser/prefs/pref_value_store.h" |
| 72 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 73 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 73 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 74 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 74 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" | 75 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" |
| 75 #include "chrome/browser/process_singleton.h" | 76 #include "chrome/browser/process_singleton.h" |
| 76 #include "chrome/browser/profiles/profile.h" | 77 #include "chrome/browser/profiles/profile.h" |
| 77 #include "chrome/browser/profiles/profile_manager.h" | 78 #include "chrome/browser/profiles/profile_manager.h" |
| 78 #include "chrome/browser/search_engines/search_engine_type.h" | 79 #include "chrome/browser/search_engines/search_engine_type.h" |
| 79 #include "chrome/browser/search_engines/template_url.h" | 80 #include "chrome/browser/search_engines/template_url.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 PrefService* InitializeLocalState( | 226 PrefService* InitializeLocalState( |
| 226 base::SequencedTaskRunner* local_state_task_runner, | 227 base::SequencedTaskRunner* local_state_task_runner, |
| 227 const CommandLine& parsed_command_line, | 228 const CommandLine& parsed_command_line, |
| 228 bool is_first_run) { | 229 bool is_first_run) { |
| 229 FilePath local_state_path; | 230 FilePath local_state_path; |
| 230 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 231 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
| 231 bool local_state_file_exists = file_util::PathExists(local_state_path); | 232 bool local_state_file_exists = file_util::PathExists(local_state_path); |
| 232 | 233 |
| 233 // Load local state. This includes the application locale so we know which | 234 // Load local state. This includes the application locale so we know which |
| 234 // locale dll to load. | 235 // locale dll to load. |
| 235 PrefService* local_state = g_browser_process->local_state(); | 236 PrefServiceSimple* local_state = g_browser_process->local_state(); |
| 236 DCHECK(local_state); | 237 DCHECK(local_state); |
| 237 | 238 |
| 238 // TODO(brettw,*): this comment about ResourceBundle was here since | 239 // TODO(brettw,*): this comment about ResourceBundle was here since |
| 239 // initial commit. This comment seems unrelated, bit-rotten and | 240 // initial commit. This comment seems unrelated, bit-rotten and |
| 240 // a candidate for removal. | 241 // a candidate for removal. |
| 241 // Initialize ResourceBundle which handles files loaded from external | 242 // Initialize ResourceBundle which handles files loaded from external |
| 242 // sources. This has to be done before uninstall code path and before prefs | 243 // sources. This has to be done before uninstall code path and before prefs |
| 243 // are registered. | 244 // are registered. |
| 244 local_state->RegisterStringPref(prefs::kApplicationLocale, std::string()); | 245 local_state->RegisterStringPref(prefs::kApplicationLocale, std::string()); |
| 245 #if defined(OS_CHROMEOS) | 246 #if defined(OS_CHROMEOS) |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 271 // local state from the parent profile. | 272 // local state from the parent profile. |
| 272 // Checking that the local state file for the current profile doesn't exist | 273 // Checking that the local state file for the current profile doesn't exist |
| 273 // is the most robust way to determine whether we need to inherit or not | 274 // is the most robust way to determine whether we need to inherit or not |
| 274 // since the parent profile command line flag can be present even when the | 275 // since the parent profile command line flag can be present even when the |
| 275 // current profile is not a new one, and in that case we do not want to | 276 // current profile is not a new one, and in that case we do not want to |
| 276 // inherit and reset the user's setting. | 277 // inherit and reset the user's setting. |
| 277 if (!local_state_file_exists && | 278 if (!local_state_file_exists && |
| 278 parsed_command_line.HasSwitch(switches::kParentProfile)) { | 279 parsed_command_line.HasSwitch(switches::kParentProfile)) { |
| 279 FilePath parent_profile = | 280 FilePath parent_profile = |
| 280 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); | 281 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); |
| 281 scoped_ptr<PrefService> parent_local_state( | 282 scoped_ptr<PrefServiceSimple> parent_local_state( |
| 282 ChromePrefServiceBuilder().CreateChromePrefs( | 283 ChromePrefServiceFactory().CreateLocalState( |
| 283 parent_profile, | 284 parent_profile, |
| 284 local_state_task_runner, | 285 local_state_task_runner, |
| 285 g_browser_process->policy_service(), | 286 g_browser_process->policy_service(), |
| 286 NULL, false)); | 287 NULL, false)); |
| 287 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, | 288 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, |
| 288 std::string()); | 289 std::string()); |
| 289 // Right now, we only inherit the locale setting from the parent profile. | 290 // Right now, we only inherit the locale setting from the parent profile. |
| 290 local_state->SetString( | 291 local_state->SetString( |
| 291 prefs::kApplicationLocale, | 292 prefs::kApplicationLocale, |
| 292 parent_local_state->GetString(prefs::kApplicationLocale)); | 293 parent_local_state->GetString(prefs::kApplicationLocale)); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 744 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver | 745 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver |
| 745 chrome::UMABrowsingActivityObserver::Init(); | 746 chrome::UMABrowsingActivityObserver::Init(); |
| 746 #endif | 747 #endif |
| 747 | 748 |
| 748 // Convert active labs into switches. This needs to be done before | 749 // Convert active labs into switches. This needs to be done before |
| 749 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are | 750 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are |
| 750 // affected by experiment flags (--touch-optimized-ui in particular). Not | 751 // affected by experiment flags (--touch-optimized-ui in particular). Not |
| 751 // needed on Android as there aren't experimental flags. | 752 // needed on Android as there aren't experimental flags. |
| 752 about_flags::ConvertFlagsToSwitches(local_state_, | 753 about_flags::ConvertFlagsToSwitches(local_state_, |
| 753 CommandLine::ForCurrentProcess()); | 754 CommandLine::ForCurrentProcess()); |
| 754 local_state_->UpdateCommandLinePrefStore(CommandLine::ForCurrentProcess()); | 755 local_state_->UpdateCommandLinePrefStore( |
|
Mattias Nissler (ping if slow)
2012/12/19 19:50:22
Ugh, UpdateCommandLinePrefStore shouldn't be in th
Jói
2012/12/20 16:30:31
Sounds good, thanks.
| |
| 756 new CommandLinePrefStore(CommandLine::ForCurrentProcess())); | |
| 755 | 757 |
| 756 // Reset the command line in the crash report details, since we may have | 758 // Reset the command line in the crash report details, since we may have |
| 757 // just changed it to include experiments. | 759 // just changed it to include experiments. |
| 758 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); | 760 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); |
| 759 | 761 |
| 760 // If we're running tests (ui_task is non-null), then the ResourceBundle | 762 // If we're running tests (ui_task is non-null), then the ResourceBundle |
| 761 // has already been initialized. | 763 // has already been initialized. |
| 762 if (parameters().ui_task && | 764 if (parameters().ui_task && |
| 763 !local_state_->IsManagedPreference(prefs::kApplicationLocale)) { | 765 !local_state_->IsManagedPreference(prefs::kApplicationLocale)) { |
| 764 browser_process_->SetApplicationLocale("en-US"); | 766 browser_process_->SetApplicationLocale("en-US"); |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 } |
| OLD | NEW |