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 "chrome/browser/chromeos/login/screens/network_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/network_screen.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 | 156 |
157 void NetworkScreen::UpdateStatus() { | 157 void NetworkScreen::UpdateStatus() { |
158 if (!actor_) | 158 if (!actor_) |
159 return; | 159 return; |
160 | 160 |
161 bool is_connected = network_state_helper_->IsConnected(); | 161 bool is_connected = network_state_helper_->IsConnected(); |
162 if (is_connected) | 162 if (is_connected) |
163 actor_->ClearErrors(); | 163 actor_->ClearErrors(); |
164 | 164 |
165 string16 network_name = network_state_helper_->GetCurrentNetworkName(); | 165 base::string16 network_name = network_state_helper_->GetCurrentNetworkName(); |
166 if (is_connected) { | 166 if (is_connected) { |
167 StopWaitingForConnection(network_name); | 167 StopWaitingForConnection(network_name); |
168 } else if (network_state_helper_->IsConnecting()) { | 168 } else if (network_state_helper_->IsConnecting()) { |
169 WaitForConnection(network_name); | 169 WaitForConnection(network_name); |
170 } else { | 170 } else { |
171 StopWaitingForConnection(network_id_); | 171 StopWaitingForConnection(network_id_); |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 void NetworkScreen::StopWaitingForConnection(const string16& network_id) { | 175 void NetworkScreen::StopWaitingForConnection(const base::string16& network_id) { |
176 bool is_connected = network_state_helper_->IsConnected(); | 176 bool is_connected = network_state_helper_->IsConnected(); |
177 if (is_connected && continue_pressed_) { | 177 if (is_connected && continue_pressed_) { |
178 NotifyOnConnection(); | 178 NotifyOnConnection(); |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 continue_pressed_ = false; | 182 continue_pressed_ = false; |
183 connection_timer_.Stop(); | 183 connection_timer_.Stop(); |
184 | 184 |
185 network_id_ = network_id; | 185 network_id_ = network_id; |
186 if (actor_) { | 186 if (actor_) { |
187 actor_->ShowConnectingStatus(false, network_id_); | 187 actor_->ShowConnectingStatus(false, network_id_); |
188 actor_->EnableContinue(is_connected); | 188 actor_->EnableContinue(is_connected); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 void NetworkScreen::WaitForConnection(const string16& network_id) { | 192 void NetworkScreen::WaitForConnection(const base::string16& network_id) { |
193 if (network_id_ != network_id || !connection_timer_.IsRunning()) { | 193 if (network_id_ != network_id || !connection_timer_.IsRunning()) { |
194 connection_timer_.Stop(); | 194 connection_timer_.Stop(); |
195 connection_timer_.Start(FROM_HERE, | 195 connection_timer_.Start(FROM_HERE, |
196 base::TimeDelta::FromSeconds(kConnectionTimeoutSec), | 196 base::TimeDelta::FromSeconds(kConnectionTimeoutSec), |
197 this, | 197 this, |
198 &NetworkScreen::OnConnectionTimeout); | 198 &NetworkScreen::OnConnectionTimeout); |
199 } | 199 } |
200 | 200 |
201 network_id_ = network_id; | 201 network_id_ = network_id; |
202 if (actor_) { | 202 if (actor_) { |
203 actor_->ShowConnectingStatus(continue_pressed_, network_id_); | 203 actor_->ShowConnectingStatus(continue_pressed_, network_id_); |
204 actor_->EnableContinue(false); | 204 actor_->EnableContinue(false); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 } // namespace chromeos | 208 } // namespace chromeos |
OLD | NEW |