| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_browser_main_parts.h" | 5 #include "extensions/shell/browser/shell_browser_main_parts.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "ui/base/ime/input_method_initializer.h" | 40 #include "ui/base/ime/input_method_initializer.h" |
| 41 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
| 42 | 42 |
| 43 #if defined(USE_AURA) | 43 #if defined(USE_AURA) |
| 44 #include "ui/aura/env.h" | 44 #include "ui/aura/env.h" |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
| 48 #include "chromeos/audio/audio_devices_pref_handler_impl.h" | 48 #include "chromeos/audio/audio_devices_pref_handler_impl.h" |
| 49 #include "chromeos/audio/cras_audio_handler.h" | 49 #include "chromeos/audio/cras_audio_handler.h" |
| 50 #include "chromeos/dbus/dbus_thread_manager.h" | |
| 51 #include "chromeos/disks/disk_mount_manager.h" | 50 #include "chromeos/disks/disk_mount_manager.h" |
| 52 #include "chromeos/network/network_handler.h" | 51 #include "chromeos/network/network_handler.h" |
| 52 #include "extensions/shell/browser/shell_audio_controller_chromeos.h" |
| 53 #include "extensions/shell/browser/shell_network_controller_chromeos.h" |
| 54 #endif |
| 55 |
| 56 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 53 #include "device/bluetooth/bluetooth_adapter_factory.h" | 57 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 54 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 58 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 55 #include "extensions/shell/browser/shell_audio_controller_chromeos.h" | 59 #endif |
| 56 #include "extensions/shell/browser/shell_network_controller_chromeos.h" | 60 |
| 61 #if defined(OS_CHROMEOS) |
| 62 #include "chromeos/dbus/dbus_thread_manager.h" |
| 63 #elif defined(OS_LINUX) |
| 64 #include "device/bluetooth/dbus/dbus_thread_manager_linux.h" |
| 57 #endif | 65 #endif |
| 58 | 66 |
| 59 #if defined(OS_MACOSX) | 67 #if defined(OS_MACOSX) |
| 60 #include "extensions/shell/browser/shell_browser_main_parts_mac.h" | 68 #include "extensions/shell/browser/shell_browser_main_parts_mac.h" |
| 61 #endif | 69 #endif |
| 62 | 70 |
| 63 #if !defined(DISABLE_NACL) | 71 #if !defined(DISABLE_NACL) |
| 64 #include "components/nacl/browser/nacl_browser.h" | 72 #include "components/nacl/browser/nacl_browser.h" |
| 65 #include "components/nacl/browser/nacl_process_host.h" | 73 #include "components/nacl/browser/nacl_process_host.h" |
| 66 #include "content/public/browser/browser_thread.h" | 74 #include "content/public/browser/browser_thread.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 123 |
| 116 chromeos::NetworkHandler::Initialize(); | 124 chromeos::NetworkHandler::Initialize(); |
| 117 network_controller_.reset(new ShellNetworkController( | 125 network_controller_.reset(new ShellNetworkController( |
| 118 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 126 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
| 119 switches::kAppShellPreferredNetwork))); | 127 switches::kAppShellPreferredNetwork))); |
| 120 | 128 |
| 121 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 129 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 122 switches::kAppShellAllowRoaming)) { | 130 switches::kAppShellAllowRoaming)) { |
| 123 network_controller_->SetCellularAllowRoaming(true); | 131 network_controller_->SetCellularAllowRoaming(true); |
| 124 } | 132 } |
| 133 #elif defined(OS_LINUX) |
| 134 // app_shell doesn't need GTK, so the fake input method context can work. |
| 135 // See crbug.com/381852 and revision fb69f142. |
| 136 // TODO(michaelpg): Verify this works for target environments. |
| 137 ui::InitializeInputMethodForTesting(); |
| 138 |
| 139 bluez::DBusThreadManagerLinux::Initialize(); |
| 140 bluez::BluezDBusManager::Initialize( |
| 141 bluez::DBusThreadManagerLinux::Get()->GetSystemBus(), |
| 142 /*use_dbus_fakes=*/false); |
| 125 #else | 143 #else |
| 126 // Non-Chrome OS platforms are for developer convenience, so use a test IME. | |
| 127 ui::InitializeInputMethodForTesting(); | 144 ui::InitializeInputMethodForTesting(); |
| 128 #endif | 145 #endif |
| 129 } | 146 } |
| 130 | 147 |
| 131 void ShellBrowserMainParts::PreEarlyInitialization() { | 148 void ShellBrowserMainParts::PreEarlyInitialization() { |
| 132 } | 149 } |
| 133 | 150 |
| 134 int ShellBrowserMainParts::PreCreateThreads() { | 151 int ShellBrowserMainParts::PreCreateThreads() { |
| 135 // TODO(jamescook): Initialize chromeos::CrosSettings here? | 152 // TODO(jamescook): Initialize chromeos::CrosSettings here? |
| 136 | 153 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } | 288 } |
| 272 | 289 |
| 273 void ShellBrowserMainParts::PostDestroyThreads() { | 290 void ShellBrowserMainParts::PostDestroyThreads() { |
| 274 #if defined(OS_CHROMEOS) | 291 #if defined(OS_CHROMEOS) |
| 275 network_controller_.reset(); | 292 network_controller_.reset(); |
| 276 chromeos::NetworkHandler::Shutdown(); | 293 chromeos::NetworkHandler::Shutdown(); |
| 277 chromeos::disks::DiskMountManager::Shutdown(); | 294 chromeos::disks::DiskMountManager::Shutdown(); |
| 278 device::BluetoothAdapterFactory::Shutdown(); | 295 device::BluetoothAdapterFactory::Shutdown(); |
| 279 bluez::BluezDBusManager::Shutdown(); | 296 bluez::BluezDBusManager::Shutdown(); |
| 280 chromeos::DBusThreadManager::Shutdown(); | 297 chromeos::DBusThreadManager::Shutdown(); |
| 298 #elif defined(OS_LINUX) |
| 299 device::BluetoothAdapterFactory::Shutdown(); |
| 300 bluez::BluezDBusManager::Shutdown(); |
| 301 bluez::DBusThreadManagerLinux::Shutdown(); |
| 281 #endif | 302 #endif |
| 282 } | 303 } |
| 283 | 304 |
| 284 ExtensionsClient* ShellBrowserMainParts::CreateExtensionsClient() { | 305 ExtensionsClient* ShellBrowserMainParts::CreateExtensionsClient() { |
| 285 return new ShellExtensionsClient(); | 306 return new ShellExtensionsClient(); |
| 286 } | 307 } |
| 287 | 308 |
| 288 ExtensionsBrowserClient* ShellBrowserMainParts::CreateExtensionsBrowserClient( | 309 ExtensionsBrowserClient* ShellBrowserMainParts::CreateExtensionsBrowserClient( |
| 289 content::BrowserContext* context, | 310 content::BrowserContext* context, |
| 290 PrefService* service) { | 311 PrefService* service) { |
| 291 return new ShellExtensionsBrowserClient(context, service); | 312 return new ShellExtensionsBrowserClient(context, service); |
| 292 } | 313 } |
| 293 | 314 |
| 294 void ShellBrowserMainParts::CreateExtensionSystem() { | 315 void ShellBrowserMainParts::CreateExtensionSystem() { |
| 295 DCHECK(browser_context_); | 316 DCHECK(browser_context_); |
| 296 extension_system_ = static_cast<ShellExtensionSystem*>( | 317 extension_system_ = static_cast<ShellExtensionSystem*>( |
| 297 ExtensionSystem::Get(browser_context_.get())); | 318 ExtensionSystem::Get(browser_context_.get())); |
| 298 extension_system_->InitForRegularProfile(true); | 319 extension_system_->InitForRegularProfile(true); |
| 299 } | 320 } |
| 300 | 321 |
| 301 } // namespace extensions | 322 } // namespace extensions |
| OLD | NEW |