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( | 32 void DeclareLocalizedValues( |
32 ::login::LocalizedValuesBuilder* builder) override; | 33 ::login::LocalizedValuesBuilder* builder) override; |
33 void Initialize() override; | 34 void Initialize() override; |
34 | 35 |
35 // WebUIMessageHandler implementation: | 36 // WebUIMessageHandler implementation: |
36 void RegisterMessages() override; | 37 void RegisterMessages() override; |
37 | 38 |
38 // AppLaunchSplashScreenActor implementation: | 39 // AppLaunchSplashScreenActor implementation: |
39 void Show(const std::string& app_id) override; | 40 void Show(const std::string& app_id) override; |
40 void PrepareToShow() override; | 41 void PrepareToShow() override; |
41 void Hide() override; | 42 void Hide() override; |
42 void ToggleNetworkConfig(bool visible) override; | 43 void ToggleNetworkConfig(bool visible) override; |
43 void UpdateAppLaunchState(AppLaunchState state) override; | 44 void UpdateAppLaunchState(AppLaunchState state) override; |
44 void SetDelegate(AppLaunchSplashScreenHandler::Delegate* delegate) override; | 45 void SetDelegate(AppLaunchSplashScreenHandler::Delegate* delegate) override; |
45 void ShowNetworkConfigureUI() override; | 46 void ShowNetworkConfigureUI() override; |
46 bool IsNetworkReady() override; | 47 bool IsNetworkReady() override; |
47 | 48 |
48 // NetworkStateInformer::NetworkStateInformerObserver implementation: | 49 // NetworkStateInformer::NetworkStateInformerObserver implementation: |
49 void OnNetworkReady() override; | 50 void OnNetworkReady() override; |
50 void UpdateState(ErrorScreenActor::ErrorReason reason) override; | 51 void UpdateState(NetworkError::ErrorReason reason) override; |
51 | 52 |
52 private: | 53 private: |
53 void PopulateAppInfo(base::DictionaryValue* out_info); | 54 void PopulateAppInfo(base::DictionaryValue* out_info); |
54 void SetLaunchText(const std::string& text); | 55 void SetLaunchText(const std::string& text); |
55 int GetProgressMessageFromState(AppLaunchState state); | 56 int GetProgressMessageFromState(AppLaunchState state); |
56 void HandleConfigureNetwork(); | 57 void HandleConfigureNetwork(); |
57 void HandleCancelAppLaunch(); | 58 void HandleCancelAppLaunch(); |
58 void HandleContinueAppLaunch(); | 59 void HandleContinueAppLaunch(); |
59 void HandleNetworkConfigRequested(); | 60 void HandleNetworkConfigRequested(); |
60 | 61 |
61 AppLaunchSplashScreenHandler::Delegate* delegate_; | 62 AppLaunchSplashScreenHandler::Delegate* delegate_; |
62 bool show_on_init_; | 63 bool show_on_init_; |
63 std::string app_id_; | 64 std::string app_id_; |
64 AppLaunchState state_; | 65 AppLaunchState state_; |
65 | 66 |
66 scoped_refptr<NetworkStateInformer> network_state_informer_; | 67 scoped_refptr<NetworkStateInformer> network_state_informer_; |
67 ErrorScreenActor* error_screen_actor_; | 68 NetworkErrorModel* network_error_model_; |
| 69 |
68 // True if we are online. | 70 // True if we are online. |
69 bool online_state_; | 71 bool online_state_; |
| 72 |
70 // True if we have network config screen was already shown before. | 73 // True if we have network config screen was already shown before. |
71 bool network_config_done_; | 74 bool network_config_done_; |
| 75 |
72 // True if we have manually requested network config screen. | 76 // True if we have manually requested network config screen. |
73 bool network_config_requested_; | 77 bool network_config_requested_; |
74 | 78 |
75 DISALLOW_COPY_AND_ASSIGN(AppLaunchSplashScreenHandler); | 79 DISALLOW_COPY_AND_ASSIGN(AppLaunchSplashScreenHandler); |
76 }; | 80 }; |
77 | 81 |
78 } // namespace chromeos | 82 } // namespace chromeos |
79 | 83 |
80 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDL
ER_H_ | 84 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDL
ER_H_ |
OLD | NEW |