OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_network_controller_chromeos.h" | 5 #include "extensions/shell/browser/shell_network_controller_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "chromeos/network/network_connection_handler.h" | 12 #include "chromeos/network/network_connection_handler.h" |
13 #include "chromeos/network/network_device_handler.h" | 13 #include "chromeos/network/network_device_handler.h" |
14 #include "chromeos/network/network_handler.h" | 14 #include "chromeos/network/network_handler.h" |
15 #include "chromeos/network/network_handler_callbacks.h" | 15 #include "chromeos/network/network_handler_callbacks.h" |
16 #include "chromeos/network/network_state.h" | 16 #include "chromeos/network/network_state.h" |
17 #include "chromeos/network/network_state_handler.h" | 17 #include "chromeos/network/network_state_handler.h" |
18 #include "third_party/cros_system_api/dbus/service_constants.h" | 18 #include "third_party/cros_system_api/dbus/service_constants.h" |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // Frequency at which networks should be scanned when not connected to a network | 24 // Frequency at which networks should be scanned when not connected to a network |
25 // or when connected to a non-preferred network. | 25 // or when connected to a non-preferred network. |
26 const int kScanIntervalSec = 10; | 26 const int kScanIntervalSec = 10; |
27 | 27 |
28 void HandleEnableWifiError(const std::string& error_name, | 28 void HandleEnableWifiError(const std::string& error_name, |
29 scoped_ptr<base::DictionaryValue> error_data) { | 29 std::unique_ptr<base::DictionaryValue> error_data) { |
30 LOG(WARNING) << "Unable to enable wifi: " << error_name; | 30 LOG(WARNING) << "Unable to enable wifi: " << error_name; |
31 } | 31 } |
32 | 32 |
33 // Returns a human-readable name for the network described by |network|. | 33 // Returns a human-readable name for the network described by |network|. |
34 std::string GetNetworkName(const chromeos::NetworkState& network) { | 34 std::string GetNetworkName(const chromeos::NetworkState& network) { |
35 return !network.name().empty() | 35 return !network.name().empty() |
36 ? network.name() | 36 ? network.name() |
37 : base::StringPrintf("[%s]", network.type().c_str()); | 37 : base::StringPrintf("[%s]", network.type().c_str()); |
38 } | 38 } |
39 | 39 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 false /* check_error_state */); | 200 false /* check_error_state */); |
201 } | 201 } |
202 | 202 |
203 void ShellNetworkController::HandleConnectionSuccess() { | 203 void ShellNetworkController::HandleConnectionSuccess() { |
204 VLOG(1) << "Successfully connected to network"; | 204 VLOG(1) << "Successfully connected to network"; |
205 state_ = STATE_IDLE; | 205 state_ = STATE_IDLE; |
206 } | 206 } |
207 | 207 |
208 void ShellNetworkController::HandleConnectionError( | 208 void ShellNetworkController::HandleConnectionError( |
209 const std::string& error_name, | 209 const std::string& error_name, |
210 scoped_ptr<base::DictionaryValue> error_data) { | 210 std::unique_ptr<base::DictionaryValue> error_data) { |
211 LOG(WARNING) << "Unable to connect to network: " << error_name; | 211 LOG(WARNING) << "Unable to connect to network: " << error_name; |
212 state_ = STATE_IDLE; | 212 state_ = STATE_IDLE; |
213 } | 213 } |
214 | 214 |
215 } // namespace extensions | 215 } // namespace extensions |
OLD | NEW |