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 "device/bluetooth/bluetooth_adapter_chromeos.h" | 5 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 RemoveObserver(this); | 44 RemoveObserver(this); |
45 DBusThreadManager::Get()->GetBluetoothManagerClient()-> | 45 DBusThreadManager::Get()->GetBluetoothManagerClient()-> |
46 RemoveObserver(this); | 46 RemoveObserver(this); |
47 | 47 |
48 STLDeleteValues(&devices_); | 48 STLDeleteValues(&devices_); |
49 } | 49 } |
50 | 50 |
51 void BluetoothAdapterChromeOs::AddObserver( | 51 void BluetoothAdapterChromeOs::AddObserver( |
52 BluetoothAdapter::Observer* observer) { | 52 BluetoothAdapter::Observer* observer) { |
53 DCHECK(observer); | 53 DCHECK(observer); |
54 observers_.AddObserver(observer); | 54 if (!observers_.HasObserver(observer)) |
miket_OOO
2012/11/06 02:04:09
Aha. Would it make sense to move this check into G
youngki
2012/11/06 16:18:54
Done. Reverted this file and this check is now don
| |
55 observers_.AddObserver(observer); | |
55 } | 56 } |
56 | 57 |
57 void BluetoothAdapterChromeOs::RemoveObserver( | 58 void BluetoothAdapterChromeOs::RemoveObserver( |
58 BluetoothAdapter::Observer* observer) { | 59 BluetoothAdapter::Observer* observer) { |
59 DCHECK(observer); | 60 DCHECK(observer); |
60 observers_.RemoveObserver(observer); | 61 observers_.RemoveObserver(observer); |
61 } | 62 } |
62 | 63 |
63 bool BluetoothAdapterChromeOs::IsPresent() const { | 64 bool BluetoothAdapterChromeOs::IsPresent() const { |
64 return !object_path_.value().empty() && !address_.empty(); | 65 return !object_path_.value().empty() && !address_.empty(); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 DVLOG(1) << "Paired device " << device->address() | 531 DVLOG(1) << "Paired device " << device->address() |
531 << " is no longer visible to the adapter"; | 532 << " is no longer visible to the adapter"; |
532 device->SetVisible(false); | 533 device->SetVisible(false); |
533 | 534 |
534 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, | 535 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
535 DeviceChanged(this, device)); | 536 DeviceChanged(this, device)); |
536 } | 537 } |
537 } | 538 } |
538 | 539 |
539 } // namespace chromeos | 540 } // namespace chromeos |
OLD | NEW |