| 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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 // Checking that the local state file for the current profile doesn't exist | 788 // Checking that the local state file for the current profile doesn't exist |
| 788 // is the most robust way to determine whether we need to inherit or not | 789 // is the most robust way to determine whether we need to inherit or not |
| 789 // since the parent profile command line flag can be present even when the | 790 // since the parent profile command line flag can be present even when the |
| 790 // current profile is not a new one, and in that case we do not want to | 791 // current profile is not a new one, and in that case we do not want to |
| 791 // inherit and reset the user's setting. | 792 // inherit and reset the user's setting. |
| 792 if (!local_state_file_exists && | 793 if (!local_state_file_exists && |
| 793 parsed_command_line.HasSwitch(switches::kParentProfile)) { | 794 parsed_command_line.HasSwitch(switches::kParentProfile)) { |
| 794 FilePath parent_profile = | 795 FilePath parent_profile = |
| 795 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); | 796 parsed_command_line.GetSwitchValuePath(switches::kParentProfile); |
| 796 scoped_ptr<PrefService> parent_local_state( | 797 scoped_ptr<PrefService> parent_local_state( |
| 797 PrefService::CreatePrefService(parent_profile, NULL, NULL, false)); | 798 PrefService::CreatePrefService(parent_profile, NULL, false)); |
| 798 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, | 799 parent_local_state->RegisterStringPref(prefs::kApplicationLocale, |
| 799 std::string()); | 800 std::string()); |
| 800 // Right now, we only inherit the locale setting from the parent profile. | 801 // Right now, we only inherit the locale setting from the parent profile. |
| 801 local_state->SetString( | 802 local_state->SetString( |
| 802 prefs::kApplicationLocale, | 803 prefs::kApplicationLocale, |
| 803 parent_local_state->GetString(prefs::kApplicationLocale)); | 804 parent_local_state->GetString(prefs::kApplicationLocale)); |
| 804 } | 805 } |
| 805 | 806 |
| 806 #if defined(OS_CHROMEOS) | 807 #if defined(OS_CHROMEOS) |
| 807 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { | 808 if (parsed_command_line.HasSwitch(switches::kLoginManager)) { |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 logging::RedirectChromeLogging(parsed_command_line); | 1571 logging::RedirectChromeLogging(parsed_command_line); |
| 1571 } | 1572 } |
| 1572 #endif | 1573 #endif |
| 1573 | 1574 |
| 1574 Profile* profile = CreateProfile(parameters, user_data_dir); | 1575 Profile* profile = CreateProfile(parameters, user_data_dir); |
| 1575 if (!profile) | 1576 if (!profile) |
| 1576 return ResultCodes::NORMAL_EXIT; | 1577 return ResultCodes::NORMAL_EXIT; |
| 1577 | 1578 |
| 1578 // Post-profile init --------------------------------------------------------- | 1579 // Post-profile init --------------------------------------------------------- |
| 1579 | 1580 |
| 1581 #if defined(OS_CHROMEOS) |
| 1582 // Handling the user cloud policy initialization for case 2 mentioned above. |
| 1583 // We do this after the profile creation since we need the TokenService. |
| 1584 if (parsed_command_line.HasSwitch(switches::kLoginUser) && |
| 1585 !parsed_command_line.HasSwitch(switches::kLoginPassword)) { |
| 1586 std::string username = |
| 1587 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); |
| 1588 policy::BrowserPolicyConnector* browser_policy_connector = |
| 1589 g_browser_process->browser_policy_connector(); |
| 1590 browser_policy_connector->InitializeUserPolicy(username, |
| 1591 profile->GetPath(), |
| 1592 profile->GetTokenService()); |
| 1593 } |
| 1594 #endif |
| 1595 |
| 1580 PrefService* user_prefs = profile->GetPrefs(); | 1596 PrefService* user_prefs = profile->GetPrefs(); |
| 1581 DCHECK(user_prefs); | 1597 DCHECK(user_prefs); |
| 1582 | 1598 |
| 1583 // Tests should be able to tune login manager before showing it. | 1599 // Tests should be able to tune login manager before showing it. |
| 1584 // Thus only show login manager in normal (non-testing) mode. | 1600 // Thus only show login manager in normal (non-testing) mode. |
| 1585 if (!parameters.ui_task) { | 1601 if (!parameters.ui_task) { |
| 1586 OptionallyRunChromeOSLoginManager(parsed_command_line); | 1602 OptionallyRunChromeOSLoginManager(parsed_command_line); |
| 1587 } | 1603 } |
| 1588 | 1604 |
| 1589 #if !defined(OS_MACOSX) | 1605 #if !defined(OS_MACOSX) |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 #if defined(OS_CHROMEOS) | 2001 #if defined(OS_CHROMEOS) |
| 1986 // To be precise, logout (browser shutdown) is not yet done, but the | 2002 // To be precise, logout (browser shutdown) is not yet done, but the |
| 1987 // remaining work is negligible, hence we say LogoutDone here. | 2003 // remaining work is negligible, hence we say LogoutDone here. |
| 1988 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2004 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 1989 false); | 2005 false); |
| 1990 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2006 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 1991 #endif | 2007 #endif |
| 1992 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2008 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
| 1993 return result_code; | 2009 return result_code; |
| 1994 } | 2010 } |
| OLD | NEW |