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

Unified Diff: chromeos/dbus/fake_bluetooth_device_client.cc

Issue 14443003: D-Bus: notify properties changed from fakes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/fake_bluetooth_adapter_client.cc ('k') | dbus/property.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_bluetooth_device_client.cc
diff --git a/chromeos/dbus/fake_bluetooth_device_client.cc b/chromeos/dbus/fake_bluetooth_device_client.cc
index 46d4ae3fc935722e48eccbc00893679908963967..f2817d759271426a14dfd1e201bf923815a5fe3d 100644
--- a/chromeos/dbus/fake_bluetooth_device_client.cc
+++ b/chromeos/dbus/fake_bluetooth_device_client.cc
@@ -133,7 +133,6 @@ void FakeBluetoothDeviceClient::Properties::Set(
if (property->name() == trusted.name()) {
callback.Run(true);
property->ReplaceValueWithSetValue();
- NotifyPropertyChanged(property->name());
} else {
callback.Run(false);
}
@@ -224,11 +223,9 @@ void FakeBluetoothDeviceClient::Connect(
// The device can be connected.
properties->connected.ReplaceValue(true);
+ callback.Run();
AddInputDeviceIfNeeded(object_path, properties);
-
- callback.Run();
- properties->NotifyPropertyChanged(properties->connected.name());
}
void FakeBluetoothDeviceClient::Disconnect(
@@ -239,10 +236,8 @@ void FakeBluetoothDeviceClient::Disconnect(
Properties* properties = GetProperties(object_path);
if (properties->connected.value() == true) {
- properties->connected.ReplaceValue(false);
-
callback.Run();
- properties->NotifyPropertyChanged(properties->connected.name());
+ properties->connected.ReplaceValue(false);
} else {
error_callback.Run("org.bluez.Error.NotConnected", "Not Connected");
}
@@ -460,6 +455,10 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() {
properties->adapter.ReplaceValue(
dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ std::vector<std::string> uuids;
+ uuids.push_back("00001124-0000-1000-8000-00805f9b34fb");
+ properties->uuids.ReplaceValue(uuids);
+
properties_map_[dbus::ObjectPath(kAppleMousePath)] = properties;
device_list_.push_back(dbus::ObjectPath(kAppleMousePath));
FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_,
@@ -480,6 +479,10 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() {
properties->adapter.ReplaceValue(
dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ std::vector<std::string> uuids;
+ uuids.push_back("00001124-0000-1000-8000-00805f9b34fb");
+ properties->uuids.ReplaceValue(uuids);
+
properties_map_[dbus::ObjectPath(kAppleKeyboardPath)] = properties;
device_list_.push_back(dbus::ObjectPath(kAppleKeyboardPath));
FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_,
@@ -521,6 +524,10 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() {
properties->adapter.ReplaceValue(
dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ std::vector<std::string> uuids;
+ uuids.push_back("00001124-0000-1000-8000-00805f9b34fb");
+ properties->uuids.ReplaceValue(uuids);
+
properties_map_[dbus::ObjectPath(kMicrosoftMousePath)] = properties;
device_list_.push_back(dbus::ObjectPath(kMicrosoftMousePath));
FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_,
@@ -542,6 +549,10 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() {
properties->adapter.ReplaceValue(
dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ std::vector<std::string> uuids;
+ uuids.push_back("00001124-0000-1000-8000-00805f9b34fb");
+ properties->uuids.ReplaceValue(uuids);
+
properties_map_[dbus::ObjectPath(kMotorolaKeyboardPath)] = properties;
device_list_.push_back(dbus::ObjectPath(kMotorolaKeyboardPath));
FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_,
@@ -639,11 +650,9 @@ void FakeBluetoothDeviceClient::CompleteSimulatedPairing(
Properties* properties = GetProperties(object_path);
properties->paired.ReplaceValue(true);
+ callback.Run();
AddInputDeviceIfNeeded(object_path, properties);
-
- callback.Run();
- properties->NotifyPropertyChanged(properties->paired.name());
}
}
@@ -683,15 +692,8 @@ void FakeBluetoothDeviceClient::AddInputDeviceIfNeeded(
static_cast<FakeBluetoothInputClient*>(
DBusThreadManager::Get()->GetExperimentalBluetoothInputClient());
- if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500) {
- std::vector<std::string> uuids = properties->uuids.value();
- if (std::find(uuids.begin(), uuids.end(),
- "00001124-0000-1000-8000-00805f9b34fb") == uuids.end()) {
- uuids.push_back("00001124-0000-1000-8000-00805f9b34fb");
- properties->uuids.ReplaceValue(uuids);
- fake_bluetooth_input_client->AddInputDevice(object_path);
- }
- }
+ if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500)
+ fake_bluetooth_input_client->AddInputDevice(object_path);
}
void FakeBluetoothDeviceClient::PinCodeCallback(
« no previous file with comments | « chromeos/dbus/fake_bluetooth_adapter_client.cc ('k') | dbus/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698