| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/webui/chromeos/login/app_launch_splash_screen_handle
r.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle
r.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 7 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 8 #include "chrome/browser/chromeos/login/oobe_screen.h" | 8 #include "chrome/browser/chromeos/login/oobe_screen.h" |
| 9 #include "chrome/browser/chromeos/login/screens/network_error.h" | 9 #include "chrome/browser/chromeos/login/screens/network_error.h" |
| 10 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 10 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return std::string(); | 31 return std::string(); |
| 32 return network->name(); | 32 return network->name(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 namespace chromeos { | 37 namespace chromeos { |
| 38 | 38 |
| 39 AppLaunchSplashScreenHandler::AppLaunchSplashScreenHandler( | 39 AppLaunchSplashScreenHandler::AppLaunchSplashScreenHandler( |
| 40 const scoped_refptr<NetworkStateInformer>& network_state_informer, | 40 const scoped_refptr<NetworkStateInformer>& network_state_informer, |
| 41 NetworkErrorModel* network_error_model) | 41 ErrorScreen* error_screen) |
| 42 : BaseScreenHandler(kJsScreenPath), | 42 : BaseScreenHandler(kJsScreenPath), |
| 43 delegate_(NULL), | |
| 44 show_on_init_(false), | |
| 45 state_(APP_LAUNCH_STATE_LOADING_AUTH_FILE), | |
| 46 network_state_informer_(network_state_informer), | 43 network_state_informer_(network_state_informer), |
| 47 network_error_model_(network_error_model), | 44 error_screen_(error_screen) { |
| 48 online_state_(false), | |
| 49 network_config_done_(false), | |
| 50 network_config_requested_(false) { | |
| 51 network_state_informer_->AddObserver(this); | 45 network_state_informer_->AddObserver(this); |
| 52 } | 46 } |
| 53 | 47 |
| 54 AppLaunchSplashScreenHandler::~AppLaunchSplashScreenHandler() { | 48 AppLaunchSplashScreenHandler::~AppLaunchSplashScreenHandler() { |
| 55 network_state_informer_->RemoveObserver(this); | 49 network_state_informer_->RemoveObserver(this); |
| 56 } | 50 } |
| 57 | 51 |
| 58 void AppLaunchSplashScreenHandler::DeclareLocalizedValues( | 52 void AppLaunchSplashScreenHandler::DeclareLocalizedValues( |
| 59 ::login::LocalizedValuesBuilder* builder) { | 53 ::login::LocalizedValuesBuilder* builder) { |
| 60 builder->Add("appStartMessage", IDS_APP_START_NETWORK_WAIT_MESSAGE); | 54 builder->Add("appStartMessage", IDS_APP_START_NETWORK_WAIT_MESSAGE); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 online_state_ = true; | 134 online_state_ = true; |
| 141 if (!network_config_requested_) { | 135 if (!network_config_requested_) { |
| 142 delegate_->OnNetworkStateChanged(true); | 136 delegate_->OnNetworkStateChanged(true); |
| 143 return; | 137 return; |
| 144 } | 138 } |
| 145 } | 139 } |
| 146 | 140 |
| 147 const std::string network_path = network_state_informer_->network_path(); | 141 const std::string network_path = network_state_informer_->network_path(); |
| 148 const std::string network_name = GetNetworkName(network_path); | 142 const std::string network_name = GetNetworkName(network_path); |
| 149 | 143 |
| 150 network_error_model_->SetUIState(NetworkError::UI_STATE_KIOSK_MODE); | 144 error_screen_->SetUIState(NetworkError::UI_STATE_KIOSK_MODE); |
| 151 network_error_model_->AllowGuestSignin(false); | 145 error_screen_->AllowGuestSignin(false); |
| 152 network_error_model_->AllowOfflineLogin(false); | 146 error_screen_->AllowOfflineLogin(false); |
| 153 | 147 |
| 154 switch (state) { | 148 switch (state) { |
| 155 case NetworkStateInformer::CAPTIVE_PORTAL: { | 149 case NetworkStateInformer::CAPTIVE_PORTAL: { |
| 156 network_error_model_->SetErrorState(NetworkError::ERROR_STATE_PORTAL, | 150 error_screen_->SetErrorState(NetworkError::ERROR_STATE_PORTAL, |
| 157 network_name); | 151 network_name); |
| 158 network_error_model_->FixCaptivePortal(); | 152 error_screen_->FixCaptivePortal(); |
| 159 | 153 |
| 160 break; | 154 break; |
| 161 } | 155 } |
| 162 case NetworkStateInformer::PROXY_AUTH_REQUIRED: { | 156 case NetworkStateInformer::PROXY_AUTH_REQUIRED: { |
| 163 network_error_model_->SetErrorState(NetworkError::ERROR_STATE_PROXY, | 157 error_screen_->SetErrorState(NetworkError::ERROR_STATE_PROXY, |
| 164 network_name); | 158 network_name); |
| 165 break; | 159 break; |
| 166 } | 160 } |
| 167 case NetworkStateInformer::OFFLINE: { | 161 case NetworkStateInformer::OFFLINE: { |
| 168 network_error_model_->SetErrorState(NetworkError::ERROR_STATE_OFFLINE, | 162 error_screen_->SetErrorState(NetworkError::ERROR_STATE_OFFLINE, |
| 169 network_name); | 163 network_name); |
| 170 break; | 164 break; |
| 171 } | 165 } |
| 172 case NetworkStateInformer::ONLINE: { | 166 case NetworkStateInformer::ONLINE: { |
| 173 network_error_model_->SetErrorState( | 167 error_screen_->SetErrorState(NetworkError::ERROR_STATE_KIOSK_ONLINE, |
| 174 NetworkError::ERROR_STATE_KIOSK_ONLINE, network_name); | 168 network_name); |
| 175 break; | 169 break; |
| 176 } | 170 } |
| 177 default: | 171 default: |
| 178 network_error_model_->SetErrorState(NetworkError::ERROR_STATE_OFFLINE, | 172 error_screen_->SetErrorState(NetworkError::ERROR_STATE_OFFLINE, |
| 179 network_name); | 173 network_name); |
| 180 NOTREACHED(); | 174 NOTREACHED(); |
| 181 break; | 175 break; |
| 182 } | 176 } |
| 183 | 177 |
| 184 if (GetCurrentScreen() != OobeScreen::SCREEN_ERROR_MESSAGE) | 178 if (GetCurrentScreen() != OobeScreen::SCREEN_ERROR_MESSAGE) |
| 185 network_error_model_->SetParentScreen(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); | 179 error_screen_->SetParentScreen(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); |
| 186 network_error_model_->Show(); | 180 error_screen_->Show(); |
| 187 } | 181 } |
| 188 | 182 |
| 189 bool AppLaunchSplashScreenHandler::IsNetworkReady() { | 183 bool AppLaunchSplashScreenHandler::IsNetworkReady() { |
| 190 return network_state_informer_->state() == NetworkStateInformer::ONLINE; | 184 return network_state_informer_->state() == NetworkStateInformer::ONLINE; |
| 191 } | 185 } |
| 192 | 186 |
| 193 void AppLaunchSplashScreenHandler::OnNetworkReady() { | 187 void AppLaunchSplashScreenHandler::OnNetworkReady() { |
| 194 // Purposely leave blank because the online case is handled in UpdateState | 188 // Purposely leave blank because the online case is handled in UpdateState |
| 195 // call below. | 189 // call below. |
| 196 } | 190 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 DCHECK(online_state_); | 272 DCHECK(online_state_); |
| 279 if (delegate_ && online_state_) { | 273 if (delegate_ && online_state_) { |
| 280 network_config_requested_ = false; | 274 network_config_requested_ = false; |
| 281 network_config_done_ = true; | 275 network_config_done_ = true; |
| 282 delegate_->OnNetworkConfigRequested(false); | 276 delegate_->OnNetworkConfigRequested(false); |
| 283 Show(app_id_); | 277 Show(app_id_); |
| 284 } | 278 } |
| 285 } | 279 } |
| 286 | 280 |
| 287 } // namespace chromeos | 281 } // namespace chromeos |
| OLD | NEW |