| 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 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDLER_
H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDLER_
H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDLER_
H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDLER_
H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h
" | 11 #include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h
" |
| 12 #include "chrome/browser/chromeos/login/screens/network_error_model.h" |
| 12 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 13 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 14 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 class ErrorScreenActor; | 18 class ErrorScreenActor; |
| 18 | 19 |
| 19 // A class that handles the WebUI hooks for the app launch splash screen. | 20 // A class that handles the WebUI hooks for the app launch splash screen. |
| 20 class AppLaunchSplashScreenHandler | 21 class AppLaunchSplashScreenHandler |
| 21 : public BaseScreenHandler, | 22 : public BaseScreenHandler, |
| 22 public AppLaunchSplashScreenActor, | 23 public AppLaunchSplashScreenActor, |
| 23 public NetworkStateInformer::NetworkStateInformerObserver { | 24 public NetworkStateInformer::NetworkStateInformerObserver { |
| 24 public: | 25 public: |
| 25 AppLaunchSplashScreenHandler( | 26 AppLaunchSplashScreenHandler( |
| 26 const scoped_refptr<NetworkStateInformer>& network_state_informer, | 27 const scoped_refptr<NetworkStateInformer>& network_state_informer, |
| 27 ErrorScreenActor* error_screen_actor); | 28 NetworkErrorModel* network_error_model); |
| 28 ~AppLaunchSplashScreenHandler() override; | 29 ~AppLaunchSplashScreenHandler() override; |
| 29 | 30 |
| 30 // BaseScreenHandler implementation: | 31 // BaseScreenHandler implementation: |
| 31 void DeclareLocalizedValues(LocalizedValuesBuilder* builder) override; | 32 void DeclareLocalizedValues(LocalizedValuesBuilder* builder) override; |
| 32 void Initialize() override; | 33 void Initialize() override; |
| 33 | 34 |
| 34 // WebUIMessageHandler implementation: | 35 // WebUIMessageHandler implementation: |
| 35 void RegisterMessages() override; | 36 void RegisterMessages() override; |
| 36 | 37 |
| 37 // AppLaunchSplashScreenActor implementation: | 38 // AppLaunchSplashScreenActor implementation: |
| 38 void Show(const std::string& app_id) override; | 39 void Show(const std::string& app_id) override; |
| 39 void PrepareToShow() override; | 40 void PrepareToShow() override; |
| 40 void Hide() override; | 41 void Hide() override; |
| 41 void ToggleNetworkConfig(bool visible) override; | 42 void ToggleNetworkConfig(bool visible) override; |
| 42 void UpdateAppLaunchState(AppLaunchState state) override; | 43 void UpdateAppLaunchState(AppLaunchState state) override; |
| 43 void SetDelegate(AppLaunchSplashScreenHandler::Delegate* delegate) override; | 44 void SetDelegate(AppLaunchSplashScreenHandler::Delegate* delegate) override; |
| 44 void ShowNetworkConfigureUI() override; | 45 void ShowNetworkConfigureUI() override; |
| 45 bool IsNetworkReady() override; | 46 bool IsNetworkReady() override; |
| 46 | 47 |
| 47 // NetworkStateInformer::NetworkStateInformerObserver implementation: | 48 // NetworkStateInformer::NetworkStateInformerObserver implementation: |
| 48 void OnNetworkReady() override; | 49 void OnNetworkReady() override; |
| 49 void UpdateState(ErrorScreenActor::ErrorReason reason) override; | 50 void UpdateState(NetworkError::ErrorReason reason) override; |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 void PopulateAppInfo(base::DictionaryValue* out_info); | 53 void PopulateAppInfo(base::DictionaryValue* out_info); |
| 53 void SetLaunchText(const std::string& text); | 54 void SetLaunchText(const std::string& text); |
| 54 int GetProgressMessageFromState(AppLaunchState state); | 55 int GetProgressMessageFromState(AppLaunchState state); |
| 55 void HandleConfigureNetwork(); | 56 void HandleConfigureNetwork(); |
| 56 void HandleCancelAppLaunch(); | 57 void HandleCancelAppLaunch(); |
| 57 void HandleContinueAppLaunch(); | 58 void HandleContinueAppLaunch(); |
| 58 void HandleNetworkConfigRequested(); | 59 void HandleNetworkConfigRequested(); |
| 59 | 60 |
| 60 AppLaunchSplashScreenHandler::Delegate* delegate_; | 61 AppLaunchSplashScreenHandler::Delegate* delegate_; |
| 61 bool show_on_init_; | 62 bool show_on_init_; |
| 62 std::string app_id_; | 63 std::string app_id_; |
| 63 AppLaunchState state_; | 64 AppLaunchState state_; |
| 64 | 65 |
| 65 scoped_refptr<NetworkStateInformer> network_state_informer_; | 66 scoped_refptr<NetworkStateInformer> network_state_informer_; |
| 66 ErrorScreenActor* error_screen_actor_; | 67 NetworkErrorModel* network_error_model_; |
| 68 |
| 67 // True if we are online. | 69 // True if we are online. |
| 68 bool online_state_; | 70 bool online_state_; |
| 71 |
| 69 // True if we have network config screen was already shown before. | 72 // True if we have network config screen was already shown before. |
| 70 bool network_config_done_; | 73 bool network_config_done_; |
| 74 |
| 71 // True if we have manually requested network config screen. | 75 // True if we have manually requested network config screen. |
| 72 bool network_config_requested_; | 76 bool network_config_requested_; |
| 73 | 77 |
| 74 DISALLOW_COPY_AND_ASSIGN(AppLaunchSplashScreenHandler); | 78 DISALLOW_COPY_AND_ASSIGN(AppLaunchSplashScreenHandler); |
| 75 }; | 79 }; |
| 76 | 80 |
| 77 } // namespace chromeos | 81 } // namespace chromeos |
| 78 | 82 |
| 79 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDL
ER_H_ | 83 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDL
ER_H_ |
| OLD | NEW |