| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/common/ash_switches.h" | 13 #include "ash/common/ash_switches.h" |
| 14 #include "ash/common/dbus_thread_manager_ash.h" |
| 14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 15 #include "base/bind.h" | 16 #include "base/bind.h" |
| 16 #include "base/callback.h" | 17 #include "base/callback.h" |
| 17 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 18 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
| 19 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
| 20 #include "base/linux_util.h" | 21 #include "base/linux_util.h" |
| 21 #include "base/macros.h" | 22 #include "base/macros.h" |
| 22 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
| 23 #include "base/path_service.h" | 24 #include "base/path_service.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 35 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
| 35 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 36 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 36 #include "chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification
.h" | 37 #include "chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification
.h" |
| 37 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" | 38 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" |
| 38 #include "chrome/browser/chromeos/boot_times_recorder.h" | 39 #include "chrome/browser/chromeos/boot_times_recorder.h" |
| 39 #include "chrome/browser/chromeos/dbus/chrome_console_service_provider_delegate.
h" | 40 #include "chrome/browser/chromeos/dbus/chrome_console_service_provider_delegate.
h" |
| 40 #include "chrome/browser/chromeos/dbus/chrome_display_power_service_provider_del
egate.h" | 41 #include "chrome/browser/chromeos/dbus/chrome_display_power_service_provider_del
egate.h" |
| 41 #include "chrome/browser/chromeos/dbus/chrome_proxy_resolver_delegate.h" | 42 #include "chrome/browser/chromeos/dbus/chrome_proxy_resolver_delegate.h" |
| 42 #include "chrome/browser/chromeos/dbus/kiosk_info_service_provider.h" | 43 #include "chrome/browser/chromeos/dbus/kiosk_info_service_provider.h" |
| 43 #include "chrome/browser/chromeos/dbus/screen_lock_service_provider.h" | 44 #include "chrome/browser/chromeos/dbus/screen_lock_service_provider.h" |
| 45 #include "chrome/browser/chromeos/dbus_thread_manager_chrome.h" |
| 44 #include "chrome/browser/chromeos/display/quirks_manager_delegate_impl.h" | 46 #include "chrome/browser/chromeos/display/quirks_manager_delegate_impl.h" |
| 45 #include "chrome/browser/chromeos/events/event_rewriter.h" | 47 #include "chrome/browser/chromeos/events/event_rewriter.h" |
| 46 #include "chrome/browser/chromeos/events/event_rewriter_controller.h" | 48 #include "chrome/browser/chromeos/events/event_rewriter_controller.h" |
| 47 #include "chrome/browser/chromeos/events/keyboard_driven_event_rewriter.h" | 49 #include "chrome/browser/chromeos/events/keyboard_driven_event_rewriter.h" |
| 48 #include "chrome/browser/chromeos/extensions/default_app_order.h" | 50 #include "chrome/browser/chromeos/extensions/default_app_order.h" |
| 49 #include "chrome/browser/chromeos/external_metrics.h" | 51 #include "chrome/browser/chromeos/external_metrics.h" |
| 50 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 52 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 51 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 53 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 52 #include "chrome/browser/chromeos/language_preferences.h" | 54 #include "chrome/browser/chromeos/language_preferences.h" |
| 53 #include "chrome/browser/chromeos/login/helper.h" | 55 #include "chrome/browser/chromeos/login/helper.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 #include "chrome/common/pref_names.h" | 96 #include "chrome/common/pref_names.h" |
| 95 #include "chromeos/audio/audio_devices_pref_handler_impl.h" | 97 #include "chromeos/audio/audio_devices_pref_handler_impl.h" |
| 96 #include "chromeos/audio/cras_audio_handler.h" | 98 #include "chromeos/audio/cras_audio_handler.h" |
| 97 #include "chromeos/cert_loader.h" | 99 #include "chromeos/cert_loader.h" |
| 98 #include "chromeos/chromeos_paths.h" | 100 #include "chromeos/chromeos_paths.h" |
| 99 #include "chromeos/chromeos_switches.h" | 101 #include "chromeos/chromeos_switches.h" |
| 100 #include "chromeos/cryptohome/async_method_caller.h" | 102 #include "chromeos/cryptohome/async_method_caller.h" |
| 101 #include "chromeos/cryptohome/cryptohome_parameters.h" | 103 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 102 #include "chromeos/cryptohome/homedir_methods.h" | 104 #include "chromeos/cryptohome/homedir_methods.h" |
| 103 #include "chromeos/cryptohome/system_salt_getter.h" | 105 #include "chromeos/cryptohome/system_salt_getter.h" |
| 106 #include "chromeos/dbus/dbus_client_bundle.h" |
| 104 #include "chromeos/dbus/dbus_thread_manager.h" | 107 #include "chromeos/dbus/dbus_thread_manager.h" |
| 105 #include "chromeos/dbus/power_policy_controller.h" | 108 #include "chromeos/dbus/power_policy_controller.h" |
| 106 #include "chromeos/dbus/services/console_service_provider.h" | 109 #include "chromeos/dbus/services/console_service_provider.h" |
| 107 #include "chromeos/dbus/services/cros_dbus_service.h" | 110 #include "chromeos/dbus/services/cros_dbus_service.h" |
| 108 #include "chromeos/dbus/services/display_power_service_provider.h" | 111 #include "chromeos/dbus/services/display_power_service_provider.h" |
| 109 #include "chromeos/dbus/services/liveness_service_provider.h" | 112 #include "chromeos/dbus/services/liveness_service_provider.h" |
| 110 #include "chromeos/dbus/services/proxy_resolution_service_provider.h" | 113 #include "chromeos/dbus/services/proxy_resolution_service_provider.h" |
| 111 #include "chromeos/dbus/session_manager_client.h" | 114 #include "chromeos/dbus/session_manager_client.h" |
| 112 #include "chromeos/disks/disk_mount_manager.h" | 115 #include "chromeos/disks/disk_mount_manager.h" |
| 113 #include "chromeos/login/login_state.h" | 116 #include "chromeos/login/login_state.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } // namespace | 194 } // namespace |
| 192 | 195 |
| 193 namespace internal { | 196 namespace internal { |
| 194 | 197 |
| 195 // Wrapper class for initializing dbus related services and shutting them | 198 // Wrapper class for initializing dbus related services and shutting them |
| 196 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the | 199 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the |
| 197 // destructor will get called if and only if this has been instantiated. | 200 // destructor will get called if and only if this has been instantiated. |
| 198 class DBusServices { | 201 class DBusServices { |
| 199 public: | 202 public: |
| 200 explicit DBusServices(const content::MainFunctionParams& parameters) { | 203 explicit DBusServices(const content::MainFunctionParams& parameters) { |
| 204 DBusClientTypeMask dbus_clients = DBusClientBundle::ALL_CLIENTS; |
| 205 // Under mustash the ash process handles SMS D-Bus services. |
| 206 if (chrome::IsRunningInMash()) { |
| 207 dbus_clients &= ~DBusClientBundle::GSM_SMS; |
| 208 dbus_clients &= ~DBusClientBundle::SMS; |
| 209 } |
| 201 // Initialize DBusThreadManager for the browser. This must be done after | 210 // Initialize DBusThreadManager for the browser. This must be done after |
| 202 // the main message loop is started, as it uses the message loop. | 211 // the main message loop is started, as it uses the message loop. |
| 203 DBusThreadManager::Initialize(); | 212 DBusThreadManager::Initialize(dbus_clients); |
| 213 thread_manager_ash_.reset(new ash::DBusThreadManagerAsh()); |
| 214 thread_manager_chrome_.reset(new DBusThreadManagerChrome()); |
| 204 | 215 |
| 205 bluez::BluezDBusManager::Initialize( | 216 bluez::BluezDBusManager::Initialize( |
| 206 DBusThreadManager::Get()->GetSystemBus(), | 217 DBusThreadManager::Get()->GetSystemBus(), |
| 207 chromeos::DBusThreadManager::Get()->IsUsingStub( | 218 chromeos::DBusThreadManager::Get()->IsUsingFake( |
| 208 chromeos::DBusClientBundle::BLUETOOTH)); | 219 chromeos::DBusClientBundle::BLUETOOTH)); |
| 209 | 220 |
| 210 PowerPolicyController::Initialize( | 221 PowerPolicyController::Initialize( |
| 211 DBusThreadManager::Get()->GetPowerManagerClient()); | 222 DBusThreadManager::Get()->GetPowerManagerClient()); |
| 212 | 223 |
| 213 CrosDBusService::ServiceProviderList service_providers; | 224 CrosDBusService::ServiceProviderList service_providers; |
| 214 service_providers.push_back( | 225 service_providers.push_back( |
| 215 base::WrapUnique(ProxyResolutionServiceProvider::Create( | 226 base::WrapUnique(ProxyResolutionServiceProvider::Create( |
| 216 base::MakeUnique<ChromeProxyResolverDelegate>()))); | 227 base::MakeUnique<ChromeProxyResolverDelegate>()))); |
| 217 if (!chrome::IsRunningInMash()) { | 228 if (!chrome::IsRunningInMash()) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 SystemSaltGetter::Shutdown(); | 284 SystemSaltGetter::Shutdown(); |
| 274 LoginState::Shutdown(); | 285 LoginState::Shutdown(); |
| 275 CertLoader::Shutdown(); | 286 CertLoader::Shutdown(); |
| 276 TPMTokenLoader::Shutdown(); | 287 TPMTokenLoader::Shutdown(); |
| 277 CrosDBusService::Shutdown(); | 288 CrosDBusService::Shutdown(); |
| 278 PowerDataCollector::Shutdown(); | 289 PowerDataCollector::Shutdown(); |
| 279 PowerPolicyController::Shutdown(); | 290 PowerPolicyController::Shutdown(); |
| 280 device::BluetoothAdapterFactory::Shutdown(); | 291 device::BluetoothAdapterFactory::Shutdown(); |
| 281 bluez::BluezDBusManager::Shutdown(); | 292 bluez::BluezDBusManager::Shutdown(); |
| 282 | 293 |
| 294 thread_manager_chrome_.reset(); |
| 295 thread_manager_ash_.reset(); |
| 283 // NOTE: This must only be called if Initialize() was called. | 296 // NOTE: This must only be called if Initialize() was called. |
| 284 DBusThreadManager::Shutdown(); | 297 DBusThreadManager::Shutdown(); |
| 285 } | 298 } |
| 286 | 299 |
| 287 private: | 300 private: |
| 301 //JAMES these are really bundles of clients, not thread managers |
| 302 std::unique_ptr<ash::DBusThreadManagerAsh> thread_manager_ash_; |
| 303 std::unique_ptr<DBusThreadManagerChrome> thread_manager_chrome_; |
| 288 std::unique_ptr<NetworkConnectDelegateChromeOS> network_connect_delegate_; | 304 std::unique_ptr<NetworkConnectDelegateChromeOS> network_connect_delegate_; |
| 289 | 305 |
| 290 DISALLOW_COPY_AND_ASSIGN(DBusServices); | 306 DISALLOW_COPY_AND_ASSIGN(DBusServices); |
| 291 }; | 307 }; |
| 292 | 308 |
| 293 } // namespace internal | 309 } // namespace internal |
| 294 | 310 |
| 295 // ChromeBrowserMainPartsChromeos ---------------------------------------------- | 311 // ChromeBrowserMainPartsChromeos ---------------------------------------------- |
| 296 | 312 |
| 297 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( | 313 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 // Destroy DBus services immediately after threads are stopped. | 894 // Destroy DBus services immediately after threads are stopped. |
| 879 dbus_services_.reset(); | 895 dbus_services_.reset(); |
| 880 | 896 |
| 881 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 897 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 882 | 898 |
| 883 // Destroy DeviceSettingsService after g_browser_process. | 899 // Destroy DeviceSettingsService after g_browser_process. |
| 884 DeviceSettingsService::Shutdown(); | 900 DeviceSettingsService::Shutdown(); |
| 885 } | 901 } |
| 886 | 902 |
| 887 } // namespace chromeos | 903 } // namespace chromeos |
| OLD | NEW |