| 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 "apps/shell/browser/shell_network_controller_chromeos.h" | 5 #include "apps/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" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 // Attempts to connect to an available network if not already connecting or | 119 // Attempts to connect to an available network if not already connecting or |
| 120 // connected. | 120 // connected. |
| 121 void ShellNetworkController::ConnectIfUnconnected() { | 121 void ShellNetworkController::ConnectIfUnconnected() { |
| 122 chromeos::NetworkHandler* handler = chromeos::NetworkHandler::Get(); | 122 chromeos::NetworkHandler* handler = chromeos::NetworkHandler::Get(); |
| 123 DCHECK(handler); | 123 DCHECK(handler); |
| 124 if (waiting_for_connection_result_ || IsConnectedOrConnecting()) | 124 if (waiting_for_connection_result_ || IsConnectedOrConnecting()) |
| 125 return; | 125 return; |
| 126 | 126 |
| 127 chromeos::NetworkStateHandler::NetworkStateList state_list; | 127 chromeos::NetworkStateHandler::NetworkStateList state_list; |
| 128 handler->network_state_handler()->GetNetworkListByType( | 128 handler->network_state_handler()->GetVisibleNetworkListByType( |
| 129 chromeos::NetworkTypePattern::WiFi(), &state_list); | 129 chromeos::NetworkTypePattern::WiFi(), &state_list); |
| 130 for (chromeos::NetworkStateHandler::NetworkStateList::const_iterator it = | 130 for (chromeos::NetworkStateHandler::NetworkStateList::const_iterator it = |
| 131 state_list.begin(); it != state_list.end(); ++it) { | 131 state_list.begin(); it != state_list.end(); ++it) { |
| 132 const chromeos::NetworkState* state = *it; | 132 const chromeos::NetworkState* state = *it; |
| 133 DCHECK(state); | 133 DCHECK(state); |
| 134 if (!state->connectable()) | 134 if (!state->connectable()) |
| 135 continue; | 135 continue; |
| 136 | 136 |
| 137 VLOG(1) << "Connecting to network " << GetNetworkName(*state) | 137 VLOG(1) << "Connecting to network " << GetNetworkName(*state) |
| 138 << " with path " << state->path() << " and strength " | 138 << " with path " << state->path() << " and strength " |
| (...skipping 19 matching lines...) Expand all Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ShellNetworkController::HandleConnectionError( | 160 void ShellNetworkController::HandleConnectionError( |
| 161 const std::string& error_name, | 161 const std::string& error_name, |
| 162 scoped_ptr<base::DictionaryValue> error_data) { | 162 scoped_ptr<base::DictionaryValue> error_data) { |
| 163 LOG(WARNING) << "Unable to connect to network: " << error_name; | 163 LOG(WARNING) << "Unable to connect to network: " << error_name; |
| 164 waiting_for_connection_result_ = false; | 164 waiting_for_connection_result_ = false; |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace apps | 167 } // namespace apps |
| OLD | NEW |