| OLD | NEW |
| 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 "device/bluetooth/dbus/fake_bluetooth_media_client.h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_media_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 10 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (visible_) | 93 if (visible_) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 // If the media object becomes invisible, an update chain will unregister all | 96 // If the media object becomes invisible, an update chain will unregister all |
| 97 // endpoints and set the associated transport objects to be invalid. | 97 // endpoints and set the associated transport objects to be invalid. |
| 98 // SetEndpointRegistered will remove the endpoint entry from |endpoints_|. | 98 // SetEndpointRegistered will remove the endpoint entry from |endpoints_|. |
| 99 while (endpoints_.begin() != endpoints_.end()) | 99 while (endpoints_.begin() != endpoints_.end()) |
| 100 SetEndpointRegistered(endpoints_.begin()->second, false); | 100 SetEndpointRegistered(endpoints_.begin()->second, false); |
| 101 | 101 |
| 102 // Notifies observers about the change on |visible_|. | 102 // Notifies observers about the change on |visible_|. |
| 103 FOR_EACH_OBSERVER(BluetoothMediaClient::Observer, observers_, | 103 for (auto& observer : observers_) |
| 104 MediaRemoved(object_path_)); | 104 observer.MediaRemoved(object_path_); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void FakeBluetoothMediaClient::SetEndpointRegistered( | 107 void FakeBluetoothMediaClient::SetEndpointRegistered( |
| 108 FakeBluetoothMediaEndpointServiceProvider* endpoint, | 108 FakeBluetoothMediaEndpointServiceProvider* endpoint, |
| 109 bool registered) { | 109 bool registered) { |
| 110 if (registered) { | 110 if (registered) { |
| 111 endpoints_[endpoint->object_path()] = endpoint; | 111 endpoints_[endpoint->object_path()] = endpoint; |
| 112 return; | 112 return; |
| 113 } | 113 } |
| 114 | 114 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 125 endpoints_.erase(endpoint->object_path()); | 125 endpoints_.erase(endpoint->object_path()); |
| 126 endpoint->Released(); | 126 endpoint->Released(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool FakeBluetoothMediaClient::IsRegistered( | 129 bool FakeBluetoothMediaClient::IsRegistered( |
| 130 const dbus::ObjectPath& endpoint_path) { | 130 const dbus::ObjectPath& endpoint_path) { |
| 131 return base::ContainsKey(endpoints_, endpoint_path); | 131 return base::ContainsKey(endpoints_, endpoint_path); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace bluez | 134 } // namespace bluez |
| OLD | NEW |