| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 namespace internal { | 207 namespace internal { |
| 208 | 208 |
| 209 // Wrapper class for initializing dbus related services and shutting them | 209 // Wrapper class for initializing dbus related services and shutting them |
| 210 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the | 210 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the |
| 211 // destructor will get called if and only if this has been instantiated. | 211 // destructor will get called if and only if this has been instantiated. |
| 212 class DBusServices { | 212 class DBusServices { |
| 213 public: | 213 public: |
| 214 explicit DBusServices(const content::MainFunctionParams& parameters) { | 214 explicit DBusServices(const content::MainFunctionParams& parameters) { |
| 215 // Under mash, some D-Bus clients are owned by other processes. | 215 // Under mash, some D-Bus clients are owned by other processes. |
| 216 DBusThreadManager::ProcessMask process_mask = | 216 DBusThreadManager::ProcessMask process_mask = |
| 217 chrome::IsRunningInMash() ? DBusThreadManager::PROCESS_BROWSER | 217 ash_util::IsRunningInMash() ? DBusThreadManager::PROCESS_BROWSER |
| 218 : DBusThreadManager::PROCESS_ALL; | 218 : DBusThreadManager::PROCESS_ALL; |
| 219 | 219 |
| 220 // Initialize DBusThreadManager for the browser. This must be done after | 220 // Initialize DBusThreadManager for the browser. This must be done after |
| 221 // the main message loop is started, as it uses the message loop. | 221 // the main message loop is started, as it uses the message loop. |
| 222 DBusThreadManager::Initialize(process_mask); | 222 DBusThreadManager::Initialize(process_mask); |
| 223 | 223 |
| 224 bluez::BluezDBusManager::Initialize( | 224 bluez::BluezDBusManager::Initialize( |
| 225 DBusThreadManager::Get()->GetSystemBus(), | 225 DBusThreadManager::Get()->GetSystemBus(), |
| 226 chromeos::DBusThreadManager::Get()->IsUsingFakes()); | 226 chromeos::DBusThreadManager::Get()->IsUsingFakes()); |
| 227 | 227 |
| 228 PowerPolicyController::Initialize( | 228 PowerPolicyController::Initialize( |
| 229 DBusThreadManager::Get()->GetPowerManagerClient()); | 229 DBusThreadManager::Get()->GetPowerManagerClient()); |
| 230 | 230 |
| 231 CrosDBusService::ServiceProviderList service_providers; | 231 CrosDBusService::ServiceProviderList service_providers; |
| 232 service_providers.push_back( | 232 service_providers.push_back( |
| 233 base::WrapUnique(ProxyResolutionServiceProvider::Create( | 233 base::WrapUnique(ProxyResolutionServiceProvider::Create( |
| 234 base::MakeUnique<ChromeProxyResolverDelegate>()))); | 234 base::MakeUnique<ChromeProxyResolverDelegate>()))); |
| 235 if (!chrome::IsRunningInMash()) { | 235 if (!ash_util::IsRunningInMash()) { |
| 236 // TODO(crbug.com/629707): revisit this with mustash dbus work. | 236 // TODO(crbug.com/629707): revisit this with mustash dbus work. |
| 237 service_providers.push_back(base::MakeUnique<DisplayPowerServiceProvider>( | 237 service_providers.push_back(base::MakeUnique<DisplayPowerServiceProvider>( |
| 238 base::MakeUnique<ChromeDisplayPowerServiceProviderDelegate>())); | 238 base::MakeUnique<ChromeDisplayPowerServiceProviderDelegate>())); |
| 239 } | 239 } |
| 240 service_providers.push_back(base::MakeUnique<LivenessServiceProvider>()); | 240 service_providers.push_back(base::MakeUnique<LivenessServiceProvider>()); |
| 241 service_providers.push_back(base::MakeUnique<ScreenLockServiceProvider>()); | 241 service_providers.push_back(base::MakeUnique<ScreenLockServiceProvider>()); |
| 242 if (chrome::IsRunningInMash()) { | 242 if (ash_util::IsRunningInMash()) { |
| 243 service_providers.push_back(base::MakeUnique<ConsoleServiceProvider>( | 243 service_providers.push_back(base::MakeUnique<ConsoleServiceProvider>( |
| 244 base::MakeUnique<MusConsoleServiceProviderDelegate>())); | 244 base::MakeUnique<MusConsoleServiceProviderDelegate>())); |
| 245 } else { | 245 } else { |
| 246 service_providers.push_back(base::MakeUnique<ConsoleServiceProvider>( | 246 service_providers.push_back(base::MakeUnique<ConsoleServiceProvider>( |
| 247 base::MakeUnique<ChromeConsoleServiceProviderDelegate>())); | 247 base::MakeUnique<ChromeConsoleServiceProviderDelegate>())); |
| 248 } | 248 } |
| 249 service_providers.push_back(base::MakeUnique<KioskInfoService>()); | 249 service_providers.push_back(base::MakeUnique<KioskInfoService>()); |
| 250 cros_dbus_service_ = CrosDBusService::Create( | 250 cros_dbus_service_ = CrosDBusService::Create( |
| 251 kLibCrosServiceName, dbus::ObjectPath(kLibCrosServicePath), | 251 kLibCrosServiceName, dbus::ObjectPath(kLibCrosServicePath), |
| 252 std::move(service_providers)); | 252 std::move(service_providers)); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 new default_app_order::ExternalLoader(true /* async */)); | 513 new default_app_order::ExternalLoader(true /* async */)); |
| 514 } | 514 } |
| 515 | 515 |
| 516 media::SoundsManager::Create(); | 516 media::SoundsManager::Create(); |
| 517 | 517 |
| 518 // |arc_service_launcher_| must be initialized before NoteTakingHelper. | 518 // |arc_service_launcher_| must be initialized before NoteTakingHelper. |
| 519 NoteTakingHelper::Initialize(); | 519 NoteTakingHelper::Initialize(); |
| 520 | 520 |
| 521 AccessibilityManager::Initialize(); | 521 AccessibilityManager::Initialize(); |
| 522 | 522 |
| 523 if (!chrome::IsRunningInMash()) { | 523 if (!ash_util::IsRunningInMash()) { |
| 524 // Initialize magnification manager before ash tray is created. And this | 524 // Initialize magnification manager before ash tray is created. And this |
| 525 // must be placed after UserManager::SessionStarted(); | 525 // must be placed after UserManager::SessionStarted(); |
| 526 // TODO(sad): These components expects the ash::Shell instance to be | 526 // TODO(sad): These components expects the ash::Shell instance to be |
| 527 // created. However, when running as a mus-client, an ash::Shell instance is | 527 // created. However, when running as a mus-client, an ash::Shell instance is |
| 528 // not created. These accessibility services should instead be exposed as | 528 // not created. These accessibility services should instead be exposed as |
| 529 // separate services. crbug.com/557401 | 529 // separate services. crbug.com/557401 |
| 530 MagnificationManager::Initialize(); | 530 MagnificationManager::Initialize(); |
| 531 } | 531 } |
| 532 | 532 |
| 533 wallpaper::WallpaperManagerBase::SetPathIds( | 533 wallpaper::WallpaperManagerBase::SetPathIds( |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 #if defined(USE_X11) | 756 #if defined(USE_X11) |
| 757 // Listen for system key events so that the user will be able to adjust the | 757 // Listen for system key events so that the user will be able to adjust the |
| 758 // volume on the login screen, if Chrome is running on Chrome OS | 758 // volume on the login screen, if Chrome is running on Chrome OS |
| 759 // (i.e. not Linux desktop), and in non-test mode. | 759 // (i.e. not Linux desktop), and in non-test mode. |
| 760 // Note: SystemKeyEventListener depends on the DBus thread. | 760 // Note: SystemKeyEventListener depends on the DBus thread. |
| 761 if (base::SysInfo::IsRunningOnChromeOS() && | 761 if (base::SysInfo::IsRunningOnChromeOS() && |
| 762 !parameters().ui_task) { // ui_task is non-NULL when running tests. | 762 !parameters().ui_task) { // ui_task is non-NULL when running tests. |
| 763 SystemKeyEventListener::Initialize(); | 763 SystemKeyEventListener::Initialize(); |
| 764 } | 764 } |
| 765 | 765 |
| 766 if (!chrome::IsRunningInMash()) { | 766 if (!ash_util::IsRunningInMash()) { |
| 767 // Listen for XI_HierarchyChanged events. Note: if this is moved to | 767 // Listen for XI_HierarchyChanged events. Note: if this is moved to |
| 768 // PreMainMessageLoopRun() then desktopui_PageCyclerTests fail for unknown | 768 // PreMainMessageLoopRun() then desktopui_PageCyclerTests fail for unknown |
| 769 // reasons, see http://crosbug.com/24833. | 769 // reasons, see http://crosbug.com/24833. |
| 770 XInputHierarchyChangedEventListener::GetInstance(); | 770 XInputHierarchyChangedEventListener::GetInstance(); |
| 771 | 771 |
| 772 // Start the CrOS input device UMA watcher | 772 // Start the CrOS input device UMA watcher |
| 773 DeviceUMA::GetInstance(); | 773 DeviceUMA::GetInstance(); |
| 774 } | 774 } |
| 775 #endif | 775 #endif |
| 776 | 776 |
| 777 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 777 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 778 // -- immediately after ChildProcess::WaitForDebugger(). | 778 // -- immediately after ChildProcess::WaitForDebugger(). |
| 779 | 779 |
| 780 if (ui::ShouldDefaultToNaturalScroll()) { | 780 if (ui::ShouldDefaultToNaturalScroll()) { |
| 781 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 781 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 782 chromeos::switches::kNaturalScrollDefault); | 782 chromeos::switches::kNaturalScrollDefault); |
| 783 system::InputDeviceSettings::Get()->SetTapToClick(true); | 783 system::InputDeviceSettings::Get()->SetTapToClick(true); |
| 784 } | 784 } |
| 785 | 785 |
| 786 ChromeBrowserMainPartsLinux::PreBrowserStart(); | 786 ChromeBrowserMainPartsLinux::PreBrowserStart(); |
| 787 } | 787 } |
| 788 | 788 |
| 789 void ChromeBrowserMainPartsChromeos::PostBrowserStart() { | 789 void ChromeBrowserMainPartsChromeos::PostBrowserStart() { |
| 790 if (!chrome::IsRunningInMash()) { | 790 if (!ash_util::IsRunningInMash()) { |
| 791 system::InputDeviceSettings::Get()->UpdateTouchDevicesStatusFromPrefs(); | 791 system::InputDeviceSettings::Get()->UpdateTouchDevicesStatusFromPrefs(); |
| 792 | 792 |
| 793 // These are dependent on the ash::Shell singleton already having been | 793 // These are dependent on the ash::Shell singleton already having been |
| 794 // initialized. Consequently, these cannot be used when running as a mus | 794 // initialized. Consequently, these cannot be used when running as a mus |
| 795 // client. | 795 // client. |
| 796 // TODO(oshima): Remove ash dependency in LoginLockStateNotifier. | 796 // TODO(oshima): Remove ash dependency in LoginLockStateNotifier. |
| 797 // crbug.com/408832. | 797 // crbug.com/408832. |
| 798 login_lock_state_notifier_.reset(new LoginLockStateNotifier); | 798 login_lock_state_notifier_.reset(new LoginLockStateNotifier); |
| 799 data_promo_notification_.reset(new DataPromoNotification()); | 799 data_promo_notification_.reset(new DataPromoNotification()); |
| 800 | 800 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 extension_volume_observer_.reset(); | 860 extension_volume_observer_.reset(); |
| 861 peripheral_battery_observer_.reset(); | 861 peripheral_battery_observer_.reset(); |
| 862 power_prefs_.reset(); | 862 power_prefs_.reset(); |
| 863 renderer_freezer_.reset(); | 863 renderer_freezer_.reset(); |
| 864 wake_on_wifi_manager_.reset(); | 864 wake_on_wifi_manager_.reset(); |
| 865 network_throttling_observer_.reset(); | 865 network_throttling_observer_.reset(); |
| 866 ScreenLocker::ShutDownClass(); | 866 ScreenLocker::ShutDownClass(); |
| 867 keyboard_event_rewriters_.reset(); | 867 keyboard_event_rewriters_.reset(); |
| 868 low_disk_notification_.reset(); | 868 low_disk_notification_.reset(); |
| 869 #if defined(USE_X11) | 869 #if defined(USE_X11) |
| 870 if (!chrome::IsRunningInMash()) { | 870 if (!ash_util::IsRunningInMash()) { |
| 871 // The XInput2 event listener needs to be shut down earlier than when | 871 // The XInput2 event listener needs to be shut down earlier than when |
| 872 // Singletons are finally destroyed in AtExitManager. | 872 // Singletons are finally destroyed in AtExitManager. |
| 873 XInputHierarchyChangedEventListener::GetInstance()->Stop(); | 873 XInputHierarchyChangedEventListener::GetInstance()->Stop(); |
| 874 | 874 |
| 875 DeviceUMA::GetInstance()->Stop(); | 875 DeviceUMA::GetInstance()->Stop(); |
| 876 } | 876 } |
| 877 | 877 |
| 878 // SystemKeyEventListener::Shutdown() is always safe to call, | 878 // SystemKeyEventListener::Shutdown() is always safe to call, |
| 879 // even if Initialize() wasn't called. | 879 // even if Initialize() wasn't called. |
| 880 SystemKeyEventListener::Shutdown(); | 880 SystemKeyEventListener::Shutdown(); |
| 881 #endif | 881 #endif |
| 882 | 882 |
| 883 // Detach D-Bus clients before DBusThreadManager is shut down. | 883 // Detach D-Bus clients before DBusThreadManager is shut down. |
| 884 login_lock_state_notifier_.reset(); | 884 login_lock_state_notifier_.reset(); |
| 885 idle_action_warning_observer_.reset(); | 885 idle_action_warning_observer_.reset(); |
| 886 | 886 |
| 887 if (!chrome::IsRunningInMash()) | 887 if (!ash_util::IsRunningInMash()) |
| 888 MagnificationManager::Shutdown(); | 888 MagnificationManager::Shutdown(); |
| 889 | 889 |
| 890 media::SoundsManager::Shutdown(); | 890 media::SoundsManager::Shutdown(); |
| 891 | 891 |
| 892 system::StatisticsProvider::GetInstance()->Shutdown(); | 892 system::StatisticsProvider::GetInstance()->Shutdown(); |
| 893 | 893 |
| 894 // Let the UserManager and WallpaperManager unregister itself as an observer | 894 // Let the UserManager and WallpaperManager unregister itself as an observer |
| 895 // of the CrosSettings singleton before it is destroyed. This also ensures | 895 // of the CrosSettings singleton before it is destroyed. This also ensures |
| 896 // that the UserManager has no URLRequest pending (see | 896 // that the UserManager has no URLRequest pending (see |
| 897 // http://crbug.com/276659). | 897 // http://crbug.com/276659). |
| (...skipping 21 matching lines...) Expand all Loading... |
| 919 PreShutdown(); | 919 PreShutdown(); |
| 920 | 920 |
| 921 // We first call PostMainMessageLoopRun and then destroy UserManager, because | 921 // We first call PostMainMessageLoopRun and then destroy UserManager, because |
| 922 // Ash needs to be closed before UserManager is destroyed. | 922 // Ash needs to be closed before UserManager is destroyed. |
| 923 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); | 923 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); |
| 924 | 924 |
| 925 // Destroy ArcKioskAppManager after its observers are removed when Ash is | 925 // Destroy ArcKioskAppManager after its observers are removed when Ash is |
| 926 // closed above. | 926 // closed above. |
| 927 arc_kiosk_app_manager_.reset(); | 927 arc_kiosk_app_manager_.reset(); |
| 928 | 928 |
| 929 if (!chrome::IsRunningInMash()) | 929 if (!ash_util::IsRunningInMash()) |
| 930 AccessibilityManager::Shutdown(); | 930 AccessibilityManager::Shutdown(); |
| 931 | 931 |
| 932 input_method::Shutdown(); | 932 input_method::Shutdown(); |
| 933 | 933 |
| 934 // Stops all in-flight OAuth2 token fetchers before the IO thread stops. | 934 // Stops all in-flight OAuth2 token fetchers before the IO thread stops. |
| 935 DeviceOAuth2TokenServiceFactory::Shutdown(); | 935 DeviceOAuth2TokenServiceFactory::Shutdown(); |
| 936 | 936 |
| 937 content::MediaCaptureDevices::GetInstance()->RemoveAllVideoCaptureObservers(); | 937 content::MediaCaptureDevices::GetInstance()->RemoveAllVideoCaptureObservers(); |
| 938 | 938 |
| 939 // Shutdown after PostMainMessageLoopRun() which should destroy all observers. | 939 // Shutdown after PostMainMessageLoopRun() which should destroy all observers. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 957 | 957 |
| 958 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 958 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 959 | 959 |
| 960 // Destroy DeviceSettingsService after g_browser_process. | 960 // Destroy DeviceSettingsService after g_browser_process. |
| 961 DeviceSettingsService::Shutdown(); | 961 DeviceSettingsService::Shutdown(); |
| 962 | 962 |
| 963 chromeos::ShutdownCloseTracking(); | 963 chromeos::ShutdownCloseTracking(); |
| 964 } | 964 } |
| 965 | 965 |
| 966 } // namespace chromeos | 966 } // namespace chromeos |
| OLD | NEW |