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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 switches::kLoginUser, UserManager::kStubUser); | 377 switches::kLoginUser, UserManager::kStubUser); |
378 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { | 378 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { |
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 | |
388 // channel info is read and made available early. | |
389 system::StatisticsProvider::GetInstance()->Init(); | |
390 | |
391 #if defined(GOOGLE_CHROME_BUILD) | 387 #if defined(GOOGLE_CHROME_BUILD) |
392 const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK"; | 388 const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK"; |
393 std::string channel; | 389 std::string channel; |
394 if (base::SysInfo::GetLsbReleaseValue(kChromeOSReleaseTrack, &channel)) | 390 if (base::SysInfo::GetLsbReleaseValue(kChromeOSReleaseTrack, &channel)) |
395 chrome::VersionInfo::SetChannel(channel); | 391 chrome::VersionInfo::SetChannel(channel); |
396 #endif | 392 #endif |
397 | 393 |
398 ChromeBrowserMainPartsLinux::PreEarlyInitialization(); | 394 ChromeBrowserMainPartsLinux::PreEarlyInitialization(); |
399 } | 395 } |
400 | 396 |
(...skipping 19 matching lines...) Expand all Loading... |
420 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. | 416 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. |
421 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 417 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
422 // Set the crypto thread after the IO thread has been created/started. | 418 // Set the crypto thread after the IO thread has been created/started. |
423 CertLoader::Get()->SetCryptoTaskRunner( | 419 CertLoader::Get()->SetCryptoTaskRunner( |
424 content::BrowserThread::GetMessageLoopProxyForThread( | 420 content::BrowserThread::GetMessageLoopProxyForThread( |
425 content::BrowserThread::IO)); | 421 content::BrowserThread::IO)); |
426 | 422 |
427 CrasAudioHandler::Initialize( | 423 CrasAudioHandler::Initialize( |
428 AudioDevicesPrefHandler::Create(g_browser_process->local_state())); | 424 AudioDevicesPrefHandler::Create(g_browser_process->local_state())); |
429 | 425 |
430 if (!StartupUtils::IsOobeCompleted()) | 426 // Start loading machine statistics here. StatisticsProvider::Shutdown() |
431 system::StatisticsProvider::GetInstance()->LoadOemManifest(); | 427 // will ensure that loading is aborted on early exit. |
| 428 bool load_oem_statistics = !StartupUtils::IsOobeCompleted(); |
| 429 system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics( |
| 430 content::BrowserThread::GetMessageLoopProxyForThread( |
| 431 content::BrowserThread::FILE), |
| 432 load_oem_statistics); |
432 | 433 |
433 base::FilePath downloads_directory; | 434 base::FilePath downloads_directory; |
434 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); | 435 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); |
435 imageburner::BurnManager::Initialize( | 436 imageburner::BurnManager::Initialize( |
436 downloads_directory, g_browser_process->system_request_context()); | 437 downloads_directory, g_browser_process->system_request_context()); |
437 | 438 |
438 // Listen for system key events so that the user will be able to adjust the | 439 // 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 | 440 // volume on the login screen, if Chrome is running on Chrome OS |
440 // (i.e. not Linux desktop), and in non-test mode. | 441 // (i.e. not Linux desktop), and in non-test mode. |
441 // Note: SystemKeyEventListener depends on the DBus thread. | 442 // 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())); | 574 content::Details<Profile>(profile())); |
574 UserManager::Get()->SessionStarted(); | 575 UserManager::Get()->SessionStarted(); |
575 | 576 |
576 // Now is the good time to retrieve other logged in users for this session. | 577 // 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 | 578 // First user has been already marked as logged in and active in |
578 // PreProfileInit(). Chrome should tread other user in a session as active | 579 // PreProfileInit(). Chrome should tread other user in a session as active |
579 // in the background. | 580 // in the background. |
580 UserManager::Get()->RestoreActiveSessions(); | 581 UserManager::Get()->RestoreActiveSessions(); |
581 } | 582 } |
582 | 583 |
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. | 584 // Tests should be able to tune login manager before showing it. |
591 // Thus only show login manager in normal (non-testing) mode. | 585 // Thus only show login manager in normal (non-testing) mode. |
592 if (!parameters().ui_task || | 586 if (!parameters().ui_task || |
593 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) { | 587 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) { |
594 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); | 588 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); |
595 } | 589 } |
596 | 590 |
597 // These observers must be initialized after the profile because | 591 // These observers must be initialized after the profile because |
598 // they use the profile to dispatch extension events. | 592 // they use the profile to dispatch extension events. |
599 // | 593 // |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 // Detach D-Bus clients before DBusThreadManager is shut down. | 742 // Detach D-Bus clients before DBusThreadManager is shut down. |
749 power_button_observer_.reset(); | 743 power_button_observer_.reset(); |
750 screensaver_controller_.reset(); | 744 screensaver_controller_.reset(); |
751 idle_action_warning_observer_.reset(); | 745 idle_action_warning_observer_.reset(); |
752 | 746 |
753 // Delete ContactManager while |g_browser_process| is still alive. | 747 // Delete ContactManager while |g_browser_process| is still alive. |
754 contact_manager_.reset(); | 748 contact_manager_.reset(); |
755 | 749 |
756 MagnificationManager::Shutdown(); | 750 MagnificationManager::Shutdown(); |
757 AccessibilityManager::Shutdown(); | 751 AccessibilityManager::Shutdown(); |
| 752 system::StatisticsProvider::GetInstance()->Shutdown(); |
758 | 753 |
759 // Let the UserManager and WallpaperManager unregister itself as an observer | 754 // Let the UserManager and WallpaperManager unregister itself as an observer |
760 // of the CrosSettings singleton before it is destroyed. This also ensures | 755 // of the CrosSettings singleton before it is destroyed. This also ensures |
761 // that the UserManager has no URLRequest pending (see | 756 // that the UserManager has no URLRequest pending (see |
762 // http://crbug.com/276659). | 757 // http://crbug.com/276659). |
763 UserManager::Get()->Shutdown(); | 758 UserManager::Get()->Shutdown(); |
764 WallpaperManager::Get()->Shutdown(); | 759 WallpaperManager::Get()->Shutdown(); |
765 | 760 |
766 // Let the AutomaticRebootManager unregister itself as an observer of several | 761 // Let the AutomaticRebootManager unregister itself as an observer of several |
767 // subsystems. | 762 // subsystems. |
(...skipping 20 matching lines...) Expand all Loading... |
788 | 783 |
789 // Destroy DeviceSettingsService after g_browser_process. | 784 // Destroy DeviceSettingsService after g_browser_process. |
790 DeviceSettingsService::Shutdown(); | 785 DeviceSettingsService::Shutdown(); |
791 } | 786 } |
792 | 787 |
793 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { | 788 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { |
794 default_pinned_apps_field_trial::SetupTrial(); | 789 default_pinned_apps_field_trial::SetupTrial(); |
795 } | 790 } |
796 | 791 |
797 } // namespace chromeos | 792 } // namespace chromeos |
OLD | NEW |