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

Side by Side Diff: chromeos/network/shill_property_handler.cc

Issue 2364703002: Add network throttling as an enterprise policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add network bandwidth throttling as an enterprise policy Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/network/shill_property_handler.h" 5 #include "chromeos/network/shill_property_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
Andrew T Wilson (Slow) 2016/10/21 13:27:31 You don't seem to have added any code that require
stevenjb 2016/10/21 19:41:21 <memory> is in the header so we don't need to repe
kirtika1 2016/10/23 00:04:49 Done.
9 #include <sstream> 10 #include <sstream>
11 #include <utility>
10 12
11 #include "base/bind.h" 13 #include "base/bind.h"
12 #include "base/format_macros.h" 14 #include "base/format_macros.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
15 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
16 #include "base/values.h" 18 #include "base/values.h"
17 #include "chromeos/dbus/dbus_thread_manager.h" 19 #include "chromeos/dbus/dbus_thread_manager.h"
18 #include "chromeos/dbus/shill_device_client.h" 20 #include "chromeos/dbus/shill_device_client.h"
19 #include "chromeos/dbus/shill_ipconfig_client.h" 21 #include "chromeos/dbus/shill_ipconfig_client.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 224
223 void ShillPropertyHandler::SetWakeOnLanEnabled(bool enabled) { 225 void ShillPropertyHandler::SetWakeOnLanEnabled(bool enabled) {
224 base::FundamentalValue value(enabled); 226 base::FundamentalValue value(enabled);
225 shill_manager_->SetProperty( 227 shill_manager_->SetProperty(
226 shill::kWakeOnLanEnabledProperty, value, base::Bind(&base::DoNothing), 228 shill::kWakeOnLanEnabledProperty, value, base::Bind(&base::DoNothing),
227 base::Bind(&network_handler::ShillErrorCallbackFunction, 229 base::Bind(&network_handler::ShillErrorCallbackFunction,
228 "SetWakeOnLanEnabled Failed", "Manager", 230 "SetWakeOnLanEnabled Failed", "Manager",
229 network_handler::ErrorCallback())); 231 network_handler::ErrorCallback()));
230 } 232 }
231 233
234 void ShillPropertyHandler::SetNetworkThrottlingStatus(
235 bool throttling_enabled,
236 uint32_t upload_rate_kbits,
237 uint32_t download_rate_kbits) {
238 shill_manager_->SetNetworkThrottlingStatus(
239 throttling_enabled, upload_rate_kbits, download_rate_kbits,
240 base::Bind(&base::DoNothing),
241 base::Bind(&network_handler::ShillErrorCallbackFunction,
242 "SetNetworkThrottlingStatus failed", "Manager",
243 network_handler::ErrorCallback()));
244 }
245
232 void ShillPropertyHandler::RequestScan() const { 246 void ShillPropertyHandler::RequestScan() const {
233 shill_manager_->RequestScan( 247 shill_manager_->RequestScan(
234 "", base::Bind(&base::DoNothing), 248 "", base::Bind(&base::DoNothing),
235 base::Bind(&network_handler::ShillErrorCallbackFunction, 249 base::Bind(&network_handler::ShillErrorCallbackFunction,
236 "RequestScan Failed", "", network_handler::ErrorCallback())); 250 "RequestScan Failed", "", network_handler::ErrorCallback()));
237 } 251 }
238 252
239 void ShillPropertyHandler::RequestProperties(ManagedState::ManagedType type, 253 void ShillPropertyHandler::RequestProperties(ManagedState::ManagedType type,
240 const std::string& path) { 254 const std::string& path) {
241 if (pending_updates_[type].find(path) != pending_updates_[type].end()) 255 if (pending_updates_[type].find(path) != pending_updates_[type].end())
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 NET_LOG(EVENT) << "Failed to get IP Config properties: " << ip_config_path 567 NET_LOG(EVENT) << "Failed to get IP Config properties: " << ip_config_path
554 << ": " << call_status << ", For: " << path; 568 << ": " << call_status << ", For: " << path;
555 return; 569 return;
556 } 570 }
557 NET_LOG(EVENT) << "IP Config properties received: " << path; 571 NET_LOG(EVENT) << "IP Config properties received: " << path;
558 listener_->UpdateIPConfigProperties(type, path, ip_config_path, properties); 572 listener_->UpdateIPConfigProperties(type, path, ip_config_path, properties);
559 } 573 }
560 574
561 } // namespace internal 575 } // namespace internal
562 } // namespace chromeos 576 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698