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

Unified Diff: chromeos/dbus/shill_manager_client.cc

Issue 11887008: Deprecate ShillNetworkClient and add GeolocationHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittest Created 7 years, 11 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
Index: chromeos/dbus/shill_manager_client.cc
diff --git a/chromeos/dbus/shill_manager_client.cc b/chromeos/dbus/shill_manager_client.cc
index 6b946a1f76055d54c5d6cdd00cab5beb482ec6ed..38ff9baac41672b21e8e62b7fb87faf11abd06b9 100644
--- a/chromeos/dbus/shill_manager_client.cc
+++ b/chromeos/dbus/shill_manager_client.cc
@@ -82,6 +82,13 @@ class ShillManagerClientImpl : public ShillManagerClient {
return helper_.CallDictionaryValueMethodAndBlock(&method_call);
}
+ virtual void GetNetworksForGeolocation(
+ const DictionaryValueCallback& callback) OVERRIDE {
+ dbus::MethodCall method_call(flimflam::kFlimflamManagerInterface,
+ shill::kGetNetworksForGeolocation);
+ helper_.CallDictionaryValueMethod(&method_call, callback);
+ }
+
virtual void SetProperty(const std::string& name,
const base::Value& value,
const base::Closure& callback,
@@ -221,6 +228,17 @@ class ShillManagerClientStubImpl : public ShillManagerClient,
return stub_properties_.DeepCopy();
}
+ virtual void GetNetworksForGeolocation(
+ const DictionaryValueCallback& callback) OVERRIDE {
+ if (callback.is_null())
+ return;
+ MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(
+ &ShillManagerClientStubImpl::PassStubGeoNetworks,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback));
+ }
+
virtual void SetProperty(const std::string& name,
const base::Value& value,
const base::Closure& callback,
@@ -328,6 +346,10 @@ class ShillManagerClientStubImpl : public ShillManagerClient,
}
}
+ virtual void ResetDevices() OVERRIDE {
+ stub_properties_.Remove(flimflam::kDevicesProperty, NULL);
+ }
+
virtual void AddService(const std::string& service_path,
bool add_to_watch_list) OVERRIDE {
if (GetListProperty(flimflam::kServicesProperty)->AppendIfNotPresent(
@@ -401,6 +423,17 @@ class ShillManagerClientStubImpl : public ShillManagerClient,
stub_properties_.Clear();
}
+ virtual void AddGeoNetwork(const std::string& technology,
+ const base::DictionaryValue& network) OVERRIDE {
+ base::ListValue* list_value = NULL;
+ if (!stub_geo_networks_.GetListWithoutPathExpansion(
+ technology, &list_value)) {
+ list_value = new base::ListValue;
+ stub_geo_networks_.Set(technology, list_value);
+ }
+ list_value->Append(network.DeepCopy());
+ }
+
private:
void AddServiceToWatchList(const std::string& service_path) {
if (GetListProperty(
@@ -432,6 +465,10 @@ class ShillManagerClientStubImpl : public ShillManagerClient,
callback.Run(DBUS_METHOD_CALL_SUCCESS, stub_properties_);
}
+ void PassStubGeoNetworks(const DictionaryValueCallback& callback) const {
+ callback.Run(DBUS_METHOD_CALL_SUCCESS, stub_geo_networks_);
+ }
+
void CallNotifyObserversPropertyChanged(const std::string& property,
int delay_ms) {
// Avoid unnecessary delayed task if we have no observers (e.g. during
@@ -467,7 +504,11 @@ class ShillManagerClientStubImpl : public ShillManagerClient,
return list_property;
}
+ // Dictionary of property name -> property value
base::DictionaryValue stub_properties_;
+ // Dictionary of technology -> list of property dictionaries
+ base::DictionaryValue stub_geo_networks_;
+
ObserverList<ShillPropertyChangedObserver> observer_list_;
// Note: This should remain the last member so it'll be destroyed and

Powered by Google App Engine
This is Rietveld 408576698