summaryrefslogtreecommitdiffstats
path: root/chromeos/network/shill_property_handler.cc
diff options
context:
space:
mode:
authorfqj <fqj@chromium.org>2015-11-13 12:12:59 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-13 20:14:14 +0000
commitfee5067aaad72d7b0525d23d5f6eb2500831feab (patch)
treeddcfce303fca05ca87b182c857723e10d1847ae6 /chromeos/network/shill_property_handler.cc
parentca1054043bbb319a687bf7214c8d206de53a07c1 (diff)
downloadchromium_src-fee5067aaad72d7b0525d23d5f6eb2500831feab.zip
chromium_src-fee5067aaad72d7b0525d23d5f6eb2500831feab.tar.gz
chromium_src-fee5067aaad72d7b0525d23d5f6eb2500831feab.tar.bz2
Handle prohibited technologies in device policy ONC
This commit changes prohibited technologies from user policy ONC to device policy ONC, and then handles it. The device policy ONC will only take effect after user session starts. After use has logged in, the prohibited technologies in ONC will take effect and disable and prohibit specific technologies. BUG=426390 Review URL: https://codereview.chromium.org/1431563005 Cr-Commit-Position: refs/heads/master@{#359602}
Diffstat (limited to 'chromeos/network/shill_property_handler.cc')
-rw-r--r--chromeos/network/shill_property_handler.cc41
1 files changed, 39 insertions, 2 deletions
diff --git a/chromeos/network/shill_property_handler.cc b/chromeos/network/shill_property_handler.cc
index 02b620d..eb73b83 100644
--- a/chromeos/network/shill_property_handler.cc
+++ b/chromeos/network/shill_property_handler.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/format_macros.h"
#include "base/stl_util.h"
+#include "base/strings/string_util.h"
#include "base/values.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/shill_device_client.h"
@@ -104,8 +105,7 @@ class ShillPropertyObserver : public ShillPropertyChangedObserver {
ShillPropertyHandler::ShillPropertyHandler(Listener* listener)
: listener_(listener),
- shill_manager_(DBusThreadManager::Get()->GetShillManagerClient()) {
-}
+ shill_manager_(DBusThreadManager::Get()->GetShillManagerClient()) {}
ShillPropertyHandler::~ShillPropertyHandler() {
// Delete network service observers.
@@ -153,6 +153,14 @@ void ShillPropertyHandler::SetTechnologyEnabled(
bool enabled,
const network_handler::ErrorCallback& error_callback) {
if (enabled) {
+ if (prohibited_technologies_.find(technology) !=
+ prohibited_technologies_.end()) {
+ chromeos::network_handler::RunErrorCallback(
+ error_callback, "", "prohibited_technologies",
+ "Ignored: Attempt to enable prohibited network technology " +
+ technology);
+ return;
+ }
enabling_technologies_.insert(technology);
shill_manager_->EnableTechnology(
technology, base::Bind(&base::DoNothing),
@@ -169,6 +177,35 @@ void ShillPropertyHandler::SetTechnologyEnabled(
}
}
+void ShillPropertyHandler::SetProhibitedTechnologies(
+ const std::vector<std::string>& prohibited_technologies,
+ const network_handler::ErrorCallback& error_callback) {
+ prohibited_technologies_.clear();
+ prohibited_technologies_.insert(prohibited_technologies.begin(),
+ prohibited_technologies.end());
+
+ // Remove technologies from the other lists.
+ // And manually disable them.
+ for (const auto& technology : prohibited_technologies) {
+ enabling_technologies_.erase(technology);
+ enabled_technologies_.erase(technology);
+ shill_manager_->DisableTechnology(
+ technology, base::Bind(&base::DoNothing),
+ base::Bind(&network_handler::ShillErrorCallbackFunction,
+ "DisableTechnology Failed", technology, error_callback));
+ }
+
+ // Send updated prohibited technology list to shill.
+ const std::string prohibited_list =
+ base::JoinString(prohibited_technologies, ",");
+ base::StringValue value(prohibited_list);
+ shill_manager_->SetProperty(
+ "ProhibitedTechnologies", value, base::Bind(&base::DoNothing),
+ base::Bind(&network_handler::ShillErrorCallbackFunction,
+ "SetTechnologiesProhibited Failed", prohibited_list,
+ error_callback));
+}
+
void ShillPropertyHandler::SetCheckPortalList(
const std::string& check_portal_list) {
base::StringValue value(check_portal_list);