| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/network_screen.h" | 5 #include "chrome/browser/chromeos/login/network_screen.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 void NetworkScreen::NotifyOnConnection() { | 137 void NetworkScreen::NotifyOnConnection() { |
| 138 // TODO(nkostylev): Check network connectivity. | 138 // TODO(nkostylev): Check network connectivity. |
| 139 UnsubscribeNetworkNotification(); | 139 UnsubscribeNetworkNotification(); |
| 140 connection_timer_.Stop(); | 140 connection_timer_.Stop(); |
| 141 delegate()->GetObserver(this)->OnExit(ScreenObserver::NETWORK_CONNECTED); | 141 delegate()->GetObserver(this)->OnExit(ScreenObserver::NETWORK_CONNECTED); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void NetworkScreen::OnConnectionTimeout() { | 144 void NetworkScreen::OnConnectionTimeout() { |
| 145 StopWaitingForConnection(network_id_); | 145 StopWaitingForConnection(network_id_); |
| 146 if (!view()->is_dialog_open() && | 146 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); |
| 147 bool is_connected = network && network->Connected(); |
| 148 |
| 149 if (!is_connected && |
| 150 !view()->is_dialog_open() && |
| 147 !(help_app_.get() && help_app_->is_open())) { | 151 !(help_app_.get() && help_app_->is_open())) { |
| 148 // Show error bubble. | 152 // Show error bubble. |
| 149 ClearErrors(); | 153 ClearErrors(); |
| 150 views::View* network_control = view()->GetNetworkControlView(); | 154 views::View* network_control = view()->GetNetworkControlView(); |
| 151 bubble_ = MessageBubble::Show( | 155 bubble_ = MessageBubble::Show( |
| 152 network_control->GetWidget(), | 156 network_control->GetWidget(), |
| 153 network_control->GetScreenBounds(), | 157 network_control->GetScreenBounds(), |
| 154 BubbleBorder::LEFT_TOP, | 158 BubbleBorder::LEFT_TOP, |
| 155 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING), | 159 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING), |
| 156 l10n_util::GetStringF(IDS_NETWORK_SELECTION_ERROR, | 160 l10n_util::GetStringF(IDS_NETWORK_SELECTION_ERROR, |
| 157 l10n_util::GetString(IDS_PRODUCT_OS_NAME), | 161 l10n_util::GetString(IDS_PRODUCT_OS_NAME), |
| 158 UTF16ToWide(network_id_)), | 162 UTF16ToWide(network_id_)), |
| 159 l10n_util::GetString(IDS_NETWORK_SELECTION_ERROR_HELP), | 163 l10n_util::GetString(IDS_NETWORK_SELECTION_ERROR_HELP), |
| 160 this); | 164 this); |
| 161 network_control->RequestFocus(); | 165 network_control->RequestFocus(); |
| 162 } | 166 } |
| 163 } | 167 } |
| 164 | 168 |
| 165 void NetworkScreen::UpdateStatus(NetworkLibrary* network) { | 169 void NetworkScreen::UpdateStatus(NetworkLibrary* network) { |
| 166 if (!view() || !network) | 170 if (!view() || !network) |
| 167 return; | 171 return; |
| 168 | 172 |
| 173 if (network->Connected()) |
| 174 ClearErrors(); |
| 175 |
| 169 if (network->ethernet_connected()) { | 176 if (network->ethernet_connected()) { |
| 170 StopWaitingForConnection( | 177 StopWaitingForConnection( |
| 171 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); | 178 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); |
| 172 } else if (network->wifi_connected()) { | 179 } else if (network->wifi_connected()) { |
| 173 StopWaitingForConnection(ASCIIToUTF16(network->wifi_network()->name())); | 180 StopWaitingForConnection(ASCIIToUTF16(network->wifi_network()->name())); |
| 174 } else if (network->cellular_connected()) { | 181 } else if (network->cellular_connected()) { |
| 175 StopWaitingForConnection(ASCIIToUTF16(network->cellular_network()->name())); | 182 StopWaitingForConnection(ASCIIToUTF16(network->cellular_network()->name())); |
| 176 } else if (network->ethernet_connecting()) { | 183 } else if (network->ethernet_connecting()) { |
| 177 WaitForConnection( | 184 WaitForConnection( |
| 178 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); | 185 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 209 &NetworkScreen::OnConnectionTimeout); | 216 &NetworkScreen::OnConnectionTimeout); |
| 210 } | 217 } |
| 211 | 218 |
| 212 network_id_ = network_id; | 219 network_id_ = network_id; |
| 213 view()->ShowConnectingStatus(continue_pressed_, network_id_); | 220 view()->ShowConnectingStatus(continue_pressed_, network_id_); |
| 214 | 221 |
| 215 view()->EnableContinue(false); | 222 view()->EnableContinue(false); |
| 216 } | 223 } |
| 217 | 224 |
| 218 } // namespace chromeos | 225 } // namespace chromeos |
| OLD | NEW |