OLD | NEW |
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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 const std::string& check_portal_list) { | 378 const std::string& check_portal_list) { |
378 NET_LOG_EVENT("SetCheckPortalList", check_portal_list); | 379 NET_LOG_EVENT("SetCheckPortalList", check_portal_list); |
379 shill_property_handler_->SetCheckPortalList(check_portal_list); | 380 shill_property_handler_->SetCheckPortalList(check_portal_list); |
380 } | 381 } |
381 | 382 |
382 void NetworkStateHandler::SetWakeOnLanEnabled(bool enabled) { | 383 void NetworkStateHandler::SetWakeOnLanEnabled(bool enabled) { |
383 NET_LOG_EVENT("SetWakeOnLanEnabled", enabled ? "true" : "false"); | 384 NET_LOG_EVENT("SetWakeOnLanEnabled", enabled ? "true" : "false"); |
384 shill_property_handler_->SetWakeOnLanEnabled(enabled); | 385 shill_property_handler_->SetWakeOnLanEnabled(enabled); |
385 } | 386 } |
386 | 387 |
| 388 void NetworkStateHandler::SetNetworkThrottlingStatus( |
| 389 bool enabled, |
| 390 uint32_t upload_rate_kbits, |
| 391 uint32_t download_rate_kbits) { |
| 392 NET_LOG_EVENT("SetNetworkThrottlingStatus", |
| 393 enabled ? ("true :" + base::IntToString(upload_rate_kbits) + |
| 394 ", " + base::IntToString(download_rate_kbits)) |
| 395 : "false"); |
| 396 shill_property_handler_->SetNetworkThrottlingStatus( |
| 397 enabled, upload_rate_kbits, download_rate_kbits); |
| 398 } |
| 399 |
387 const NetworkState* NetworkStateHandler::GetEAPForEthernet( | 400 const NetworkState* NetworkStateHandler::GetEAPForEthernet( |
388 const std::string& service_path) { | 401 const std::string& service_path) { |
389 const NetworkState* network = GetNetworkState(service_path); | 402 const NetworkState* network = GetNetworkState(service_path); |
390 if (!network) { | 403 if (!network) { |
391 NET_LOG_ERROR("GetEAPForEthernet", "Unknown service path " + service_path); | 404 NET_LOG_ERROR("GetEAPForEthernet", "Unknown service path " + service_path); |
392 return nullptr; | 405 return nullptr; |
393 } | 406 } |
394 if (network->type() != shill::kTypeEthernet) { | 407 if (network->type() != shill::kTypeEthernet) { |
395 NET_LOG_ERROR("GetEAPForEthernet", "Not of type Ethernet: " + service_path); | 408 NET_LOG_ERROR("GetEAPForEthernet", "Not of type Ethernet: " + service_path); |
396 return nullptr; | 409 return nullptr; |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 if (type.MatchesType(shill::kTypeBluetooth)) | 999 if (type.MatchesType(shill::kTypeBluetooth)) |
987 technologies.emplace_back(shill::kTypeBluetooth); | 1000 technologies.emplace_back(shill::kTypeBluetooth); |
988 if (type.MatchesType(shill::kTypeVPN)) | 1001 if (type.MatchesType(shill::kTypeVPN)) |
989 technologies.emplace_back(shill::kTypeVPN); | 1002 technologies.emplace_back(shill::kTypeVPN); |
990 | 1003 |
991 CHECK_GT(technologies.size(), 0ul); | 1004 CHECK_GT(technologies.size(), 0ul); |
992 return technologies; | 1005 return technologies; |
993 } | 1006 } |
994 | 1007 |
995 } // namespace chromeos | 1008 } // namespace chromeos |
OLD | NEW |