| 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 21 matching lines...) Expand all Loading... |
| 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 ErrorScreen* error_screen) | 41 ErrorScreen* error_screen) |
| 42 : network_state_informer_(network_state_informer), | 42 : BaseScreenHandler(kScreenId), |
| 43 network_state_informer_(network_state_informer), |
| 43 error_screen_(error_screen) { | 44 error_screen_(error_screen) { |
| 44 set_call_js_prefix(kJsScreenPath); | 45 set_call_js_prefix(kJsScreenPath); |
| 45 network_state_informer_->AddObserver(this); | 46 network_state_informer_->AddObserver(this); |
| 46 } | 47 } |
| 47 | 48 |
| 48 AppLaunchSplashScreenHandler::~AppLaunchSplashScreenHandler() { | 49 AppLaunchSplashScreenHandler::~AppLaunchSplashScreenHandler() { |
| 49 network_state_informer_->RemoveObserver(this); | 50 network_state_informer_->RemoveObserver(this); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void AppLaunchSplashScreenHandler::DeclareLocalizedValues( | 53 void AppLaunchSplashScreenHandler::DeclareLocalizedValues( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 83 base::DictionaryValue data; | 84 base::DictionaryValue data; |
| 84 data.SetBoolean("shortcutEnabled", | 85 data.SetBoolean("shortcutEnabled", |
| 85 !KioskAppManager::Get()->GetDisableBailoutShortcut()); | 86 !KioskAppManager::Get()->GetDisableBailoutShortcut()); |
| 86 | 87 |
| 87 // |data| will take ownership of |app_info|. | 88 // |data| will take ownership of |app_info|. |
| 88 base::DictionaryValue *app_info = new base::DictionaryValue(); | 89 base::DictionaryValue *app_info = new base::DictionaryValue(); |
| 89 PopulateAppInfo(app_info); | 90 PopulateAppInfo(app_info); |
| 90 data.Set("appInfo", app_info); | 91 data.Set("appInfo", app_info); |
| 91 | 92 |
| 92 SetLaunchText(l10n_util::GetStringUTF8(GetProgressMessageFromState(state_))); | 93 SetLaunchText(l10n_util::GetStringUTF8(GetProgressMessageFromState(state_))); |
| 93 ShowScreenWithData(OobeScreen::SCREEN_APP_LAUNCH_SPLASH, &data); | 94 ShowScreenWithData(kScreenId, &data); |
| 94 } | 95 } |
| 95 | 96 |
| 96 void AppLaunchSplashScreenHandler::RegisterMessages() { | 97 void AppLaunchSplashScreenHandler::RegisterMessages() { |
| 97 AddCallback("configureNetwork", | 98 AddCallback("configureNetwork", |
| 98 &AppLaunchSplashScreenHandler::HandleConfigureNetwork); | 99 &AppLaunchSplashScreenHandler::HandleConfigureNetwork); |
| 99 AddCallback("cancelAppLaunch", | 100 AddCallback("cancelAppLaunch", |
| 100 &AppLaunchSplashScreenHandler::HandleCancelAppLaunch); | 101 &AppLaunchSplashScreenHandler::HandleCancelAppLaunch); |
| 101 AddCallback("continueAppLaunch", | 102 AddCallback("continueAppLaunch", |
| 102 &AppLaunchSplashScreenHandler::HandleContinueAppLaunch); | 103 &AppLaunchSplashScreenHandler::HandleContinueAppLaunch); |
| 103 AddCallback("networkConfigRequest", | 104 AddCallback("networkConfigRequest", |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 break; | 170 break; |
| 170 } | 171 } |
| 171 default: | 172 default: |
| 172 error_screen_->SetErrorState(NetworkError::ERROR_STATE_OFFLINE, | 173 error_screen_->SetErrorState(NetworkError::ERROR_STATE_OFFLINE, |
| 173 network_name); | 174 network_name); |
| 174 NOTREACHED(); | 175 NOTREACHED(); |
| 175 break; | 176 break; |
| 176 } | 177 } |
| 177 | 178 |
| 178 if (GetCurrentScreen() != OobeScreen::SCREEN_ERROR_MESSAGE) | 179 if (GetCurrentScreen() != OobeScreen::SCREEN_ERROR_MESSAGE) |
| 179 error_screen_->SetParentScreen(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); | 180 error_screen_->SetParentScreen(kScreenId); |
| 180 error_screen_->Show(); | 181 error_screen_->Show(); |
| 181 } | 182 } |
| 182 | 183 |
| 183 bool AppLaunchSplashScreenHandler::IsNetworkReady() { | 184 bool AppLaunchSplashScreenHandler::IsNetworkReady() { |
| 184 return network_state_informer_->state() == NetworkStateInformer::ONLINE; | 185 return network_state_informer_->state() == NetworkStateInformer::ONLINE; |
| 185 } | 186 } |
| 186 | 187 |
| 187 void AppLaunchSplashScreenHandler::OnNetworkReady() { | 188 void AppLaunchSplashScreenHandler::OnNetworkReady() { |
| 188 // Purposely leave blank because the online case is handled in UpdateState | 189 // Purposely leave blank because the online case is handled in UpdateState |
| 189 // call below. | 190 // call below. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 DCHECK(online_state_); | 273 DCHECK(online_state_); |
| 273 if (delegate_ && online_state_) { | 274 if (delegate_ && online_state_) { |
| 274 network_config_requested_ = false; | 275 network_config_requested_ = false; |
| 275 network_config_done_ = true; | 276 network_config_done_ = true; |
| 276 delegate_->OnNetworkConfigRequested(false); | 277 delegate_->OnNetworkConfigRequested(false); |
| 277 Show(app_id_); | 278 Show(app_id_); |
| 278 } | 279 } |
| 279 } | 280 } |
| 280 | 281 |
| 281 } // namespace chromeos | 282 } // namespace chromeos |
| OLD | NEW |