| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 #include "ash/volume_control_delegate.h" | 24 #include "ash/volume_control_delegate.h" |
| 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_dbus.h" |
| 35 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" | 35 #include "chrome/browser/chromeos/bluetooth/bluetooth_device_dbus.h" |
| 36 #include "chrome/browser/chromeos/cros/cros_library.h" | 36 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 37 #include "chrome/browser/chromeos/cros/network_library.h" | 37 #include "chrome/browser/chromeos/cros/network_library.h" |
| 38 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" | 38 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" |
| 39 #include "chrome/browser/chromeos/gdata/drive_system_service.h" | 39 #include "chrome/browser/chromeos/gdata/drive_system_service.h" |
| 40 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 40 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 41 #include "chrome/browser/chromeos/gdata/operation_registry.h" | 41 #include "chrome/browser/chromeos/gdata/operation_registry.h" |
| 42 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 42 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 43 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 43 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 44 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 44 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 45 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 45 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 public SessionManagerClient::Observer, | 149 public SessionManagerClient::Observer, |
| 150 public NetworkMenuIcon::Delegate, | 150 public NetworkMenuIcon::Delegate, |
| 151 public NetworkMenu::Delegate, | 151 public NetworkMenu::Delegate, |
| 152 public NetworkLibrary::NetworkManagerObserver, | 152 public NetworkLibrary::NetworkManagerObserver, |
| 153 public NetworkLibrary::NetworkObserver, | 153 public NetworkLibrary::NetworkObserver, |
| 154 public NetworkLibrary::CellularDataPlanObserver, | 154 public NetworkLibrary::CellularDataPlanObserver, |
| 155 public gdata::OperationRegistry::Observer, | 155 public gdata::OperationRegistry::Observer, |
| 156 public content::NotificationObserver, | 156 public content::NotificationObserver, |
| 157 public input_method::InputMethodManager::Observer, | 157 public input_method::InputMethodManager::Observer, |
| 158 public system::TimezoneSettings::Observer, | 158 public system::TimezoneSettings::Observer, |
| 159 public BluetoothAdapter::Observer, | 159 public BluetoothAdapterDBus::Observer, |
| 160 public SystemKeyEventListener::CapsLockObserver, | 160 public SystemKeyEventListener::CapsLockObserver, |
| 161 public MessageBubbleLinkListener { | 161 public MessageBubbleLinkListener { |
| 162 public: | 162 public: |
| 163 explicit SystemTrayDelegate(ash::SystemTray* tray) | 163 explicit SystemTrayDelegate(ash::SystemTray* tray) |
| 164 : tray_(tray), | 164 : tray_(tray), |
| 165 ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( | 165 ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( |
| 166 new base::WeakPtrFactory<SystemTrayDelegate>(this))), | 166 new base::WeakPtrFactory<SystemTrayDelegate>(this))), |
| 167 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( | 167 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( |
| 168 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 168 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
| 169 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( | 169 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 registrar_.Add(this, | 208 registrar_.Add(this, |
| 209 chrome::NOTIFICATION_PROFILE_CREATED, | 209 chrome::NOTIFICATION_PROFILE_CREATED, |
| 210 content::NotificationService::AllSources()); | 210 content::NotificationService::AllSources()); |
| 211 | 211 |
| 212 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, | 212 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, |
| 213 g_browser_process->local_state(), this); | 213 g_browser_process->local_state(), this); |
| 214 | 214 |
| 215 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT); | 215 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT); |
| 216 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); | 216 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); |
| 217 | 217 |
| 218 bluetooth_adapter_ = BluetoothAdapter::DefaultAdapter(); | 218 bluetooth_adapter_ = BluetoothAdapterDBus::DefaultAdapter(); |
| 219 bluetooth_adapter_->AddObserver(this); | 219 bluetooth_adapter_->AddObserver(this); |
| 220 } | 220 } |
| 221 | 221 |
| 222 virtual ~SystemTrayDelegate() { | 222 virtual ~SystemTrayDelegate() { |
| 223 AudioHandler* audiohandler = AudioHandler::GetInstance(); | 223 AudioHandler* audiohandler = AudioHandler::GetInstance(); |
| 224 if (audiohandler) | 224 if (audiohandler) |
| 225 audiohandler->RemoveVolumeObserver(this); | 225 audiohandler->RemoveVolumeObserver(this); |
| 226 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); | 226 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
| 227 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 227 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
| 228 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 228 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 virtual void RequestLockScreen() OVERRIDE { | 354 virtual void RequestLockScreen() OVERRIDE { |
| 355 DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen(); | 355 DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen(); |
| 356 } | 356 } |
| 357 | 357 |
| 358 virtual void RequestRestart() OVERRIDE { | 358 virtual void RequestRestart() OVERRIDE { |
| 359 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 359 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 virtual void GetAvailableBluetoothDevices( | 362 virtual void GetAvailableBluetoothDevices( |
| 363 ash::BluetoothDeviceList* list) OVERRIDE { | 363 ash::BluetoothDeviceList* list) OVERRIDE { |
| 364 BluetoothAdapter::DeviceList devices = bluetooth_adapter_->GetDevices(); | 364 BluetoothAdapterDBus::DeviceList devices = |
| 365 bluetooth_adapter_->GetDevices(); |
| 365 for (size_t i = 0; i < devices.size(); ++i) { | 366 for (size_t i = 0; i < devices.size(); ++i) { |
| 366 BluetoothDevice* device = devices[i]; | 367 BluetoothDeviceInterface* device = devices[i]; |
| 367 if (!device->IsPaired()) | 368 if (!device->IsPaired()) |
| 368 continue; | 369 continue; |
| 369 ash::BluetoothDeviceInfo info; | 370 ash::BluetoothDeviceInfo info; |
| 370 info.address = device->address(); | 371 info.address = device->address(); |
| 371 info.display_name = device->GetName(); | 372 info.display_name = device->GetName(); |
| 372 info.connected = device->IsConnected(); | 373 info.connected = device->IsConnected(); |
| 373 list->push_back(info); | 374 list->push_back(info); |
| 374 } | 375 } |
| 375 } | 376 } |
| 376 | 377 |
| 377 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { | 378 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { |
| 378 BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); | 379 BluetoothDeviceDBus* device = |
| 380 static_cast<BluetoothDeviceDBus *>( |
| 381 bluetooth_adapter_->GetDevice(address)); |
| 379 if (!device) | 382 if (!device) |
| 380 return; | 383 return; |
| 381 if (device->IsConnected()) { | 384 if (device->IsConnected()) { |
| 382 device->Disconnect( | 385 device->Disconnect( |
| 383 base::Bind(&base::DoNothing), | 386 base::Bind(&base::DoNothing), |
| 384 base::Bind(&BluetoothDeviceDisconnectError)); | 387 base::Bind(&BluetoothDeviceDisconnectError)); |
| 385 } else if (device->IsPaired()) { | 388 } else if (device->IsPaired()) { |
| 386 device->Connect( | 389 device->Connect( |
| 387 NULL, | 390 NULL, |
| 388 base::Bind(&base::DoNothing), | 391 base::Bind(&base::DoNothing), |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 | 1132 |
| 1130 OnProgressUpdate(system_service->drive_service()->operation_registry()-> | 1133 OnProgressUpdate(system_service->drive_service()->operation_registry()-> |
| 1131 GetProgressStatusList()); | 1134 GetProgressStatusList()); |
| 1132 } | 1135 } |
| 1133 | 1136 |
| 1134 // Overridden from system::TimezoneSettings::Observer. | 1137 // Overridden from system::TimezoneSettings::Observer. |
| 1135 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { | 1138 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { |
| 1136 NotifyRefreshClock(); | 1139 NotifyRefreshClock(); |
| 1137 } | 1140 } |
| 1138 | 1141 |
| 1139 // Overridden from BluetoothAdapter::Observer. | 1142 // Overridden from BluetoothAdapterDBus::Observer. |
| 1140 virtual void AdapterPresentChanged(BluetoothAdapter* adapter, | 1143 virtual void AdapterPresentChanged(BluetoothAdapterDBus* adapter, |
| 1141 bool present) OVERRIDE { | 1144 bool present) OVERRIDE { |
| 1142 NotifyRefreshBluetooth(); | 1145 NotifyRefreshBluetooth(); |
| 1143 } | 1146 } |
| 1144 | 1147 |
| 1145 virtual void AdapterPoweredChanged(BluetoothAdapter* adapter, | 1148 virtual void AdapterPoweredChanged(BluetoothAdapterDBus* adapter, |
| 1146 bool powered) OVERRIDE { | 1149 bool powered) OVERRIDE { |
| 1147 NotifyRefreshBluetooth(); | 1150 NotifyRefreshBluetooth(); |
| 1148 } | 1151 } |
| 1149 | 1152 |
| 1150 virtual void AdapterDiscoveringChanged(BluetoothAdapter* adapter, | 1153 virtual void AdapterDiscoveringChanged(BluetoothAdapterDBus* adapter, |
| 1151 bool discovering) OVERRIDE { | 1154 bool discovering) OVERRIDE { |
| 1152 // TODO: Perhaps start/stop throbbing the icon, or some other visual | 1155 // TODO: Perhaps start/stop throbbing the icon, or some other visual |
| 1153 // effects? | 1156 // effects? |
| 1154 } | 1157 } |
| 1155 | 1158 |
| 1156 virtual void DeviceAdded(BluetoothAdapter* adapter, | 1159 virtual void DeviceAdded(BluetoothAdapterDBus* adapter, |
| 1157 BluetoothDevice* device) OVERRIDE { | 1160 BluetoothDeviceDBus* device) OVERRIDE { |
| 1158 NotifyRefreshBluetooth(); | 1161 NotifyRefreshBluetooth(); |
| 1159 } | 1162 } |
| 1160 | 1163 |
| 1161 virtual void DeviceChanged(BluetoothAdapter* adapter, | 1164 virtual void DeviceChanged(BluetoothAdapterDBus* adapter, |
| 1162 BluetoothDevice* device) OVERRIDE { | 1165 BluetoothDeviceDBus* device) OVERRIDE { |
| 1163 NotifyRefreshBluetooth(); | 1166 NotifyRefreshBluetooth(); |
| 1164 } | 1167 } |
| 1165 | 1168 |
| 1166 virtual void DeviceRemoved(BluetoothAdapter* adapter, | 1169 virtual void DeviceRemoved(BluetoothAdapterDBus* adapter, |
| 1167 BluetoothDevice* device) OVERRIDE { | 1170 BluetoothDeviceDBus* device) OVERRIDE { |
| 1168 NotifyRefreshBluetooth(); | 1171 NotifyRefreshBluetooth(); |
| 1169 } | 1172 } |
| 1170 | 1173 |
| 1171 // Overridden from SystemKeyEventListener::CapsLockObserver. | 1174 // Overridden from SystemKeyEventListener::CapsLockObserver. |
| 1172 virtual void OnCapsLockChange(bool enabled) OVERRIDE { | 1175 virtual void OnCapsLockChange(bool enabled) OVERRIDE { |
| 1173 bool search_mapped_to_caps_lock = false; | 1176 bool search_mapped_to_caps_lock = false; |
| 1174 if (!base::chromeos::IsRunningOnChromeOS() || | 1177 if (!base::chromeos::IsRunningOnChromeOS() || |
| 1175 search_key_mapped_to_ == input_method::kCapsLockKey) | 1178 search_key_mapped_to_ == input_method::kCapsLockKey) |
| 1176 search_mapped_to_caps_lock = true; | 1179 search_mapped_to_caps_lock = true; |
| 1177 | 1180 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 scoped_ptr<PrefChangeRegistrar> pref_registrar_; | 1227 scoped_ptr<PrefChangeRegistrar> pref_registrar_; |
| 1225 std::string cellular_device_path_; | 1228 std::string cellular_device_path_; |
| 1226 std::string active_network_path_; | 1229 std::string active_network_path_; |
| 1227 PowerSupplyStatus power_supply_status_; | 1230 PowerSupplyStatus power_supply_status_; |
| 1228 base::HourClockType clock_type_; | 1231 base::HourClockType clock_type_; |
| 1229 int search_key_mapped_to_; | 1232 int search_key_mapped_to_; |
| 1230 bool screen_locked_; | 1233 bool screen_locked_; |
| 1231 ConnectionState connected_network_state_; | 1234 ConnectionState connected_network_state_; |
| 1232 std::string connected_network_path_; | 1235 std::string connected_network_path_; |
| 1233 | 1236 |
| 1234 scoped_refptr<BluetoothAdapter> bluetooth_adapter_; | 1237 scoped_refptr<BluetoothAdapterDBus> bluetooth_adapter_; |
| 1235 | 1238 |
| 1236 BooleanPrefMember accessibility_enabled_; | 1239 BooleanPrefMember accessibility_enabled_; |
| 1237 | 1240 |
| 1238 scoped_ptr<DataPromoNotification> data_promo_notification_; | 1241 scoped_ptr<DataPromoNotification> data_promo_notification_; |
| 1239 | 1242 |
| 1240 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; | 1243 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; |
| 1241 | 1244 |
| 1242 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1245 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 1243 }; | 1246 }; |
| 1244 | 1247 |
| 1245 } // namespace | 1248 } // namespace |
| 1246 | 1249 |
| 1247 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 1250 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
| 1248 return new chromeos::SystemTrayDelegate(tray); | 1251 return new chromeos::SystemTrayDelegate(tray); |
| 1249 } | 1252 } |
| 1250 | 1253 |
| 1251 } // namespace chromeos | 1254 } // namespace chromeos |
| OLD | NEW |