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

Side by Side Diff: chromeos/dbus/bluetooth_property.cc

Issue 10698027: dbus: move logic from Property<> to PropertySet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing overrides for clang Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/bluetooth_property.h ('k') | dbus/property.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chromeos/dbus/bluetooth_property.h" 5 #include "chromeos/dbus/bluetooth_property.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "dbus/message.h" 8 #include "dbus/message.h"
9 #include "dbus/object_proxy.h" 9 #include "dbus/object_proxy.h"
10 #include "third_party/cros_system_api/dbus/service_constants.h" 10 #include "third_party/cros_system_api/dbus/service_constants.h"
(...skipping 10 matching lines...) Expand all
21 base::Bind(&dbus::PropertySet::ChangedConnected, GetWeakPtr())); 21 base::Bind(&dbus::PropertySet::ChangedConnected, GetWeakPtr()));
22 } 22 }
23 23
24 void BluetoothPropertySet::ChangedReceived(dbus::Signal* signal) { 24 void BluetoothPropertySet::ChangedReceived(dbus::Signal* signal) {
25 DCHECK(signal); 25 DCHECK(signal);
26 26
27 dbus::MessageReader reader(signal); 27 dbus::MessageReader reader(signal);
28 UpdatePropertyFromReader(&reader); 28 UpdatePropertyFromReader(&reader);
29 } 29 }
30 30
31 void BluetoothPropertySet::Get(dbus::PropertyBase* property,
32 GetCallback callback) {
33 NOTREACHED() << "BlueZ does not implement Get for properties";
34 }
35
31 void BluetoothPropertySet::GetAll() { 36 void BluetoothPropertySet::GetAll() {
32 dbus::MethodCall method_call(interface(), 37 dbus::MethodCall method_call(interface(),
33 bluetooth_common::kGetProperties); 38 bluetooth_common::kGetProperties);
34 39
35 dbus::ObjectProxy* object_proxy = this->object_proxy(); 40 dbus::ObjectProxy* object_proxy = this->object_proxy();
36 DCHECK(object_proxy); 41 DCHECK(object_proxy);
37 object_proxy->CallMethod(&method_call, 42 object_proxy->CallMethod(&method_call,
38 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 43 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
39 base::Bind(&dbus::PropertySet::OnGetAll, 44 base::Bind(&dbus::PropertySet::OnGetAll,
40 GetWeakPtr())); 45 GetWeakPtr()));
41 } 46 }
42 47
48 void BluetoothPropertySet::Set(dbus::PropertyBase* property,
49 SetCallback callback) {
50 dbus::MethodCall method_call(interface(),
51 bluetooth_common::kSetProperty);
52 dbus::MessageWriter writer(&method_call);
53 writer.AppendString(property->name());
54 property->AppendSetValueToWriter(&writer);
55
56 dbus::ObjectProxy *object_proxy = this->object_proxy();
57 DCHECK(object_proxy);
58 object_proxy->CallMethod(&method_call,
59 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
60 base::Bind(&dbus::PropertySet::OnSet,
61 this->GetWeakPtr(),
62 property,
63 callback));
64 }
65
43 } // namespace chromeos 66 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/bluetooth_property.h ('k') | dbus/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698