| 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/power/peripheral_battery_observer.h" | 5 #include "chrome/browser/chromeos/power/peripheral_battery_observer.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 void PeripheralBatteryObserver::DeviceRemoved(device::BluetoothAdapter* adapter, | 175 void PeripheralBatteryObserver::DeviceRemoved(device::BluetoothAdapter* adapter, |
| 176 device::BluetoothDevice* device) { | 176 device::BluetoothDevice* device) { |
| 177 RemoveBattery(device->GetAddress()); | 177 RemoveBattery(device->GetAddress()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void PeripheralBatteryObserver::InitializeOnBluetoothReady( | 180 void PeripheralBatteryObserver::InitializeOnBluetoothReady( |
| 181 scoped_refptr<device::BluetoothAdapter> adapter) { | 181 scoped_refptr<device::BluetoothAdapter> adapter) { |
| 182 bluetooth_adapter_ = adapter; | 182 bluetooth_adapter_ = adapter; |
| 183 CHECK(bluetooth_adapter_); | 183 CHECK(bluetooth_adapter_.get()); |
| 184 bluetooth_adapter_->AddObserver(this); | 184 bluetooth_adapter_->AddObserver(this); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void PeripheralBatteryObserver::RemoveBattery(const std::string& address) { | 187 void PeripheralBatteryObserver::RemoveBattery(const std::string& address) { |
| 188 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 188 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 189 std::string address_lowercase = address; | 189 std::string address_lowercase = address; |
| 190 StringToLowerASCII(&address_lowercase); | 190 StringToLowerASCII(&address_lowercase); |
| 191 std::map<std::string, BatteryInfo>::iterator it = | 191 std::map<std::string, BatteryInfo>::iterator it = |
| 192 batteries_.find(address_lowercase); | 192 batteries_.find(address_lowercase); |
| 193 if (it != batteries_.end()) { | 193 if (it != batteries_.end()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 ProfileManager::GetDefaultProfileOrOffTheRecord()); | 230 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 231 | 231 |
| 232 return true; | 232 return true; |
| 233 } | 233 } |
| 234 | 234 |
| 235 void PeripheralBatteryObserver::CancelNotification(const std::string& address) { | 235 void PeripheralBatteryObserver::CancelNotification(const std::string& address) { |
| 236 g_browser_process->notification_ui_manager()->CancelById(address); | 236 g_browser_process->notification_ui_manager()->CancelById(address); |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace chromeos | 239 } // namespace chromeos |
| OLD | NEW |