Index: chromeos/dbus/shill_service_client_stub.cc |
diff --git a/chromeos/dbus/shill_service_client_stub.cc b/chromeos/dbus/shill_service_client_stub.cc |
index 03d7b75d7458752aa06e33a32779a17658258f0d..0f0e21522f1ae43aaf6720717e0dfe89324a0646 100644 |
--- a/chromeos/dbus/shill_service_client_stub.cc |
+++ b/chromeos/dbus/shill_service_client_stub.cc |
@@ -24,6 +24,9 @@ namespace chromeos { |
namespace { |
+const char kStubPortalledWifiPath[] = "portalled_wifi"; |
+const char kStubPortalledWifiName[] = "Portalled Wifi"; |
+ |
void ErrorFunction(const std::string& error_name, |
const std::string& error_message) { |
LOG(ERROR) << "Shill Error: " << error_name << " : " << error_message; |
@@ -51,6 +54,16 @@ ShillServiceClientStub::~ShillServiceClientStub() { |
observer_list_.begin(), observer_list_.end()); |
} |
+// static |
+bool ShillServiceClientStub::IsStubPortalledWifiEnabled( |
+ const std::string& path) { |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch( |
+ chromeos::switches::kEnableStubPortalledWifi)) { |
+ return false; |
+ } |
+ return path == kStubPortalledWifiPath; |
+} |
+ |
// ShillServiceClient overrides. |
void ShillServiceClientStub::AddPropertyChangedObserver( |
@@ -192,6 +205,8 @@ void ShillServiceClientStub::Connect(const dbus::ObjectPath& service_path, |
delay = base::TimeDelta::FromSeconds(kConnectDelaySeconds); |
} |
base::StringValue online_value(flimflam::kStateOnline); |
+ if (service_path.value() == kStubPortalledWifiPath) |
+ online_value = base::StringValue(flimflam::kStatePortal); |
std::string passphrase; |
service_properties->GetStringWithoutPathExpansion( |
flimflam::kPassphraseProperty, &passphrase); |
@@ -320,7 +335,12 @@ void ShillServiceClientStub::AddService(const std::string& service_path, |
const std::string& state, |
bool add_to_visible_list, |
bool add_to_watch_list) { |
- AddServiceWithIPConfig(service_path, name, type, state, "", |
+ std::string nstate = state; |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ chromeos::switches::kDefaultStubNetworkStateIdle)) { |
+ nstate = flimflam::kStateIdle; |
+ } |
+ AddServiceWithIPConfig(service_path, name, type, nstate, "", |
add_to_visible_list, add_to_watch_list); |
} |
@@ -454,6 +474,17 @@ void ShillServiceClientStub::AddDefaultServices() { |
flimflam::kSignalStrengthProperty, |
strength_value); |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ chromeos::switches::kEnableStubPortalledWifi)) { |
+ AddService(kStubPortalledWifiPath, kStubPortalledWifiName, |
+ flimflam::kTypeWifi, |
+ flimflam::kStatePortal, |
+ add_to_visible, add_to_watchlist); |
+ SetServiceProperty(kStubPortalledWifiPath, |
+ flimflam::kSecurityProperty, |
+ base::StringValue(flimflam::kSecurityNone)); |
+ } |
+ |
// Wimax |
AddService("wimax1", "wimax1", |