| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "chrome/browser/chromeos/power/screen_lock_observer.h" | 60 #include "chrome/browser/chromeos/power/screen_lock_observer.h" |
| 61 #include "chrome/browser/chromeos/power/suspend_observer.h" | 61 #include "chrome/browser/chromeos/power/suspend_observer.h" |
| 62 #include "chrome/browser/chromeos/power/user_activity_notifier.h" | 62 #include "chrome/browser/chromeos/power/user_activity_notifier.h" |
| 63 #include "chrome/browser/chromeos/power/video_activity_notifier.h" | 63 #include "chrome/browser/chromeos/power/video_activity_notifier.h" |
| 64 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 64 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 65 #include "chrome/browser/chromeos/screensaver/screensaver_controller.h" | 65 #include "chrome/browser/chromeos/screensaver/screensaver_controller.h" |
| 66 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 66 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
| 67 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 67 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 68 #include "chrome/browser/chromeos/settings/owner_key_util.h" | 68 #include "chrome/browser/chromeos/settings/owner_key_util.h" |
| 69 #include "chrome/browser/chromeos/status/data_promo_notification.h" | 69 #include "chrome/browser/chromeos/status/data_promo_notification.h" |
| 70 #include "chrome/browser/chromeos/system/statistics_provider.h" | |
| 71 #include "chrome/browser/chromeos/system_key_event_listener.h" | 70 #include "chrome/browser/chromeos/system_key_event_listener.h" |
| 72 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" | 71 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" |
| 73 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" | 72 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" |
| 74 #include "chrome/browser/defaults.h" | 73 #include "chrome/browser/defaults.h" |
| 75 #include "chrome/browser/metrics/metrics_service.h" | 74 #include "chrome/browser/metrics/metrics_service.h" |
| 76 #include "chrome/browser/net/chrome_network_delegate.h" | 75 #include "chrome/browser/net/chrome_network_delegate.h" |
| 77 #include "chrome/browser/policy/browser_policy_connector.h" | 76 #include "chrome/browser/policy/browser_policy_connector.h" |
| 78 #include "chrome/browser/profiles/profile.h" | 77 #include "chrome/browser/profiles/profile.h" |
| 79 #include "chrome/browser/profiles/profile_manager.h" | 78 #include "chrome/browser/profiles/profile_manager.h" |
| 80 #include "chrome/browser/rlz/rlz.h" | 79 #include "chrome/browser/rlz/rlz.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 93 #include "chromeos/dbus/dbus_thread_manager.h" | 92 #include "chromeos/dbus/dbus_thread_manager.h" |
| 94 #include "chromeos/dbus/power_policy_controller.h" | 93 #include "chromeos/dbus/power_policy_controller.h" |
| 95 #include "chromeos/dbus/session_manager_client.h" | 94 #include "chromeos/dbus/session_manager_client.h" |
| 96 #include "chromeos/disks/disk_mount_manager.h" | 95 #include "chromeos/disks/disk_mount_manager.h" |
| 97 #include "chromeos/ime/input_method_manager.h" | 96 #include "chromeos/ime/input_method_manager.h" |
| 98 #include "chromeos/ime/xkeyboard.h" | 97 #include "chromeos/ime/xkeyboard.h" |
| 99 #include "chromeos/login/login_state.h" | 98 #include "chromeos/login/login_state.h" |
| 100 #include "chromeos/network/network_change_notifier_chromeos.h" | 99 #include "chromeos/network/network_change_notifier_chromeos.h" |
| 101 #include "chromeos/network/network_change_notifier_factory_chromeos.h" | 100 #include "chromeos/network/network_change_notifier_factory_chromeos.h" |
| 102 #include "chromeos/network/network_handler.h" | 101 #include "chromeos/network/network_handler.h" |
| 102 #include "chromeos/system/statistics_provider.h" |
| 103 #include "content/public/browser/browser_thread.h" | 103 #include "content/public/browser/browser_thread.h" |
| 104 #include "content/public/browser/notification_service.h" | 104 #include "content/public/browser/notification_service.h" |
| 105 #include "content/public/browser/power_save_blocker.h" | 105 #include "content/public/browser/power_save_blocker.h" |
| 106 #include "content/public/common/main_function_params.h" | 106 #include "content/public/common/main_function_params.h" |
| 107 #include "grit/platform_locale_settings.h" | 107 #include "grit/platform_locale_settings.h" |
| 108 #include "net/base/network_change_notifier.h" | 108 #include "net/base/network_change_notifier.h" |
| 109 #include "net/url_request/url_request.h" | 109 #include "net/url_request/url_request.h" |
| 110 #include "net/url_request/url_request_context_getter.h" | 110 #include "net/url_request/url_request_context_getter.h" |
| 111 | 111 |
| 112 // Exclude X11 dependents for ozone | 112 // Exclude X11 dependents for ozone |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, | 379 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, |
| 380 chrome::kTestUserProfileDir); | 380 chrome::kTestUserProfileDir); |
| 381 } | 381 } |
| 382 LOG(INFO) << "Running as stub user with profile dir: " | 382 LOG(INFO) << "Running as stub user with profile dir: " |
| 383 << singleton_command_line->GetSwitchValuePath( | 383 << singleton_command_line->GetSwitchValuePath( |
| 384 switches::kLoginProfile).value(); | 384 switches::kLoginProfile).value(); |
| 385 } | 385 } |
| 386 | 386 |
| 387 // Initialize the statistics provider, which will ensure that the Chrome | 387 // Initialize the statistics provider, which will ensure that the Chrome |
| 388 // channel info is read and made available early. | 388 // channel info is read and made available early. |
| 389 system::StatisticsProvider::GetInstance()->Init(); | 389 system::StatisticsProvider::Initialize( |
| 390 content::BrowserThread::GetMessageLoopProxyForThread( |
| 391 content::BrowserThread::FILE)); |
| 390 | 392 |
| 391 #if defined(GOOGLE_CHROME_BUILD) | 393 #if defined(GOOGLE_CHROME_BUILD) |
| 392 const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK"; | 394 const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK"; |
| 393 std::string channel; | 395 std::string channel; |
| 394 if (base::SysInfo::GetLsbReleaseValue(kChromeOSReleaseTrack, &channel)) | 396 if (base::SysInfo::GetLsbReleaseValue(kChromeOSReleaseTrack, &channel)) |
| 395 chrome::VersionInfo::SetChannel(channel); | 397 chrome::VersionInfo::SetChannel(channel); |
| 396 #endif | 398 #endif |
| 397 | 399 |
| 398 ChromeBrowserMainPartsLinux::PreEarlyInitialization(); | 400 ChromeBrowserMainPartsLinux::PreEarlyInitialization(); |
| 399 } | 401 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 420 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. | 422 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. |
| 421 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 423 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
| 422 // Set the crypto thread after the IO thread has been created/started. | 424 // Set the crypto thread after the IO thread has been created/started. |
| 423 CertLoader::Get()->SetCryptoTaskRunner( | 425 CertLoader::Get()->SetCryptoTaskRunner( |
| 424 content::BrowserThread::GetMessageLoopProxyForThread( | 426 content::BrowserThread::GetMessageLoopProxyForThread( |
| 425 content::BrowserThread::IO)); | 427 content::BrowserThread::IO)); |
| 426 | 428 |
| 427 CrasAudioHandler::Initialize( | 429 CrasAudioHandler::Initialize( |
| 428 AudioDevicesPrefHandler::Create(g_browser_process->local_state())); | 430 AudioDevicesPrefHandler::Create(g_browser_process->local_state())); |
| 429 | 431 |
| 430 if (!StartupUtils::IsOobeCompleted()) | 432 // Start loading machine statistics here. StatisticsProvider::Shutdown() |
| 431 system::StatisticsProvider::GetInstance()->LoadOemManifest(); | 433 // will ensure that loading is aborted on early exit. |
| 434 bool load_oem_statistics = !StartupUtils::IsOobeCompleted(); |
| 435 system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics( |
| 436 load_oem_statistics); |
| 432 | 437 |
| 433 base::FilePath downloads_directory; | 438 base::FilePath downloads_directory; |
| 434 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); | 439 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); |
| 435 imageburner::BurnManager::Initialize( | 440 imageburner::BurnManager::Initialize( |
| 436 downloads_directory, g_browser_process->system_request_context()); | 441 downloads_directory, g_browser_process->system_request_context()); |
| 437 | 442 |
| 438 // Listen for system key events so that the user will be able to adjust the | 443 // Listen for system key events so that the user will be able to adjust the |
| 439 // volume on the login screen, if Chrome is running on Chrome OS | 444 // volume on the login screen, if Chrome is running on Chrome OS |
| 440 // (i.e. not Linux desktop), and in non-test mode. | 445 // (i.e. not Linux desktop), and in non-test mode. |
| 441 // Note: SystemKeyEventListener depends on the DBus thread. | 446 // Note: SystemKeyEventListener depends on the DBus thread. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 content::Details<Profile>(profile())); | 578 content::Details<Profile>(profile())); |
| 574 UserManager::Get()->SessionStarted(); | 579 UserManager::Get()->SessionStarted(); |
| 575 | 580 |
| 576 // Now is the good time to retrieve other logged in users for this session. | 581 // Now is the good time to retrieve other logged in users for this session. |
| 577 // First user has been already marked as logged in and active in | 582 // First user has been already marked as logged in and active in |
| 578 // PreProfileInit(). Chrome should tread other user in a session as active | 583 // PreProfileInit(). Chrome should tread other user in a session as active |
| 579 // in the background. | 584 // in the background. |
| 580 UserManager::Get()->RestoreActiveSessions(); | 585 UserManager::Get()->RestoreActiveSessions(); |
| 581 } | 586 } |
| 582 | 587 |
| 583 // Start loading the machine statistics. Note: if we start loading machine | |
| 584 // statistics early in PreEarlyInitialization() then the crossystem tool | |
| 585 // sometimes hangs for unknown reasons, see http://crbug.com/167671. | |
| 586 // Also we must start loading no later than this point, because login manager | |
| 587 // may call GetMachineStatistic() during startup, see crbug.com/170635. | |
| 588 system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics(); | |
| 589 | |
| 590 // Tests should be able to tune login manager before showing it. | 588 // Tests should be able to tune login manager before showing it. |
| 591 // Thus only show login manager in normal (non-testing) mode. | 589 // Thus only show login manager in normal (non-testing) mode. |
| 592 if (!parameters().ui_task || | 590 if (!parameters().ui_task || |
| 593 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) { | 591 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) { |
| 594 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); | 592 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); |
| 595 } | 593 } |
| 596 | 594 |
| 597 // These observers must be initialized after the profile because | 595 // These observers must be initialized after the profile because |
| 598 // they use the profile to dispatch extension events. | 596 // they use the profile to dispatch extension events. |
| 599 // | 597 // |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 // Detach D-Bus clients before DBusThreadManager is shut down. | 746 // Detach D-Bus clients before DBusThreadManager is shut down. |
| 749 power_button_observer_.reset(); | 747 power_button_observer_.reset(); |
| 750 screensaver_controller_.reset(); | 748 screensaver_controller_.reset(); |
| 751 idle_action_warning_observer_.reset(); | 749 idle_action_warning_observer_.reset(); |
| 752 | 750 |
| 753 // Delete ContactManager while |g_browser_process| is still alive. | 751 // Delete ContactManager while |g_browser_process| is still alive. |
| 754 contact_manager_.reset(); | 752 contact_manager_.reset(); |
| 755 | 753 |
| 756 MagnificationManager::Shutdown(); | 754 MagnificationManager::Shutdown(); |
| 757 AccessibilityManager::Shutdown(); | 755 AccessibilityManager::Shutdown(); |
| 756 system::StatisticsProvider::Shutdown(); |
| 758 | 757 |
| 759 // Let the UserManager and WallpaperManager unregister itself as an observer | 758 // Let the UserManager and WallpaperManager unregister itself as an observer |
| 760 // of the CrosSettings singleton before it is destroyed. This also ensures | 759 // of the CrosSettings singleton before it is destroyed. This also ensures |
| 761 // that the UserManager has no URLRequest pending (see | 760 // that the UserManager has no URLRequest pending (see |
| 762 // http://crbug.com/276659). | 761 // http://crbug.com/276659). |
| 763 UserManager::Get()->Shutdown(); | 762 UserManager::Get()->Shutdown(); |
| 764 WallpaperManager::Get()->Shutdown(); | 763 WallpaperManager::Get()->Shutdown(); |
| 765 | 764 |
| 766 // Let the AutomaticRebootManager unregister itself as an observer of several | 765 // Let the AutomaticRebootManager unregister itself as an observer of several |
| 767 // subsystems. | 766 // subsystems. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 788 | 787 |
| 789 // Destroy DeviceSettingsService after g_browser_process. | 788 // Destroy DeviceSettingsService after g_browser_process. |
| 790 DeviceSettingsService::Shutdown(); | 789 DeviceSettingsService::Shutdown(); |
| 791 } | 790 } |
| 792 | 791 |
| 793 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { | 792 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { |
| 794 default_pinned_apps_field_trial::SetupTrial(); | 793 default_pinned_apps_field_trial::SetupTrial(); |
| 795 } | 794 } |
| 796 | 795 |
| 797 } // namespace chromeos | 796 } // namespace chromeos |
| OLD | NEW |