summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-24 05:24:25 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-24 05:24:25 +0000
commitd9b99bf3a00997278a7abf18ff160e910649fac6 (patch)
tree6b9aae126aaea006f7013d920a46297dae50f960 /chromeos
parent594ad2cd145722e45dfc3db0acd004961d6afade (diff)
downloadchromium_src-d9b99bf3a00997278a7abf18ff160e910649fac6.zip
chromium_src-d9b99bf3a00997278a7abf18ff160e910649fac6.tar.gz
chromium_src-d9b99bf3a00997278a7abf18ff160e910649fac6.tar.bz2
Disable network in demo mode.
R=stevenjb@chromium.org BUG=358978 TEST=Wrote a custom demo app and tested on the device to ensure that after the patch, the app could no longer access the network. Review URL: https://codereview.chromium.org/248043004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265862 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/network/network_state_handler.cc35
-rw-r--r--chromeos/network/network_state_handler.h8
2 files changed, 37 insertions, 6 deletions
diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc
index d754bbb..8e906ea 100644
--- a/chromeos/network/network_state_handler.cc
+++ b/chromeos/network/network_state_handler.cc
@@ -127,11 +127,16 @@ void NetworkStateHandler::SetTechnologyEnabled(
const NetworkTypePattern& type,
bool enabled,
const network_handler::ErrorCallback& error_callback) {
- std::string technology = GetTechnologyForType(type);
- NET_LOG_USER("SetTechnologyEnabled",
- base::StringPrintf("%s:%d", technology.c_str(), enabled));
- shill_property_handler_->SetTechnologyEnabled(
- technology, enabled, error_callback);
+ ScopedVector<std::string> technologies = GetTechnologiesForType(type);
+ for (ScopedVector<std::string>::iterator it = technologies.begin();
+ it != technologies.end(); ++it) {
+ std::string* technology = *it;
+ DCHECK(technology);
+ NET_LOG_USER("SetTechnologyEnabled",
+ base::StringPrintf("%s:%d", technology->c_str(), enabled));
+ shill_property_handler_->SetTechnologyEnabled(
+ *technology, enabled, error_callback);
+ }
// Signal Device/Technology state changed.
NotifyDeviceListChanged();
}
@@ -835,4 +840,24 @@ std::string NetworkStateHandler::GetTechnologyForType(
return std::string();
}
+ScopedVector<std::string> NetworkStateHandler::GetTechnologiesForType(
+ const NetworkTypePattern& type) const {
+ ScopedVector<std::string> technologies;
+ if (type.MatchesType(shill::kTypeEthernet))
+ technologies.push_back(new std::string(shill::kTypeEthernet));
+ if (type.MatchesType(shill::kTypeWifi))
+ technologies.push_back(new std::string(shill::kTypeWifi));
+ if (type.MatchesType(shill::kTypeWimax))
+ technologies.push_back(new std::string(shill::kTypeWimax));
+ if (type.MatchesType(shill::kTypeCellular))
+ technologies.push_back(new std::string(shill::kTypeCellular));
+ if (type.MatchesType(shill::kTypeBluetooth))
+ technologies.push_back(new std::string(shill::kTypeBluetooth));
+ if (type.MatchesType(shill::kTypeVPN))
+ technologies.push_back(new std::string(shill::kTypeVPN));
+
+ CHECK_GT(technologies.size(), 0ul);
+ return technologies.Pass();
+}
+
} // namespace chromeos
diff --git a/chromeos/network/network_state_handler.h b/chromeos/network/network_state_handler.h
index 2c4e621..72d4029 100644
--- a/chromeos/network/network_state_handler.h
+++ b/chromeos/network/network_state_handler.h
@@ -13,6 +13,7 @@
#include "base/callback_forward.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "base/observer_list.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/network/managed_state.h"
@@ -327,9 +328,14 @@ class CHROMEOS_EXPORT NetworkStateHandler
// Called whenever Device.Scanning state transitions to false.
void ScanCompleted(const std::string& type);
- // Returns the technology type for |type|.
+ // Returns one technology type for |type|. This technology will be the
+ // highest priority technology in the type pattern.
std::string GetTechnologyForType(const NetworkTypePattern& type) const;
+ // Returns all the technology types for |type|.
+ ScopedVector<std::string> GetTechnologiesForType(
+ const NetworkTypePattern& type) const;
+
// Shill property handler instance, owned by this class.
scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_;