summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-10 09:40:02 +0000
committerpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-10 09:40:02 +0000
commit5870d1ae70463c18c591fb3e61c3363a9814fb83 (patch)
tree222bb489662456cfa334d13947b9d7a7b752fa61 /chromeos
parent6bd746e57edf3f03ca5ee2b999f7c4e3ce840ea4 (diff)
downloadchromium_src-5870d1ae70463c18c591fb3e61c3363a9814fb83.zip
chromium_src-5870d1ae70463c18c591fb3e61c3363a9814fb83.tar.gz
chromium_src-5870d1ae70463c18c591fb3e61c3363a9814fb83.tar.bz2
Changes the networkingPrivate Extension API to use
the NetworkStateHandler and ManagedNetworkConfigurationHandler instead of talking to the Shill*Client classes directly. This removes nearly all dependencies to Shill (except the VerifyAndSign functions) from the API implementation. BUG=147614, 157696 Review URL: https://chromiumcodereview.appspot.com/12319145 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187202 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/chromeos_switches.cc7
-rw-r--r--chromeos/chromeos_switches.h2
-rw-r--r--chromeos/dbus/shill_service_client_stub.cc23
-rw-r--r--chromeos/network/network_state.cc25
-rw-r--r--chromeos/network/network_state.h10
5 files changed, 56 insertions, 11 deletions
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc
index 2e34b96..49368b6 100644
--- a/chromeos/chromeos_switches.cc
+++ b/chromeos/chromeos_switches.cc
@@ -27,9 +27,10 @@ const char kEnableLocallyManagedUserUIExperiments[] =
const char kEnableNewNetworkChangeNotifier[] =
"enable-new-network-change-notifier";
-// Enables the new NetworkConfigurationHandler class.
-const char kEnableNewNetworkConfigurationHandlers[] =
- "enable-new-network-configuration-handlers";
+// Enables usage of the new ManagedNetworkConfigurationHandler and
+// NetworkConfigurationHandler singletons.
+const char kUseNewNetworkConfigurationHandlers[] =
+ "use-new-network-configuration-handlers";
// Enables screensaver extensions.
const char kEnableScreensaverExtensions[] = "enable-screensaver-extensions";
diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h
index 646bc1f..8c85bb7 100644
--- a/chromeos/chromeos_switches.h
+++ b/chromeos/chromeos_switches.h
@@ -26,7 +26,7 @@ CHROMEOS_EXPORT extern const char kDisableStubEthernet[];
CHROMEOS_EXPORT extern const char kEnableExperimentalBluetooth[];
CHROMEOS_EXPORT extern const char kEnableLocallyManagedUserUIExperiments[];
CHROMEOS_EXPORT extern const char kEnableNewNetworkChangeNotifier[];
-CHROMEOS_EXPORT extern const char kEnableNewNetworkConfigurationHandlers[];
+CHROMEOS_EXPORT extern const char kUseNewNetworkConfigurationHandlers[];
CHROMEOS_EXPORT extern const char kEnableScreensaverExtensions[];
CHROMEOS_EXPORT extern const char kEnableStubInteractive[];
CHROMEOS_EXPORT extern const char kSmsTestMessages[];
diff --git a/chromeos/dbus/shill_service_client_stub.cc b/chromeos/dbus/shill_service_client_stub.cc
index 8268619..0a380bc 100644
--- a/chromeos/dbus/shill_service_client_stub.cc
+++ b/chromeos/dbus/shill_service_client_stub.cc
@@ -78,7 +78,7 @@ void ShillServiceClientStub::SetProperty(const dbus::ObjectPath& service_path,
base::DictionaryValue* dict = NULL;
if (!stub_services_.GetDictionaryWithoutPathExpansion(
service_path.value(), &dict)) {
- error_callback.Run("StubError", "Service not found");
+ error_callback.Run("Error.InvalidService", "Invalid Service");
return;
}
if (name == flimflam::kStateProperty) {
@@ -111,7 +111,7 @@ void ShillServiceClientStub::ClearProperty(
base::DictionaryValue* dict = NULL;
if (!stub_services_.GetDictionaryWithoutPathExpansion(
service_path.value(), &dict)) {
- error_callback.Run("StubError", "Service not found");
+ error_callback.Run("Error.InvalidService", "Invalid Service");
return;
}
dict->Remove(name, NULL);
@@ -132,7 +132,7 @@ void ShillServiceClientStub::ClearProperties(
base::DictionaryValue* dict = NULL;
if (!stub_services_.GetDictionaryWithoutPathExpansion(
service_path.value(), &dict)) {
- error_callback.Run("StubError", "Service not found");
+ error_callback.Run("Error.InvalidService", "Invalid Service");
return;
}
scoped_ptr<base::ListValue> results(new base::ListValue);
@@ -189,6 +189,11 @@ void ShillServiceClientStub::Connect(const dbus::ObjectPath& service_path,
void ShillServiceClientStub::Disconnect(const dbus::ObjectPath& service_path,
const base::Closure& callback,
const ErrorCallback& error_callback) {
+ base::Value* service;
+ if (!stub_services_.Get(service_path.value(), &service)) {
+ error_callback.Run("Error.InvalidService", "Invalid Service");
+ return;
+ }
// Set Idle after a delay
const int kConnectDelaySeconds = 2;
base::StringValue idle_value(flimflam::kStateIdle);
@@ -312,15 +317,17 @@ void ShillServiceClientStub::SetDefaultProperties() {
flimflam::kTypeWifi,
flimflam::kStateOnline,
add_to_watchlist);
+ SetServiceProperty("stub_wifi1",
+ flimflam::kSecurityProperty,
+ base::StringValue(flimflam::kSecurityWep));
AddService("stub_wifi2", "wifi2_PSK",
flimflam::kTypeWifi,
flimflam::kStateIdle,
add_to_watchlist);
- base::StringValue psk_value(flimflam::kSecurityPsk);
SetServiceProperty("stub_wifi2",
flimflam::kSecurityProperty,
- psk_value);
+ base::StringValue(flimflam::kSecurityPsk));
base::FundamentalValue strength_value(80);
SetServiceProperty("stub_wifi2",
flimflam::kSignalStrengthProperty,
@@ -334,10 +341,12 @@ void ShillServiceClientStub::SetDefaultProperties() {
SetServiceProperty("stub_cellular1",
flimflam::kNetworkTechnologyProperty,
technology_value);
- base::StringValue activation_value(flimflam::kActivationStateActivated);
SetServiceProperty("stub_cellular1",
flimflam::kActivationStateProperty,
- activation_value);
+ base::StringValue(flimflam::kActivationStateNotActivated));
+ SetServiceProperty("stub_cellular1",
+ flimflam::kRoamingStateProperty,
+ base::StringValue(flimflam::kRoamingStateHome));
AddService("stub_vpn1", "vpn1",
flimflam::kTypeVPN,
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc
index bbe698a..d16084d 100644
--- a/chromeos/network/network_state.cc
+++ b/chromeos/network/network_state.cc
@@ -19,6 +19,7 @@ NetworkState::~NetworkState() {
bool NetworkState::PropertyChanged(const std::string& key,
const base::Value& value) {
+ // Keep care that these properties are the same as in |GetProperties|.
if (ManagedStatePropertyChanged(key, value))
return true;
if (key == flimflam::kSignalStrengthProperty) {
@@ -43,6 +44,30 @@ bool NetworkState::PropertyChanged(const std::string& key,
return false;
}
+void NetworkState::GetProperties(base::DictionaryValue* dictionary) const {
+ // Keep care that these properties are the same as in |PropertyChanged|.
+ dictionary->SetStringWithoutPathExpansion(flimflam::kNameProperty, name());
+ dictionary->SetStringWithoutPathExpansion(flimflam::kTypeProperty, type());
+ dictionary->SetIntegerWithoutPathExpansion(flimflam::kSignalStrengthProperty,
+ signal_strength());
+ dictionary->SetStringWithoutPathExpansion(flimflam::kStateProperty,
+ connection_state());
+ dictionary->SetStringWithoutPathExpansion(flimflam::kErrorProperty,
+ error());
+ dictionary->SetStringWithoutPathExpansion(flimflam::kActivationStateProperty,
+ activation_state());
+ dictionary->SetStringWithoutPathExpansion(flimflam::kRoamingStateProperty,
+ roaming());
+ dictionary->SetStringWithoutPathExpansion(flimflam::kSecurityProperty,
+ security());
+ dictionary->SetStringWithoutPathExpansion(
+ flimflam::kNetworkTechnologyProperty,
+ technology());
+ dictionary->SetStringWithoutPathExpansion(flimflam::kDeviceProperty,
+ device_path());
+ dictionary->SetStringWithoutPathExpansion(flimflam::kGuidProperty, guid());
+}
+
bool NetworkState::IsConnectedState() const {
return StateIsConnected(connection_state_);
}
diff --git a/chromeos/network/network_state.h b/chromeos/network/network_state.h
index 3f64a07..99a8a28 100644
--- a/chromeos/network/network_state.h
+++ b/chromeos/network/network_state.h
@@ -7,6 +7,10 @@
#include "chromeos/network/managed_state.h"
+namespace base {
+class DictionaryValue;
+}
+
namespace chromeos {
// Simple class to provide network state information about a network service.
@@ -20,9 +24,15 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
virtual ~NetworkState();
// ManagedState overrides
+ // If you change this method, update GetProperties too.
virtual bool PropertyChanged(const std::string& key,
const base::Value& value) OVERRIDE;
+ // Fills |dictionary| with the state properties. All the properties that are
+ // accepted by PropertyChanged are stored in |dictionary|, no other values are
+ // stored.
+ void GetProperties(base::DictionaryValue* dictionary) const;
+
// Accessors
const std::string& security() const { return security_; }
const std::string& ip_address() const { return ip_address_; }