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

Unified Diff: chromeos/dbus/shill_service_client_stub.cc

Issue 22364005: Added stub portalled wifi network. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: IsStubPortalledWifiEnabled() is exported. Created 7 years, 4 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/shill_service_client_stub.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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",
« no previous file with comments | « chromeos/dbus/shill_service_client_stub.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698