Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 25112004: Move statistics_provider to chromeos/system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, fix DeviceManagement Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "chrome/browser/chromeos/power/resume_observer.h" 59 #include "chrome/browser/chromeos/power/resume_observer.h"
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/system/statistics_provider.h"
70 #include "chrome/browser/chromeos/system_key_event_listener.h" 69 #include "chrome/browser/chromeos/system_key_event_listener.h"
71 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" 70 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h"
72 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" 71 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h"
73 #include "chrome/browser/defaults.h" 72 #include "chrome/browser/defaults.h"
74 #include "chrome/browser/metrics/metrics_service.h" 73 #include "chrome/browser/metrics/metrics_service.h"
75 #include "chrome/browser/net/chrome_network_delegate.h" 74 #include "chrome/browser/net/chrome_network_delegate.h"
76 #include "chrome/browser/policy/browser_policy_connector.h" 75 #include "chrome/browser/policy/browser_policy_connector.h"
77 #include "chrome/browser/profiles/profile.h" 76 #include "chrome/browser/profiles/profile.h"
78 #include "chrome/browser/profiles/profile_manager.h" 77 #include "chrome/browser/profiles/profile_manager.h"
79 #include "chrome/browser/rlz/rlz.h" 78 #include "chrome/browser/rlz/rlz.h"
(...skipping 12 matching lines...) Expand all
92 #include "chromeos/dbus/dbus_thread_manager.h" 91 #include "chromeos/dbus/dbus_thread_manager.h"
93 #include "chromeos/dbus/power_policy_controller.h" 92 #include "chromeos/dbus/power_policy_controller.h"
94 #include "chromeos/dbus/session_manager_client.h" 93 #include "chromeos/dbus/session_manager_client.h"
95 #include "chromeos/disks/disk_mount_manager.h" 94 #include "chromeos/disks/disk_mount_manager.h"
96 #include "chromeos/ime/input_method_manager.h" 95 #include "chromeos/ime/input_method_manager.h"
97 #include "chromeos/ime/xkeyboard.h" 96 #include "chromeos/ime/xkeyboard.h"
98 #include "chromeos/login/login_state.h" 97 #include "chromeos/login/login_state.h"
99 #include "chromeos/network/network_change_notifier_chromeos.h" 98 #include "chromeos/network/network_change_notifier_chromeos.h"
100 #include "chromeos/network/network_change_notifier_factory_chromeos.h" 99 #include "chromeos/network/network_change_notifier_factory_chromeos.h"
101 #include "chromeos/network/network_handler.h" 100 #include "chromeos/network/network_handler.h"
101 #include "chromeos/system/statistics_provider.h"
102 #include "content/public/browser/browser_thread.h" 102 #include "content/public/browser/browser_thread.h"
103 #include "content/public/browser/notification_service.h" 103 #include "content/public/browser/notification_service.h"
104 #include "content/public/browser/power_save_blocker.h" 104 #include "content/public/browser/power_save_blocker.h"
105 #include "content/public/common/main_function_params.h" 105 #include "content/public/common/main_function_params.h"
106 #include "grit/platform_locale_settings.h" 106 #include "grit/platform_locale_settings.h"
107 #include "net/base/network_change_notifier.h" 107 #include "net/base/network_change_notifier.h"
108 #include "net/url_request/url_request.h" 108 #include "net/url_request/url_request.h"
109 #include "net/url_request/url_request_context_getter.h" 109 #include "net/url_request/url_request_context_getter.h"
110 110
111 // Exclude X11 dependents for ozone 111 // Exclude X11 dependents for ozone
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, 378 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile,
379 chrome::kTestUserProfileDir); 379 chrome::kTestUserProfileDir);
380 } 380 }
381 LOG(INFO) << "Running as stub user with profile dir: " 381 LOG(INFO) << "Running as stub user with profile dir: "
382 << singleton_command_line->GetSwitchValuePath( 382 << singleton_command_line->GetSwitchValuePath(
383 switches::kLoginProfile).value(); 383 switches::kLoginProfile).value();
384 } 384 }
385 385
386 // Initialize the statistics provider, which will ensure that the Chrome 386 // Initialize the statistics provider, which will ensure that the Chrome
387 // channel info is read and made available early. 387 // channel info is read and made available early.
388 system::StatisticsProvider::GetInstance()->Init(); 388 system::StatisticsProvider::Initialize(
389 content::BrowserThread::GetMessageLoopProxyForThread(
390 content::BrowserThread::IO));
satorux1 2013/10/02 01:36:55 Did you mean FILE? IO is not for file IO.
stevenjb 2013/10/03 01:17:23 Yes, thanks. That still gets me every time. Done.
389 391
390 #if defined(GOOGLE_CHROME_BUILD) 392 #if defined(GOOGLE_CHROME_BUILD)
391 const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK"; 393 const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK";
392 std::string channel; 394 std::string channel;
393 if (base::SysInfo::GetLsbReleaseValue(kChromeOSReleaseTrack, &channel)) 395 if (base::SysInfo::GetLsbReleaseValue(kChromeOSReleaseTrack, &channel))
394 chrome::VersionInfo::SetChannel(channel); 396 chrome::VersionInfo::SetChannel(channel);
395 #endif 397 #endif
396 398
397 ChromeBrowserMainPartsLinux::PreEarlyInitialization(); 399 ChromeBrowserMainPartsLinux::PreEarlyInitialization();
398 } 400 }
(...skipping 20 matching lines...) Expand all
419 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. 421 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads.
420 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { 422 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() {
421 // Set the crypto thread after the IO thread has been created/started. 423 // Set the crypto thread after the IO thread has been created/started.
422 CertLoader::Get()->SetCryptoTaskRunner( 424 CertLoader::Get()->SetCryptoTaskRunner(
423 content::BrowserThread::GetMessageLoopProxyForThread( 425 content::BrowserThread::GetMessageLoopProxyForThread(
424 content::BrowserThread::IO)); 426 content::BrowserThread::IO));
425 427
426 CrasAudioHandler::Initialize( 428 CrasAudioHandler::Initialize(
427 AudioDevicesPrefHandler::Create(g_browser_process->local_state())); 429 AudioDevicesPrefHandler::Create(g_browser_process->local_state()));
428 430
429 if (!StartupUtils::IsOobeCompleted()) 431 // Start loading machine statistics here. StatisticsProvider::Shutdown()
430 system::StatisticsProvider::GetInstance()->LoadOemManifest(); 432 // will ensure that loading is aborted on early exit.
433 bool load_oem_statistics = !StartupUtils::IsOobeCompleted();
434 system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics(
435 load_oem_statistics);
431 436
432 base::FilePath downloads_directory; 437 base::FilePath downloads_directory;
433 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); 438 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory));
434 imageburner::BurnManager::Initialize( 439 imageburner::BurnManager::Initialize(
435 downloads_directory, g_browser_process->system_request_context()); 440 downloads_directory, g_browser_process->system_request_context());
436 441
437 // Listen for system key events so that the user will be able to adjust the 442 // Listen for system key events so that the user will be able to adjust the
438 // volume on the login screen, if Chrome is running on Chrome OS 443 // volume on the login screen, if Chrome is running on Chrome OS
439 // (i.e. not Linux desktop), and in non-test mode. 444 // (i.e. not Linux desktop), and in non-test mode.
440 // Note: SystemKeyEventListener depends on the DBus thread. 445 // Note: SystemKeyEventListener depends on the DBus thread.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 content::Details<Profile>(profile())); 577 content::Details<Profile>(profile()));
573 UserManager::Get()->SessionStarted(); 578 UserManager::Get()->SessionStarted();
574 579
575 // Now is the good time to retrieve other logged in users for this session. 580 // Now is the good time to retrieve other logged in users for this session.
576 // First user has been already marked as logged in and active in 581 // First user has been already marked as logged in and active in
577 // PreProfileInit(). Chrome should tread other user in a session as active 582 // PreProfileInit(). Chrome should tread other user in a session as active
578 // in the background. 583 // in the background.
579 UserManager::Get()->RestoreActiveSessions(); 584 UserManager::Get()->RestoreActiveSessions();
580 } 585 }
581 586
582 // Start loading the machine statistics. Note: if we start loading machine
583 // statistics early in PreEarlyInitialization() then the crossystem tool
584 // sometimes hangs for unknown reasons, see http://crbug.com/167671.
585 // Also we must start loading no later than this point, because login manager
586 // may call GetMachineStatistic() during startup, see crbug.com/170635.
587 system::StatisticsProvider::GetInstance()->StartLoadingMachineStatistics();
588
589 // Tests should be able to tune login manager before showing it. 587 // Tests should be able to tune login manager before showing it.
590 // Thus only show login manager in normal (non-testing) mode. 588 // Thus only show login manager in normal (non-testing) mode.
591 if (!parameters().ui_task || 589 if (!parameters().ui_task ||
592 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) { 590 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) {
593 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); 591 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile());
594 } 592 }
595 593
596 // These observers must be initialized after the profile because 594 // These observers must be initialized after the profile because
597 // they use the profile to dispatch extension events. 595 // they use the profile to dispatch extension events.
598 // 596 //
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 // Detach D-Bus clients before DBusThreadManager is shut down. 740 // Detach D-Bus clients before DBusThreadManager is shut down.
743 power_button_observer_.reset(); 741 power_button_observer_.reset();
744 screensaver_controller_.reset(); 742 screensaver_controller_.reset();
745 idle_action_warning_observer_.reset(); 743 idle_action_warning_observer_.reset();
746 744
747 // Delete ContactManager while |g_browser_process| is still alive. 745 // Delete ContactManager while |g_browser_process| is still alive.
748 contact_manager_.reset(); 746 contact_manager_.reset();
749 747
750 MagnificationManager::Shutdown(); 748 MagnificationManager::Shutdown();
751 AccessibilityManager::Shutdown(); 749 AccessibilityManager::Shutdown();
750 system::StatisticsProvider::Shutdown();
752 751
753 // Let the UserManager and WallpaperManager unregister itself as an observer 752 // Let the UserManager and WallpaperManager unregister itself as an observer
754 // of the CrosSettings singleton before it is destroyed. This also ensures 753 // of the CrosSettings singleton before it is destroyed. This also ensures
755 // that the UserManager has no URLRequest pending (see 754 // that the UserManager has no URLRequest pending (see
756 // http://crbug.com/276659). 755 // http://crbug.com/276659).
757 UserManager::Get()->Shutdown(); 756 UserManager::Get()->Shutdown();
758 WallpaperManager::Get()->Shutdown(); 757 WallpaperManager::Get()->Shutdown();
759 758
760 // Let the AutomaticRebootManager unregister itself as an observer of several 759 // Let the AutomaticRebootManager unregister itself as an observer of several
761 // subsystems. 760 // subsystems.
(...skipping 20 matching lines...) Expand all
782 781
783 // Destroy DeviceSettingsService after g_browser_process. 782 // Destroy DeviceSettingsService after g_browser_process.
784 DeviceSettingsService::Shutdown(); 783 DeviceSettingsService::Shutdown();
785 } 784 }
786 785
787 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { 786 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() {
788 default_pinned_apps_field_trial::SetupTrial(); 787 default_pinned_apps_field_trial::SetupTrial();
789 } 788 }
790 789
791 } // namespace chromeos 790 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698