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

Side by Side Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 10899037: Refactoring bluetooth API code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing styles and tess. Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/system/ash_system_tray_delegate.h" 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/system/audio/audio_observer.h" 9 #include "ash/system/audio/audio_observer.h"
10 #include "ash/system/bluetooth/bluetooth_observer.h" 10 #include "ash/system/bluetooth/bluetooth_observer.h"
(...skipping 14 matching lines...) Expand all
25 #include "base/bind_helpers.h" 25 #include "base/bind_helpers.h"
26 #include "base/callback.h" 26 #include "base/callback.h"
27 #include "base/chromeos/chromeos_version.h" 27 #include "base/chromeos/chromeos_version.h"
28 #include "base/logging.h" 28 #include "base/logging.h"
29 #include "base/memory/weak_ptr.h" 29 #include "base/memory/weak_ptr.h"
30 #include "base/utf_string_conversions.h" 30 #include "base/utf_string_conversions.h"
31 #include "chrome/browser/browser_process.h" 31 #include "chrome/browser/browser_process.h"
32 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 32 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
33 #include "chrome/browser/chromeos/audio/audio_handler.h" 33 #include "chrome/browser/chromeos/audio/audio_handler.h"
34 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" 34 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
35 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.h"
35 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" 36 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h"
37 #include "chrome/browser/chromeos/bluetooth/bluetooth_device_dbus.h"
36 #include "chrome/browser/chromeos/cros/cros_library.h" 38 #include "chrome/browser/chromeos/cros/cros_library.h"
37 #include "chrome/browser/chromeos/cros/network_library.h" 39 #include "chrome/browser/chromeos/cros/network_library.h"
38 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" 40 #include "chrome/browser/chromeos/gdata/drive_service_interface.h"
39 #include "chrome/browser/chromeos/gdata/drive_system_service.h" 41 #include "chrome/browser/chromeos/gdata/drive_system_service.h"
40 #include "chrome/browser/chromeos/gdata/gdata_util.h" 42 #include "chrome/browser/chromeos/gdata/gdata_util.h"
41 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 43 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
42 #include "chrome/browser/chromeos/input_method/input_method_util.h" 44 #include "chrome/browser/chromeos/input_method/input_method_util.h"
43 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 45 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
44 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" 46 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
45 #include "chrome/browser/chromeos/login/base_login_display_host.h" 47 #include "chrome/browser/chromeos/login/base_login_display_host.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 registrar_.Add(this, 213 registrar_.Add(this,
212 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 214 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
213 content::NotificationService::AllSources()); 215 content::NotificationService::AllSources());
214 216
215 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, 217 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled,
216 g_browser_process->local_state(), this); 218 g_browser_process->local_state(), this);
217 219
218 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT); 220 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT);
219 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); 221 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK);
220 222
221 bluetooth_adapter_ = BluetoothAdapter::DefaultAdapter(); 223 bluetooth_adapter_ = BluetoothAdapterDBus::DefaultAdapter();
222 bluetooth_adapter_->AddObserver(this); 224 bluetooth_adapter_->AddObserver(this);
223 } 225 }
224 226
225 virtual ~SystemTrayDelegate() { 227 virtual ~SystemTrayDelegate() {
226 AudioHandler* audiohandler = AudioHandler::GetInstance(); 228 AudioHandler* audiohandler = AudioHandler::GetInstance();
227 if (audiohandler) 229 if (audiohandler)
228 audiohandler->RemoveVolumeObserver(this); 230 audiohandler->RemoveVolumeObserver(this);
229 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); 231 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
230 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); 232 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
231 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); 233 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 continue; 374 continue;
373 ash::BluetoothDeviceInfo info; 375 ash::BluetoothDeviceInfo info;
374 info.address = device->address(); 376 info.address = device->address();
375 info.display_name = device->GetName(); 377 info.display_name = device->GetName();
376 info.connected = device->IsConnected(); 378 info.connected = device->IsConnected();
377 list->push_back(info); 379 list->push_back(info);
378 } 380 }
379 } 381 }
380 382
381 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { 383 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE {
382 BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); 384 BluetoothDeviceDBus* device =
385 static_cast<BluetoothDeviceDBus *>(
386 bluetooth_adapter_->GetDevice(address));
bryeung 2012/09/13 19:52:57 why can't this be a call on the interface?
youngki 2012/09/17 21:53:02 Done.
383 if (!device) 387 if (!device)
384 return; 388 return;
385 if (device->IsConnected()) { 389 if (device->IsConnected()) {
386 device->Disconnect( 390 device->Disconnect(
387 base::Bind(&base::DoNothing), 391 base::Bind(&base::DoNothing),
388 base::Bind(&BluetoothDeviceDisconnectError)); 392 base::Bind(&BluetoothDeviceDisconnectError));
389 } else if (device->IsPaired()) { 393 } else if (device->IsPaired()) {
390 device->Connect( 394 device->Connect(
391 NULL, 395 NULL,
392 base::Bind(&base::DoNothing), 396 base::Bind(&base::DoNothing),
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); 1268 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate);
1265 }; 1269 };
1266 1270
1267 } // namespace 1271 } // namespace
1268 1272
1269 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { 1273 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) {
1270 return new chromeos::SystemTrayDelegate(tray); 1274 return new chromeos::SystemTrayDelegate(tray);
1271 } 1275 }
1272 1276
1273 } // namespace chromeos 1277 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698