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_handler.h" | 14 #include "chromeos/network/network_handler.h" |
14 #include "chromeos/network/network_handler_callbacks.h" | 15 #include "chromeos/network/network_handler_callbacks.h" |
15 #include "chromeos/network/network_state.h" | 16 #include "chromeos/network/network_state.h" |
16 #include "chromeos/network/network_state_handler.h" | 17 #include "chromeos/network/network_state_handler.h" |
17 #include "third_party/cros_system_api/dbus/service_constants.h" | 18 #include "third_party/cros_system_api/dbus/service_constants.h" |
18 | 19 |
19 namespace extensions { | 20 namespace extensions { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 96 |
96 if (preferred_network_is_active_ || | 97 if (preferred_network_is_active_ || |
97 (preferred_network_name_.empty() && wifi_network)) { | 98 (preferred_network_name_.empty() && wifi_network)) { |
98 SetScanningEnabled(false); | 99 SetScanningEnabled(false); |
99 } else { | 100 } else { |
100 SetScanningEnabled(true); | 101 SetScanningEnabled(true); |
101 ConnectIfUnconnected(); | 102 ConnectIfUnconnected(); |
102 } | 103 } |
103 } | 104 } |
104 | 105 |
| 106 void ShellNetworkController::SetCellularAllowRoaming(bool allow_roaming) { |
| 107 chromeos::NetworkDeviceHandler* device_handler = |
| 108 chromeos::NetworkHandler::Get()->network_device_handler(); |
| 109 device_handler->SetCellularAllowRoaming(allow_roaming); |
| 110 } |
| 111 |
105 const chromeos::NetworkState* ShellNetworkController::GetActiveWiFiNetwork() { | 112 const chromeos::NetworkState* ShellNetworkController::GetActiveWiFiNetwork() { |
106 chromeos::NetworkStateHandler* state_handler = | 113 chromeos::NetworkStateHandler* state_handler = |
107 chromeos::NetworkHandler::Get()->network_state_handler(); | 114 chromeos::NetworkHandler::Get()->network_state_handler(); |
108 const chromeos::NetworkState* network = state_handler->FirstNetworkByType( | 115 const chromeos::NetworkState* network = state_handler->FirstNetworkByType( |
109 chromeos::NetworkTypePattern::Primitive(shill::kTypeWifi)); | 116 chromeos::NetworkTypePattern::Primitive(shill::kTypeWifi)); |
110 return network && | 117 return network && |
111 (network->IsConnectedState() || network->IsConnectingState()) | 118 (network->IsConnectedState() || network->IsConnectingState()) |
112 ? network | 119 ? network |
113 : NULL; | 120 : NULL; |
114 } | 121 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 206 } |
200 | 207 |
201 void ShellNetworkController::HandleConnectionError( | 208 void ShellNetworkController::HandleConnectionError( |
202 const std::string& error_name, | 209 const std::string& error_name, |
203 scoped_ptr<base::DictionaryValue> error_data) { | 210 scoped_ptr<base::DictionaryValue> error_data) { |
204 LOG(WARNING) << "Unable to connect to network: " << error_name; | 211 LOG(WARNING) << "Unable to connect to network: " << error_name; |
205 state_ = STATE_IDLE; | 212 state_ = STATE_IDLE; |
206 } | 213 } |
207 | 214 |
208 } // namespace extensions | 215 } // namespace extensions |
OLD | NEW |