| 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 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
| 18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/process_info.h" | 20 #include "base/process_info.h" |
| 21 #include "base/process_util.h" | 21 #include "base/process_util.h" |
| 22 #include "base/run_loop.h" | 22 #include "base/run_loop.h" |
| 23 #include "base/string_number_conversions.h" | 23 #include "base/string_number_conversions.h" |
| 24 #include "base/string_piece.h" | 24 #include "base/string_piece.h" |
| 25 #include "base/string_split.h" | 25 #include "base/string_split.h" |
| 26 #include "base/sys_string_conversions.h" | 26 #include "base/sys_string_conversions.h" |
| 27 #include "base/threading/platform_thread.h" | 27 #include "base/threading/platform_thread.h" |
| 28 #include "base/threading/sequenced_worker_pool.h" |
| 28 #include "base/time.h" | 29 #include "base/time.h" |
| 29 #include "base/utf_string_conversions.h" | 30 #include "base/utf_string_conversions.h" |
| 30 #include "base/values.h" | 31 #include "base/values.h" |
| 31 #include "build/build_config.h" | 32 #include "build/build_config.h" |
| 32 #include "chrome/browser/about_flags.h" | 33 #include "chrome/browser/about_flags.h" |
| 33 #include "chrome/browser/browser_process.h" | 34 #include "chrome/browser/browser_process.h" |
| 34 #include "chrome/browser/browser_process_impl.h" | 35 #include "chrome/browser/browser_process_impl.h" |
| 35 #include "chrome/browser/browser_shutdown.h" | 36 #include "chrome/browser/browser_shutdown.h" |
| 36 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 37 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
| 37 #include "chrome/browser/chrome_gpu_util.h" | 38 #include "chrome/browser/chrome_gpu_util.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // becomes our default language in the prefs. | 304 // becomes our default language in the prefs. |
| 304 // Other platforms obey the system locale. | 305 // Other platforms obey the system locale. |
| 305 std::wstring install_lang; | 306 std::wstring install_lang; |
| 306 if (GoogleUpdateSettings::GetLanguage(&install_lang)) { | 307 if (GoogleUpdateSettings::GetLanguage(&install_lang)) { |
| 307 local_state->SetString(prefs::kApplicationLocale, | 308 local_state->SetString(prefs::kApplicationLocale, |
| 308 WideToASCII(install_lang)); | 309 WideToASCII(install_lang)); |
| 309 } | 310 } |
| 310 #endif // defined(OS_WIN) | 311 #endif // defined(OS_WIN) |
| 311 } | 312 } |
| 312 | 313 |
| 314 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = |
| 315 BrowserThread::GetBlockingPool()-> |
| 316 GetSequencedTaskRunnerWithShutdownBehavior( |
| 317 BrowserThread::GetBlockingPool()->GetNamedSequenceToken( |
| 318 "local_state_pool"), |
| 319 base::SequencedWorkerPool::BLOCK_SHUTDOWN); |
| 320 |
| 313 // If the local state file for the current profile doesn't exist and the | 321 // If the local state file for the current profile doesn't exist and the |
| 314 // parent profile command line flag is present, then we should inherit some | 322 // parent profile command line flag is present, then we should inherit some |
| 315 // local state from the parent profile. | 323 // local state from the parent profile. |
| 316 // Checking that the local state file for the current profile doesn't exist | 324 // Checking that the local state file for the current profile doesn't exist |
| 317 // is the most robust way to determine whether we need to inherit or not | 325 // is the most robust way to determine whether we need to inherit or not |
| 318 // since the parent profile command line flag can be present even when the | 326 // since the parent profile command line flag can be present even when the |
| 319 // current profile is not a new one, and in that case we do not want to | 327 // current profile is not a new one, and in that case we do not want to |
| 320 // inherit and reset the user's setting. | 328 // inherit and reset the user's setting. |
| 321 if (!local_state_file_exists && | 329 if (!local_state_file_exists && |
| 322 parsed_command_line.HasSwitch(switches::kParentProfile)) { | 330 parsed_command_line.HasSwitch(switches::kParentProfile)) { |
| 323 FilePath parent_profile = | 331 FilePath parent_profile = |
| 324 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); | 332 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); |
| 325 scoped_ptr<PrefService> parent_local_state( | 333 scoped_ptr<PrefService> parent_local_state( |
| 326 PrefService::CreatePrefService(parent_profile, | 334 PrefService::CreatePrefService(parent_profile, |
| 327 g_browser_process->policy_service(), | 335 g_browser_process->policy_service(), |
| 328 NULL, false)); | 336 NULL, false, sequenced_task_runner)); |
| 329 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, | 337 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, |
| 330 std::string()); | 338 std::string()); |
| 331 // Right now, we only inherit the locale setting from the parent profile. | 339 // Right now, we only inherit the locale setting from the parent profile. |
| 332 local_state->SetString( | 340 local_state->SetString( |
| 333 prefs::kApplicationLocale, | 341 prefs::kApplicationLocale, |
| 334 parent_local_state->GetString(prefs::kApplicationLocale)); | 342 parent_local_state->GetString(prefs::kApplicationLocale)); |
| 335 } | 343 } |
| 336 | 344 |
| 337 #if defined(OS_CHROMEOS) | 345 #if defined(OS_CHROMEOS) |
| 338 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { | 346 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { |
| (...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1649 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1642 uma_name += "_XP"; | 1650 uma_name += "_XP"; |
| 1643 | 1651 |
| 1644 uma_name += "_PreRead_"; | 1652 uma_name += "_PreRead_"; |
| 1645 uma_name += pre_read_percentage; | 1653 uma_name += pre_read_percentage; |
| 1646 AddPreReadHistogramTime(uma_name.c_str(), time); | 1654 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1647 } | 1655 } |
| 1648 #endif | 1656 #endif |
| 1649 #endif | 1657 #endif |
| 1650 } | 1658 } |
| OLD | NEW |