| 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/chromeos/chrome_browser_main_chromeos.h" | 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "chrome/browser/chromeos/settings/owner_key_util.h" | 55 #include "chrome/browser/chromeos/settings/owner_key_util.h" |
| 56 #include "chrome/browser/chromeos/system/statistics_provider.h" | 56 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 57 #include "chrome/browser/chromeos/system_key_event_listener.h" | 57 #include "chrome/browser/chromeos/system_key_event_listener.h" |
| 58 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" | 58 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" |
| 59 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" | 59 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" |
| 60 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" | 60 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" |
| 61 #include "chrome/browser/defaults.h" | 61 #include "chrome/browser/defaults.h" |
| 62 #include "chrome/browser/metrics/metrics_service.h" | 62 #include "chrome/browser/metrics/metrics_service.h" |
| 63 #include "chrome/browser/net/chrome_network_delegate.h" | 63 #include "chrome/browser/net/chrome_network_delegate.h" |
| 64 #include "chrome/browser/policy/browser_policy_connector.h" | 64 #include "chrome/browser/policy/browser_policy_connector.h" |
| 65 #include "chrome/browser/policy/network_configuration_updater.h" | |
| 66 #include "chrome/browser/prefs/pref_service.h" | 65 #include "chrome/browser/prefs/pref_service.h" |
| 67 #include "chrome/browser/profiles/profile.h" | 66 #include "chrome/browser/profiles/profile.h" |
| 68 #include "chrome/browser/profiles/profile_manager.h" | 67 #include "chrome/browser/profiles/profile_manager.h" |
| 69 #include "chrome/browser/signin/token_service_factory.h" | 68 #include "chrome/browser/signin/token_service_factory.h" |
| 70 #include "chrome/browser/system_monitor/media_device_notifications_chromeos.h" | 69 #include "chrome/browser/system_monitor/media_device_notifications_chromeos.h" |
| 71 #include "chrome/common/chrome_notification_types.h" | 70 #include "chrome/common/chrome_notification_types.h" |
| 72 #include "chrome/common/chrome_switches.h" | 71 #include "chrome/common/chrome_switches.h" |
| 73 #include "chrome/common/chrome_version_info.h" | 72 #include "chrome/common/chrome_version_info.h" |
| 74 #include "chrome/common/logging_chrome.h" | 73 #include "chrome/common/logging_chrome.h" |
| 75 #include "chrome/common/pref_names.h" | 74 #include "chrome/common/pref_names.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 411 } |
| 413 | 412 |
| 414 // In Aura builds this will initialize ash::Shell. | 413 // In Aura builds this will initialize ash::Shell. |
| 415 ChromeBrowserMainPartsLinux::PreProfileInit(); | 414 ChromeBrowserMainPartsLinux::PreProfileInit(); |
| 416 } | 415 } |
| 417 | 416 |
| 418 void ChromeBrowserMainPartsChromeos::PostProfileInit() { | 417 void ChromeBrowserMainPartsChromeos::PostProfileInit() { |
| 419 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 418 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 420 // -- just after CreateProfile(). | 419 // -- just after CreateProfile(). |
| 421 | 420 |
| 421 policy::BrowserPolicyConnector* connector = |
| 422 g_browser_process->browser_policy_connector(); |
| 423 |
| 422 if (parsed_command_line().HasSwitch(switches::kLoginUser) && | 424 if (parsed_command_line().HasSwitch(switches::kLoginUser) && |
| 423 !parsed_command_line().HasSwitch(switches::kLoginPassword)) { | 425 !parsed_command_line().HasSwitch(switches::kLoginPassword)) { |
| 424 // Pass the TokenService pointer to the policy connector so user policy can | 426 // Pass the TokenService pointer to the policy connector so user policy can |
| 425 // grab a token and register with the policy server. | 427 // grab a token and register with the policy server. |
| 426 // TODO(mnissler): Remove once OAuth is the only authentication mechanism. | 428 // TODO(mnissler): Remove once OAuth is the only authentication mechanism. |
| 427 g_browser_process->browser_policy_connector()->SetUserPolicyTokenService( | 429 connector->SetUserPolicyTokenService( |
| 428 TokenServiceFactory::GetForProfile(profile())); | 430 TokenServiceFactory::GetForProfile(profile())); |
| 429 | 431 |
| 430 // Make sure we flip every profile to not share proxies if the user hasn't | 432 // Make sure we flip every profile to not share proxies if the user hasn't |
| 431 // specified so explicitly. | 433 // specified so explicitly. |
| 432 const PrefService::Preference* use_shared_proxies_pref = | 434 const PrefService::Preference* use_shared_proxies_pref = |
| 433 profile()->GetPrefs()->FindPreference(prefs::kUseSharedProxies); | 435 profile()->GetPrefs()->FindPreference(prefs::kUseSharedProxies); |
| 434 if (use_shared_proxies_pref->IsDefaultValue()) | 436 if (use_shared_proxies_pref->IsDefaultValue()) |
| 435 profile()->GetPrefs()->SetBoolean(prefs::kUseSharedProxies, false); | 437 profile()->GetPrefs()->SetBoolean(prefs::kUseSharedProxies, false); |
| 436 } | 438 } |
| 437 | 439 |
| 438 network_config_updater_.reset( | 440 // Make sure the NetworkConfigurationUpdater is ready so that it pushes ONC |
| 439 new policy::NetworkConfigurationUpdater( | 441 // configuration before login. |
| 440 g_browser_process->policy_service(), | 442 connector->GetNetworkConfigurationUpdater(); |
| 441 chromeos::CrosLibrary::Get()->GetNetworkLibrary())); | |
| 442 | 443 |
| 443 // Make sure that wallpaper boot transition and other delays in OOBE | 444 // Make sure that wallpaper boot transition and other delays in OOBE |
| 444 // are disabled for tests by default. | 445 // are disabled for tests by default. |
| 445 // Individual tests may enable them if they want. | 446 // Individual tests may enable them if they want. |
| 446 if (parsed_command_line().HasSwitch(switches::kTestType)) | 447 if (parsed_command_line().HasSwitch(switches::kTestType)) |
| 447 chromeos::WizardController::SetZeroDelays(); | 448 chromeos::WizardController::SetZeroDelays(); |
| 448 | 449 |
| 449 // Tests should be able to tune login manager before showing it. | 450 // Tests should be able to tune login manager before showing it. |
| 450 // Thus only show login manager in normal (non-testing) mode. | 451 // Thus only show login manager in normal (non-testing) mode. |
| 451 if (!parameters().ui_task) | 452 if (!parameters().ui_task) |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 555 |
| 555 // Let classes unregister themselves as observers of the ash::Shell singleton | 556 // Let classes unregister themselves as observers of the ash::Shell singleton |
| 556 // before the shell is destroyed. | 557 // before the shell is destroyed. |
| 557 user_activity_notifier_.reset(); | 558 user_activity_notifier_.reset(); |
| 558 video_activity_notifier_.reset(); | 559 video_activity_notifier_.reset(); |
| 559 | 560 |
| 560 // Detach D-Bus clients before DBusThreadManager is shut down. | 561 // Detach D-Bus clients before DBusThreadManager is shut down. |
| 561 power_button_observer_.reset(); | 562 power_button_observer_.reset(); |
| 562 screen_dimming_observer_.reset(); | 563 screen_dimming_observer_.reset(); |
| 563 | 564 |
| 564 // Delete NetworkConfigurationUpdater and ContactManager while | 565 // Delete ContactManager while |g_browser_process| is still alive. |
| 565 // |g_browser_process| is still alive. | |
| 566 network_config_updater_.reset(); | |
| 567 contact_manager_.reset(); | 566 contact_manager_.reset(); |
| 568 | 567 |
| 569 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); | 568 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); |
| 570 } | 569 } |
| 571 | 570 |
| 572 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { | 571 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { |
| 573 SetupLowMemoryHeadroomFieldTrial(); | 572 SetupLowMemoryHeadroomFieldTrial(); |
| 574 } | 573 } |
| 575 | 574 |
| 576 void ChromeBrowserMainPartsChromeos::SetupLowMemoryHeadroomFieldTrial() { | 575 void ChromeBrowserMainPartsChromeos::SetupLowMemoryHeadroomFieldTrial() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 LOG(WARNING) << "low_mem: Part of '100MB' experiment"; | 610 LOG(WARNING) << "low_mem: Part of '100MB' experiment"; |
| 612 chromeos::LowMemoryObserver::SetLowMemoryMargin(100); | 611 chromeos::LowMemoryObserver::SetLowMemoryMargin(100); |
| 613 } else if (trial->group() == margin_200mb) { | 612 } else if (trial->group() == margin_200mb) { |
| 614 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; | 613 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; |
| 615 chromeos::LowMemoryObserver::SetLowMemoryMargin(200); | 614 chromeos::LowMemoryObserver::SetLowMemoryMargin(200); |
| 616 } else { | 615 } else { |
| 617 LOG(WARNING) << "low_mem: Part of 'default' experiment"; | 616 LOG(WARNING) << "low_mem: Part of 'default' experiment"; |
| 618 } | 617 } |
| 619 } | 618 } |
| 620 } | 619 } |
| OLD | NEW |