| 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 28 matching lines...) Expand all Loading... |
| 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 // | 278 // |
| 278 // TODO(mnissler): We should probably just instantiate a | 279 // TODO(mnissler): We should probably just instantiate a |
| 279 // JSONPrefStore here instead of an entire PrefService. | 280 // JSONPrefStore here instead of an entire PrefService. |
| 280 if (!local_state_file_exists && | 281 if (!local_state_file_exists && |
| 281 parsed_command_line.HasSwitch(switches::kParentProfile)) { | 282 parsed_command_line.HasSwitch(switches::kParentProfile)) { |
| 282 FilePath parent_profile = | 283 FilePath parent_profile = |
| 283 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); | 284 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); |
| 284 scoped_ptr<PrefService> parent_local_state( | 285 scoped_ptr<PrefServiceSimple> parent_local_state( |
| 285 ChromePrefServiceBuilder().CreateChromePrefs( | 286 chrome_prefs::CreateLocalState( |
| 286 parent_profile, | 287 parent_profile, |
| 287 local_state_task_runner, | 288 local_state_task_runner, |
| 288 g_browser_process->policy_service(), | 289 g_browser_process->policy_service(), |
| 289 NULL, false)); | 290 NULL, false)); |
| 290 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, | 291 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, |
| 291 std::string()); | 292 std::string()); |
| 292 // Right now, we only inherit the locale setting from the parent profile. | 293 // Right now, we only inherit the locale setting from the parent profile. |
| 293 local_state->SetString( | 294 local_state->SetString( |
| 294 prefs::kApplicationLocale, | 295 prefs::kApplicationLocale, |
| 295 parent_local_state->GetString(prefs::kApplicationLocale)); | 296 parent_local_state->GetString(prefs::kApplicationLocale)); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver | 748 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver |
| 748 chrome::UMABrowsingActivityObserver::Init(); | 749 chrome::UMABrowsingActivityObserver::Init(); |
| 749 #endif | 750 #endif |
| 750 | 751 |
| 751 // Convert active labs into switches. This needs to be done before | 752 // Convert active labs into switches. This needs to be done before |
| 752 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are | 753 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are |
| 753 // affected by experiment flags (--touch-optimized-ui in particular). Not | 754 // affected by experiment flags (--touch-optimized-ui in particular). Not |
| 754 // needed on Android as there aren't experimental flags. | 755 // needed on Android as there aren't experimental flags. |
| 755 about_flags::ConvertFlagsToSwitches(local_state_, | 756 about_flags::ConvertFlagsToSwitches(local_state_, |
| 756 CommandLine::ForCurrentProcess()); | 757 CommandLine::ForCurrentProcess()); |
| 757 local_state_->UpdateCommandLinePrefStore(CommandLine::ForCurrentProcess()); | 758 local_state_->UpdateCommandLinePrefStore( |
| 759 new CommandLinePrefStore(CommandLine::ForCurrentProcess())); |
| 758 | 760 |
| 759 // Reset the command line in the crash report details, since we may have | 761 // Reset the command line in the crash report details, since we may have |
| 760 // just changed it to include experiments. | 762 // just changed it to include experiments. |
| 761 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); | 763 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); |
| 762 | 764 |
| 763 // If we're running tests (ui_task is non-null), then the ResourceBundle | 765 // If we're running tests (ui_task is non-null), then the ResourceBundle |
| 764 // has already been initialized. | 766 // has already been initialized. |
| 765 if (parameters().ui_task && | 767 if (parameters().ui_task && |
| 766 !local_state_->IsManagedPreference(prefs::kApplicationLocale)) { | 768 !local_state_->IsManagedPreference(prefs::kApplicationLocale)) { |
| 767 browser_process_->SetApplicationLocale("en-US"); | 769 browser_process_->SetApplicationLocale("en-US"); |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1686 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1685 uma_name += "_XP"; | 1687 uma_name += "_XP"; |
| 1686 | 1688 |
| 1687 uma_name += "_PreRead_"; | 1689 uma_name += "_PreRead_"; |
| 1688 uma_name += pre_read_percentage; | 1690 uma_name += pre_read_percentage; |
| 1689 AddPreReadHistogramTime(uma_name.c_str(), time); | 1691 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1690 } | 1692 } |
| 1691 #endif | 1693 #endif |
| 1692 #endif | 1694 #endif |
| 1693 } | 1695 } |
| OLD | NEW |