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

Side by Side Diff: device/bluetooth/dbus/fake_bluetooth_media_client.cc

Issue 1347193004: Refactor DBusThreadManager to split away BT clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
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 "chromeos/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 "chromeos/dbus/dbus_thread_manager.h" 10 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
11 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" 11 #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
12 #include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h" 12 #include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h "
13 #include "chromeos/dbus/fake_bluetooth_media_transport_client.h" 13 #include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
14 14
15 using dbus::ObjectPath; 15 using dbus::ObjectPath;
16 16
17 namespace { 17 namespace {
18 18
19 // Except for |kFailedError|, the other error is defined in BlueZ D-Bus Media 19 // Except for |kFailedError|, the other error is defined in BlueZ D-Bus Media
20 // API. 20 // API.
21 const char kFailedError[] = "org.chromium.Error.Failed"; 21 const char kFailedError[] = "org.chromium.Error.Failed";
22 const char kInvalidArgumentsError[] = "org.chromium.Error.InvalidArguments"; 22 const char kInvalidArgumentsError[] = "org.chromium.Error.InvalidArguments";
23 23
24 } // namespace 24 } // namespace
25 25
26 namespace chromeos { 26 namespace bluez {
27 27
28 // static 28 // static
29 const uint8_t FakeBluetoothMediaClient::kDefaultCodec = 0x00; 29 const uint8_t FakeBluetoothMediaClient::kDefaultCodec = 0x00;
30 30
31 FakeBluetoothMediaClient::FakeBluetoothMediaClient() 31 FakeBluetoothMediaClient::FakeBluetoothMediaClient()
32 : visible_(true), 32 : visible_(true),
33 object_path_(ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)) { 33 object_path_(ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)) {}
34 }
35 34
36 FakeBluetoothMediaClient::~FakeBluetoothMediaClient() { 35 FakeBluetoothMediaClient::~FakeBluetoothMediaClient() {}
37 }
38 36
39 void FakeBluetoothMediaClient::Init(dbus::Bus* bus) { 37 void FakeBluetoothMediaClient::Init(dbus::Bus* bus) {}
40 }
41 38
42 void FakeBluetoothMediaClient::AddObserver( 39 void FakeBluetoothMediaClient::AddObserver(
43 BluetoothMediaClient::Observer* observer) { 40 BluetoothMediaClient::Observer* observer) {
44 DCHECK(observer); 41 DCHECK(observer);
45 observers_.AddObserver(observer); 42 observers_.AddObserver(observer);
46 } 43 }
47 44
48 void FakeBluetoothMediaClient::RemoveObserver( 45 void FakeBluetoothMediaClient::RemoveObserver(
49 BluetoothMediaClient::Observer* observer) { 46 BluetoothMediaClient::Observer* observer) {
50 DCHECK(observer); 47 DCHECK(observer);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return; 112 return;
116 } 113 }
117 114
118 if (!IsRegistered(endpoint->object_path())) 115 if (!IsRegistered(endpoint->object_path()))
119 return; 116 return;
120 117
121 // Once a media endpoint object becomes invalid, invalidate the associated 118 // Once a media endpoint object becomes invalid, invalidate the associated
122 // transport. 119 // transport.
123 FakeBluetoothMediaTransportClient* transport = 120 FakeBluetoothMediaTransportClient* transport =
124 static_cast<FakeBluetoothMediaTransportClient*>( 121 static_cast<FakeBluetoothMediaTransportClient*>(
125 DBusThreadManager::Get()->GetBluetoothMediaTransportClient()); 122 bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient());
126 transport->SetValid(endpoint, false); 123 transport->SetValid(endpoint, false);
127 124
128 endpoints_.erase(endpoint->object_path()); 125 endpoints_.erase(endpoint->object_path());
129 endpoint->Released(); 126 endpoint->Released();
130 } 127 }
131 128
132 bool FakeBluetoothMediaClient::IsRegistered( 129 bool FakeBluetoothMediaClient::IsRegistered(
133 const dbus::ObjectPath& endpoint_path) { 130 const dbus::ObjectPath& endpoint_path) {
134 return ContainsKey(endpoints_, endpoint_path); 131 return ContainsKey(endpoints_, endpoint_path);
135 } 132 }
136 133
137 } // namespace chromeos 134 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698