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

Side by Side Diff: extensions/shell/browser/shell_browser_main_parts.cc

Issue 2819593003: Initialize BlueZ in app_shell on Linux (Closed)
Patch Set: todone Created 3 years, 8 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
OLDNEW
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
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"
53 #include "device/bluetooth/bluetooth_adapter_factory.h"
54 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
55 #include "extensions/shell/browser/shell_audio_controller_chromeos.h" 52 #include "extensions/shell/browser/shell_audio_controller_chromeos.h"
56 #include "extensions/shell/browser/shell_network_controller_chromeos.h" 53 #include "extensions/shell/browser/shell_network_controller_chromeos.h"
57 #endif 54 #endif
58 55
56 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
57 #include "device/bluetooth/bluetooth_adapter_factory.h"
58 #endif
59
60 #if defined(OS_CHROMEOS)
61 #include "chromeos/dbus/dbus_thread_manager.h"
62 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
Devlin 2017/04/14 01:43:44 Put this in the ifdef above for both CrOS and Linu
michaelpg 2017/04/14 03:52:58 Done.
63 #elif defined(OS_LINUX)
64 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
65 #include "device/bluetooth/dbus/dbus_thread_manager_linux.h"
66 #endif
67
59 #if defined(OS_MACOSX) 68 #if defined(OS_MACOSX)
60 #include "extensions/shell/browser/shell_browser_main_parts_mac.h" 69 #include "extensions/shell/browser/shell_browser_main_parts_mac.h"
61 #endif 70 #endif
62 71
63 #if !defined(DISABLE_NACL) 72 #if !defined(DISABLE_NACL)
64 #include "components/nacl/browser/nacl_browser.h" 73 #include "components/nacl/browser/nacl_browser.h"
65 #include "components/nacl/browser/nacl_process_host.h" 74 #include "components/nacl/browser/nacl_process_host.h"
66 #include "content/public/browser/browser_thread.h" 75 #include "content/public/browser/browser_thread.h"
67 #include "extensions/shell/browser/shell_nacl_browser_delegate.h" 76 #include "extensions/shell/browser/shell_nacl_browser_delegate.h"
68 #endif 77 #endif
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 124
116 chromeos::NetworkHandler::Initialize(); 125 chromeos::NetworkHandler::Initialize();
117 network_controller_.reset(new ShellNetworkController( 126 network_controller_.reset(new ShellNetworkController(
118 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( 127 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
119 switches::kAppShellPreferredNetwork))); 128 switches::kAppShellPreferredNetwork)));
120 129
121 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 130 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
122 switches::kAppShellAllowRoaming)) { 131 switches::kAppShellAllowRoaming)) {
123 network_controller_->SetCellularAllowRoaming(true); 132 network_controller_->SetCellularAllowRoaming(true);
124 } 133 }
134 #elif defined(OS_LINUX)
135 // app_shell doesn't need GTK, so the fake input method context can work.
136 // See crbug.com/381852 and revision fb69f142.
137 // TODO(michaelpg): Verify this works for target environments.
138 ui::InitializeInputMethodForTesting();
Devlin 2017/04/14 01:43:44 ForTesting methods used in non test environments t
michaelpg 2017/04/14 03:52:58 I added the TODO because I need to investigate thi
139
140 bluez::DBusThreadManagerLinux::Initialize();
141 bluez::BluezDBusManager::Initialize(
142 bluez::DBusThreadManagerLinux::Get()->GetSystemBus(),
143 /*use_dbus_fakes=*/false);
125 #else 144 #else
126 // Non-Chrome OS platforms are for developer convenience, so use a test IME.
127 ui::InitializeInputMethodForTesting(); 145 ui::InitializeInputMethodForTesting();
128 #endif 146 #endif
129 } 147 }
130 148
131 void ShellBrowserMainParts::PreEarlyInitialization() { 149 void ShellBrowserMainParts::PreEarlyInitialization() {
132 } 150 }
133 151
134 int ShellBrowserMainParts::PreCreateThreads() { 152 int ShellBrowserMainParts::PreCreateThreads() {
135 // TODO(jamescook): Initialize chromeos::CrosSettings here? 153 // TODO(jamescook): Initialize chromeos::CrosSettings here?
136 154
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 289 }
272 290
273 void ShellBrowserMainParts::PostDestroyThreads() { 291 void ShellBrowserMainParts::PostDestroyThreads() {
274 #if defined(OS_CHROMEOS) 292 #if defined(OS_CHROMEOS)
275 network_controller_.reset(); 293 network_controller_.reset();
276 chromeos::NetworkHandler::Shutdown(); 294 chromeos::NetworkHandler::Shutdown();
277 chromeos::disks::DiskMountManager::Shutdown(); 295 chromeos::disks::DiskMountManager::Shutdown();
278 device::BluetoothAdapterFactory::Shutdown(); 296 device::BluetoothAdapterFactory::Shutdown();
279 bluez::BluezDBusManager::Shutdown(); 297 bluez::BluezDBusManager::Shutdown();
280 chromeos::DBusThreadManager::Shutdown(); 298 chromeos::DBusThreadManager::Shutdown();
299 #elif defined(OS_LINUX)
300 device::BluetoothAdapterFactory::Shutdown();
301 bluez::BluezDBusManager::Shutdown();
302 bluez::DBusThreadManagerLinux::Shutdown();
281 #endif 303 #endif
282 } 304 }
283 305
284 ExtensionsClient* ShellBrowserMainParts::CreateExtensionsClient() { 306 ExtensionsClient* ShellBrowserMainParts::CreateExtensionsClient() {
285 return new ShellExtensionsClient(); 307 return new ShellExtensionsClient();
286 } 308 }
287 309
288 ExtensionsBrowserClient* ShellBrowserMainParts::CreateExtensionsBrowserClient( 310 ExtensionsBrowserClient* ShellBrowserMainParts::CreateExtensionsBrowserClient(
289 content::BrowserContext* context, 311 content::BrowserContext* context,
290 PrefService* service) { 312 PrefService* service) {
291 return new ShellExtensionsBrowserClient(context, service); 313 return new ShellExtensionsBrowserClient(context, service);
292 } 314 }
293 315
294 void ShellBrowserMainParts::CreateExtensionSystem() { 316 void ShellBrowserMainParts::CreateExtensionSystem() {
295 DCHECK(browser_context_); 317 DCHECK(browser_context_);
296 extension_system_ = static_cast<ShellExtensionSystem*>( 318 extension_system_ = static_cast<ShellExtensionSystem*>(
297 ExtensionSystem::Get(browser_context_.get())); 319 ExtensionSystem::Get(browser_context_.get()));
298 extension_system_->InitForRegularProfile(true); 320 extension_system_->InitForRegularProfile(true);
299 } 321 }
300 322
301 } // namespace extensions 323 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698