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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 logging::RedirectChromeLogging(parsed_command_line); | 1576 logging::RedirectChromeLogging(parsed_command_line); |
1576 } | 1577 } |
1577 #endif | 1578 #endif |
1578 | 1579 |
1579 Profile* profile = CreateProfile(parameters, user_data_dir); | 1580 Profile* profile = CreateProfile(parameters, user_data_dir); |
1580 if (!profile) | 1581 if (!profile) |
1581 return ResultCodes::NORMAL_EXIT; | 1582 return ResultCodes::NORMAL_EXIT; |
1582 | 1583 |
1583 // Post-profile init --------------------------------------------------------- | 1584 // Post-profile init --------------------------------------------------------- |
1584 | 1585 |
| 1586 #if defined(OS_CHROMEOS) |
| 1587 // Handling the user cloud policy initialization for case 2 mentioned above. |
| 1588 // We do this after the profile creation since we need the TokenService. |
| 1589 if (parsed_command_line.HasSwitch(switches::kLoginUser) && |
| 1590 !parsed_command_line.HasSwitch(switches::kLoginPassword)) { |
| 1591 std::string username = |
| 1592 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); |
| 1593 policy::BrowserPolicyConnector* browser_policy_connector = |
| 1594 g_browser_process->browser_policy_connector(); |
| 1595 browser_policy_connector->InitializeUserPolicy(username, |
| 1596 profile->GetPath(), |
| 1597 profile->GetTokenService()); |
| 1598 } |
| 1599 #endif |
| 1600 |
1585 PrefService* user_prefs = profile->GetPrefs(); | 1601 PrefService* user_prefs = profile->GetPrefs(); |
1586 DCHECK(user_prefs); | 1602 DCHECK(user_prefs); |
1587 | 1603 |
1588 // Tests should be able to tune login manager before showing it. | 1604 // Tests should be able to tune login manager before showing it. |
1589 // Thus only show login manager in normal (non-testing) mode. | 1605 // Thus only show login manager in normal (non-testing) mode. |
1590 if (!parameters.ui_task) { | 1606 if (!parameters.ui_task) { |
1591 OptionallyRunChromeOSLoginManager(parsed_command_line); | 1607 OptionallyRunChromeOSLoginManager(parsed_command_line); |
1592 } | 1608 } |
1593 | 1609 |
1594 #if !defined(OS_MACOSX) | 1610 #if !defined(OS_MACOSX) |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 #if defined(OS_CHROMEOS) | 1986 #if defined(OS_CHROMEOS) |
1971 // To be precise, logout (browser shutdown) is not yet done, but the | 1987 // To be precise, logout (browser shutdown) is not yet done, but the |
1972 // remaining work is negligible, hence we say LogoutDone here. | 1988 // remaining work is negligible, hence we say LogoutDone here. |
1973 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1989 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
1974 false); | 1990 false); |
1975 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1991 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
1976 #endif | 1992 #endif |
1977 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 1993 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
1978 return result_code; | 1994 return result_code; |
1979 } | 1995 } |
OLD | NEW |