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" | |
19 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
20 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
21 #include "base/values.h" | 20 #include "base/values.h" |
22 #include "chromeos/network/device_state.h" | 21 #include "chromeos/network/device_state.h" |
23 #include "chromeos/network/network_event_log.h" | 22 #include "chromeos/network/network_event_log.h" |
24 #include "chromeos/network/network_state.h" | 23 #include "chromeos/network/network_state.h" |
25 #include "chromeos/network/network_state_handler_observer.h" | 24 #include "chromeos/network/network_state_handler_observer.h" |
26 #include "third_party/cros_system_api/dbus/service_constants.h" | 25 #include "third_party/cros_system_api/dbus/service_constants.h" |
27 | 26 |
28 namespace chromeos { | 27 namespace chromeos { |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 const std::string& check_portal_list) { | 377 const std::string& check_portal_list) { |
379 NET_LOG_EVENT("SetCheckPortalList", check_portal_list); | 378 NET_LOG_EVENT("SetCheckPortalList", check_portal_list); |
380 shill_property_handler_->SetCheckPortalList(check_portal_list); | 379 shill_property_handler_->SetCheckPortalList(check_portal_list); |
381 } | 380 } |
382 | 381 |
383 void NetworkStateHandler::SetWakeOnLanEnabled(bool enabled) { | 382 void NetworkStateHandler::SetWakeOnLanEnabled(bool enabled) { |
384 NET_LOG_EVENT("SetWakeOnLanEnabled", enabled ? "true" : "false"); | 383 NET_LOG_EVENT("SetWakeOnLanEnabled", enabled ? "true" : "false"); |
385 shill_property_handler_->SetWakeOnLanEnabled(enabled); | 384 shill_property_handler_->SetWakeOnLanEnabled(enabled); |
386 } | 385 } |
387 | 386 |
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 | |
400 const NetworkState* NetworkStateHandler::GetEAPForEthernet( | 387 const NetworkState* NetworkStateHandler::GetEAPForEthernet( |
401 const std::string& service_path) { | 388 const std::string& service_path) { |
402 const NetworkState* network = GetNetworkState(service_path); | 389 const NetworkState* network = GetNetworkState(service_path); |
403 if (!network) { | 390 if (!network) { |
404 NET_LOG_ERROR("GetEAPForEthernet", "Unknown service path " + service_path); | 391 NET_LOG_ERROR("GetEAPForEthernet", "Unknown service path " + service_path); |
405 return nullptr; | 392 return nullptr; |
406 } | 393 } |
407 if (network->type() != shill::kTypeEthernet) { | 394 if (network->type() != shill::kTypeEthernet) { |
408 NET_LOG_ERROR("GetEAPForEthernet", "Not of type Ethernet: " + service_path); | 395 NET_LOG_ERROR("GetEAPForEthernet", "Not of type Ethernet: " + service_path); |
409 return nullptr; | 396 return nullptr; |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 if (type.MatchesType(shill::kTypeBluetooth)) | 986 if (type.MatchesType(shill::kTypeBluetooth)) |
1000 technologies.emplace_back(shill::kTypeBluetooth); | 987 technologies.emplace_back(shill::kTypeBluetooth); |
1001 if (type.MatchesType(shill::kTypeVPN)) | 988 if (type.MatchesType(shill::kTypeVPN)) |
1002 technologies.emplace_back(shill::kTypeVPN); | 989 technologies.emplace_back(shill::kTypeVPN); |
1003 | 990 |
1004 CHECK_GT(technologies.size(), 0ul); | 991 CHECK_GT(technologies.size(), 0ul); |
1005 return technologies; | 992 return technologies; |
1006 } | 993 } |
1007 | 994 |
1008 } // namespace chromeos | 995 } // namespace chromeos |
OLD | NEW |