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

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

Issue 2466693002: [Re-land] Add network throttling as enterprise policy (Closed)
Patch Set: [Re-land] Add network throttling as enterprise policy Created 4 years, 1 month 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/network_state_handler.h" 5 #include "chromeos/network/network_state_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
11 #include "base/guid.h" 11 #include "base/guid.h"
12 #include "base/json/json_string_value_serializer.h" 12 #include "base/json/json_string_value_serializer.h"
13 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
20 #include "base/values.h" 21 #include "base/values.h"
21 #include "chromeos/network/device_state.h" 22 #include "chromeos/network/device_state.h"
22 #include "chromeos/network/network_event_log.h" 23 #include "chromeos/network/network_event_log.h"
23 #include "chromeos/network/network_state.h" 24 #include "chromeos/network/network_state.h"
24 #include "chromeos/network/network_state_handler_observer.h" 25 #include "chromeos/network/network_state_handler_observer.h"
25 #include "third_party/cros_system_api/dbus/service_constants.h" 26 #include "third_party/cros_system_api/dbus/service_constants.h"
26 27
27 namespace chromeos { 28 namespace chromeos {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 const std::string& check_portal_list) { 376 const std::string& check_portal_list) {
376 NET_LOG_EVENT("SetCheckPortalList", check_portal_list); 377 NET_LOG_EVENT("SetCheckPortalList", check_portal_list);
377 shill_property_handler_->SetCheckPortalList(check_portal_list); 378 shill_property_handler_->SetCheckPortalList(check_portal_list);
378 } 379 }
379 380
380 void NetworkStateHandler::SetWakeOnLanEnabled(bool enabled) { 381 void NetworkStateHandler::SetWakeOnLanEnabled(bool enabled) {
381 NET_LOG_EVENT("SetWakeOnLanEnabled", enabled ? "true" : "false"); 382 NET_LOG_EVENT("SetWakeOnLanEnabled", enabled ? "true" : "false");
382 shill_property_handler_->SetWakeOnLanEnabled(enabled); 383 shill_property_handler_->SetWakeOnLanEnabled(enabled);
383 } 384 }
384 385
386 void NetworkStateHandler::SetNetworkThrottlingStatus(
387 bool enabled,
388 uint32_t upload_rate_kbits,
389 uint32_t download_rate_kbits) {
390 NET_LOG_EVENT("SetNetworkThrottlingStatus",
391 enabled ? ("true :" + base::IntToString(upload_rate_kbits) +
392 ", " + base::IntToString(download_rate_kbits))
393 : "false");
394 shill_property_handler_->SetNetworkThrottlingStatus(
395 enabled, upload_rate_kbits, download_rate_kbits);
396 }
397
385 const NetworkState* NetworkStateHandler::GetEAPForEthernet( 398 const NetworkState* NetworkStateHandler::GetEAPForEthernet(
386 const std::string& service_path) { 399 const std::string& service_path) {
387 const NetworkState* network = GetNetworkState(service_path); 400 const NetworkState* network = GetNetworkState(service_path);
388 if (!network) { 401 if (!network) {
389 NET_LOG_ERROR("GetEAPForEthernet", "Unknown service path " + service_path); 402 NET_LOG_ERROR("GetEAPForEthernet", "Unknown service path " + service_path);
390 return nullptr; 403 return nullptr;
391 } 404 }
392 if (network->type() != shill::kTypeEthernet) { 405 if (network->type() != shill::kTypeEthernet) {
393 NET_LOG_ERROR("GetEAPForEthernet", "Not of type Ethernet: " + service_path); 406 NET_LOG_ERROR("GetEAPForEthernet", "Not of type Ethernet: " + service_path);
394 return nullptr; 407 return nullptr;
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 if (type.MatchesType(shill::kTypeBluetooth)) 997 if (type.MatchesType(shill::kTypeBluetooth))
985 technologies.emplace_back(shill::kTypeBluetooth); 998 technologies.emplace_back(shill::kTypeBluetooth);
986 if (type.MatchesType(shill::kTypeVPN)) 999 if (type.MatchesType(shill::kTypeVPN))
987 technologies.emplace_back(shill::kTypeVPN); 1000 technologies.emplace_back(shill::kTypeVPN);
988 1001
989 CHECK_GT(technologies.size(), 0ul); 1002 CHECK_GT(technologies.size(), 0ul);
990 return technologies; 1003 return technologies;
991 } 1004 }
992 1005
993 } // namespace chromeos 1006 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698