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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 // Checking that the local state file for the current profile doesn't exist | 807 // Checking that the local state file for the current profile doesn't exist |
807 // is the most robust way to determine whether we need to inherit or not | 808 // is the most robust way to determine whether we need to inherit or not |
808 // since the parent profile command line flag can be present even when the | 809 // since the parent profile command line flag can be present even when the |
809 // current profile is not a new one, and in that case we do not want to | 810 // current profile is not a new one, and in that case we do not want to |
810 // inherit and reset the user's setting. | 811 // inherit and reset the user's setting. |
811 if (!local_state_file_exists && | 812 if (!local_state_file_exists && |
812 parsed_command_line.HasSwitch(switches::kParentProfile)) { | 813 parsed_command_line.HasSwitch(switches::kParentProfile)) { |
813 FilePath parent_profile = | 814 FilePath parent_profile = |
814 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); | 815 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); |
815 scoped_ptr<PrefService> parent_local_state( | 816 scoped_ptr<PrefService> parent_local_state( |
816 PrefService::CreatePrefService(parent_profile, NULL, NULL, false)); | 817 PrefService::CreatePrefService(parent_profile, NULL, false)); |
817 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, | 818 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, |
818 std::string()); | 819 std::string()); |
819 // Right now, we only inherit the locale setting from the parent profile. | 820 // Right now, we only inherit the locale setting from the parent profile. |
820 local_state->SetString( | 821 local_state->SetString( |
821 prefs::kApplicationLocale, | 822 prefs::kApplicationLocale, |
822 parent_local_state->GetString(prefs::kApplicationLocale)); | 823 parent_local_state->GetString(prefs::kApplicationLocale)); |
823 } | 824 } |
824 | 825 |
825 #if defined(OS_CHROMEOS) | 826 #if defined(OS_CHROMEOS) |
826 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { | 827 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 logging::RedirectChromeLogging(parsed_command_line); | 1590 logging::RedirectChromeLogging(parsed_command_line); |
1590 } | 1591 } |
1591 #endif | 1592 #endif |
1592 | 1593 |
1593 Profile* profile = CreateProfile(parameters, user_data_dir); | 1594 Profile* profile = CreateProfile(parameters, user_data_dir); |
1594 if (!profile) | 1595 if (!profile) |
1595 return ResultCodes::NORMAL_EXIT; | 1596 return ResultCodes::NORMAL_EXIT; |
1596 | 1597 |
1597 // Post-profile init --------------------------------------------------------- | 1598 // Post-profile init --------------------------------------------------------- |
1598 | 1599 |
| 1600 #if defined(OS_CHROMEOS) |
| 1601 // Handling the user cloud policy initialization for case 2 mentioned above. |
| 1602 // We do this after the profile creation since we need the TokenService. |
| 1603 if (parsed_command_line.HasSwitch(switches::kLoginUser) && |
| 1604 !parsed_command_line.HasSwitch(switches::kLoginPassword)) { |
| 1605 std::string username = |
| 1606 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); |
| 1607 policy::BrowserPolicyConnector* browser_policy_connector = |
| 1608 g_browser_process->browser_policy_connector(); |
| 1609 browser_policy_connector->InitializeUserPolicy(username, |
| 1610 profile->GetPath(), |
| 1611 profile->GetTokenService()); |
| 1612 } |
| 1613 #endif |
| 1614 |
1599 PrefService* user_prefs = profile->GetPrefs(); | 1615 PrefService* user_prefs = profile->GetPrefs(); |
1600 DCHECK(user_prefs); | 1616 DCHECK(user_prefs); |
1601 | 1617 |
1602 // Tests should be able to tune login manager before showing it. | 1618 // Tests should be able to tune login manager before showing it. |
1603 // Thus only show login manager in normal (non-testing) mode. | 1619 // Thus only show login manager in normal (non-testing) mode. |
1604 if (!parameters.ui_task) { | 1620 if (!parameters.ui_task) { |
1605 OptionallyRunChromeOSLoginManager(parsed_command_line); | 1621 OptionallyRunChromeOSLoginManager(parsed_command_line); |
1606 } | 1622 } |
1607 | 1623 |
1608 #if !defined(OS_MACOSX) | 1624 #if !defined(OS_MACOSX) |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 #if defined(OS_CHROMEOS) | 2014 #if defined(OS_CHROMEOS) |
1999 // To be precise, logout (browser shutdown) is not yet done, but the | 2015 // To be precise, logout (browser shutdown) is not yet done, but the |
2000 // remaining work is negligible, hence we say LogoutDone here. | 2016 // remaining work is negligible, hence we say LogoutDone here. |
2001 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2017 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
2002 false); | 2018 false); |
2003 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2019 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
2004 #endif | 2020 #endif |
2005 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2021 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
2006 return result_code; | 2022 return result_code; |
2007 } | 2023 } |
OLD | NEW |