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

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: Fix, sync. 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
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 5060650f702187dc3a5680517a2e929c18f40299..61318c2b01a07d5b9932dc0de0a9b49dd6620a2b 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);
oshima 2013/08/07 16:01:12 nit: nuke ()
ygorshenin1 2013/08/08 08:05:57 Done.
+}
+
// ShillServiceClient overrides.
void ShillServiceClientStub::AddPropertyChangedObserver(
@@ -190,7 +203,9 @@ void ShillServiceClientStub::Connect(const dbus::ObjectPath& service_path,
const int kConnectDelaySeconds = 5;
delay = base::TimeDelta::FromSeconds(kConnectDelaySeconds);
}
- base::StringValue online_value(flimflam::kStateOnline);
+ base::StringValue online_value(
+ service_path.value() == kStubPortalledWifiPath ?
+ flimflam::kStatePortal : flimflam::kStateOnline);
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&ShillServiceClientStub::SetProperty,
@@ -301,7 +316,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)) {
oshima 2013/08/07 16:01:12 nit: indent like this CommandLine::ForCurrentProc
ygorshenin1 2013/08/08 08:05:57 Done.
+ nstate = flimflam::kStateIdle;
+ }
+ AddServiceWithIPConfig(service_path, name, type, nstate, "",
add_to_visible_list, add_to_watch_list);
}
@@ -435,6 +455,17 @@ void ShillServiceClientStub::AddDefaultServices() {
flimflam::kSignalStrengthProperty,
strength_value);
+ if (CommandLine::ForCurrentProcess()->
+ HasSwitch(chromeos::switches::kEnableStubPortalledWifi)) {
oshima 2013/08/07 16:01:12 ditto
ygorshenin1 2013/08/08 08:05:57 Done.
+ 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",

Powered by Google App Engine
This is Rietveld 408576698