| OLD | NEW |
| 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_main.h" | 5 #include "chrome/browser/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 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "chrome/browser/metrics/metrics_log.h" | 50 #include "chrome/browser/metrics/metrics_log.h" |
| 51 #include "chrome/browser/metrics/metrics_service.h" | 51 #include "chrome/browser/metrics/metrics_service.h" |
| 52 #include "chrome/browser/metrics/thread_watcher.h" | 52 #include "chrome/browser/metrics/thread_watcher.h" |
| 53 #include "chrome/browser/net/chrome_dns_cert_provenance_checker.h" | 53 #include "chrome/browser/net/chrome_dns_cert_provenance_checker.h" |
| 54 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" | 54 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" |
| 55 #include "chrome/browser/net/chrome_net_log.h" | 55 #include "chrome/browser/net/chrome_net_log.h" |
| 56 #include "chrome/browser/net/predictor_api.h" | 56 #include "chrome/browser/net/predictor_api.h" |
| 57 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 57 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
| 58 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" | 58 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" |
| 59 #include "chrome/browser/plugin_updater.h" | 59 #include "chrome/browser/plugin_updater.h" |
| 60 #include "chrome/browser/policy/browser_policy_connector.h" |
| 60 #include "chrome/browser/prefs/pref_service.h" | 61 #include "chrome/browser/prefs/pref_service.h" |
| 61 #include "chrome/browser/prefs/pref_value_store.h" | 62 #include "chrome/browser/prefs/pref_value_store.h" |
| 62 #include "chrome/browser/prerender/prerender_field_trial.h" | 63 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 63 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 64 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 64 #include "chrome/browser/process_singleton.h" | 65 #include "chrome/browser/process_singleton.h" |
| 65 #include "chrome/browser/profiles/profile.h" | 66 #include "chrome/browser/profiles/profile.h" |
| 66 #include "chrome/browser/profiles/profile_manager.h" | 67 #include "chrome/browser/profiles/profile_manager.h" |
| 67 #include "chrome/browser/search_engines/search_engine_type.h" | 68 #include "chrome/browser/search_engines/search_engine_type.h" |
| 68 #include "chrome/browser/search_engines/template_url.h" | 69 #include "chrome/browser/search_engines/template_url.h" |
| 69 #include "chrome/browser/search_engines/template_url_service.h" | 70 #include "chrome/browser/search_engines/template_url_service.h" |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 // Checking that the local state file for the current profile doesn't exist | 789 // Checking that the local state file for the current profile doesn't exist |
| 789 // is the most robust way to determine whether we need to inherit or not | 790 // is the most robust way to determine whether we need to inherit or not |
| 790 // since the parent profile command line flag can be present even when the | 791 // since the parent profile command line flag can be present even when the |
| 791 // current profile is not a new one, and in that case we do not want to | 792 // current profile is not a new one, and in that case we do not want to |
| 792 // inherit and reset the user's setting. | 793 // inherit and reset the user's setting. |
| 793 if (!local_state_file_exists && | 794 if (!local_state_file_exists && |
| 794 parsed_command_line.HasSwitch(switches::kParentProfile)) { | 795 parsed_command_line.HasSwitch(switches::kParentProfile)) { |
| 795 FilePath parent_profile = | 796 FilePath parent_profile = |
| 796 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); | 797 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); |
| 797 scoped_ptr<PrefService> parent_local_state( | 798 scoped_ptr<PrefService> parent_local_state( |
| 798 PrefService::CreatePrefService(parent_profile, NULL, NULL, false)); | 799 PrefService::CreatePrefService(parent_profile, NULL, false)); |
| 799 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, | 800 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, |
| 800 std::string()); | 801 std::string()); |
| 801 // Right now, we only inherit the locale setting from the parent profile. | 802 // Right now, we only inherit the locale setting from the parent profile. |
| 802 local_state->SetString( | 803 local_state->SetString( |
| 803 prefs::kApplicationLocale, | 804 prefs::kApplicationLocale, |
| 804 parent_local_state->GetString(prefs::kApplicationLocale)); | 805 parent_local_state->GetString(prefs::kApplicationLocale)); |
| 805 } | 806 } |
| 806 | 807 |
| 807 #if defined(OS_CHROMEOS) | 808 #if defined(OS_CHROMEOS) |
| 808 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { | 809 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 logging::RedirectChromeLogging(parsed_command_line); | 1586 logging::RedirectChromeLogging(parsed_command_line); |
| 1586 } | 1587 } |
| 1587 #endif | 1588 #endif |
| 1588 | 1589 |
| 1589 Profile* profile = CreateProfile(parameters, user_data_dir); | 1590 Profile* profile = CreateProfile(parameters, user_data_dir); |
| 1590 if (!profile) | 1591 if (!profile) |
| 1591 return ResultCodes::NORMAL_EXIT; | 1592 return ResultCodes::NORMAL_EXIT; |
| 1592 | 1593 |
| 1593 // Post-profile init --------------------------------------------------------- | 1594 // Post-profile init --------------------------------------------------------- |
| 1594 | 1595 |
| 1596 #if defined(OS_CHROMEOS) |
| 1597 // Handling the user cloud policy initialization for case 2 mentioned above. |
| 1598 // We do this after the profile creation since we need the TokenService. |
| 1599 if (parsed_command_line.HasSwitch(switches::kLoginUser) && |
| 1600 !parsed_command_line.HasSwitch(switches::kLoginPassword)) { |
| 1601 std::string username = |
| 1602 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); |
| 1603 policy::BrowserPolicyConnector* browser_policy_connector = |
| 1604 g_browser_process->browser_policy_connector(); |
| 1605 browser_policy_connector->InitializeUserPolicy(username, |
| 1606 profile->GetPath(), |
| 1607 profile->GetTokenService()); |
| 1608 } |
| 1609 #endif |
| 1610 |
| 1595 PrefService* user_prefs = profile->GetPrefs(); | 1611 PrefService* user_prefs = profile->GetPrefs(); |
| 1596 DCHECK(user_prefs); | 1612 DCHECK(user_prefs); |
| 1597 | 1613 |
| 1598 // Tests should be able to tune login manager before showing it. | 1614 // Tests should be able to tune login manager before showing it. |
| 1599 // Thus only show login manager in normal (non-testing) mode. | 1615 // Thus only show login manager in normal (non-testing) mode. |
| 1600 if (!parameters.ui_task) { | 1616 if (!parameters.ui_task) { |
| 1601 OptionallyRunChromeOSLoginManager(parsed_command_line); | 1617 OptionallyRunChromeOSLoginManager(parsed_command_line); |
| 1602 } | 1618 } |
| 1603 | 1619 |
| 1604 #if !defined(OS_MACOSX) | 1620 #if !defined(OS_MACOSX) |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2002 #if defined(OS_CHROMEOS) | 2018 #if defined(OS_CHROMEOS) |
| 2003 // To be precise, logout (browser shutdown) is not yet done, but the | 2019 // To be precise, logout (browser shutdown) is not yet done, but the |
| 2004 // remaining work is negligible, hence we say LogoutDone here. | 2020 // remaining work is negligible, hence we say LogoutDone here. |
| 2005 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2021 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 2006 false); | 2022 false); |
| 2007 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2023 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 2008 #endif | 2024 #endif |
| 2009 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2025 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
| 2010 return result_code; | 2026 return result_code; |
| 2011 } | 2027 } |
| OLD | NEW |