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
3 // found in the LICENSE file.
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_
11 #include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h"
12 #include "chrome/browser/chromeos/login/screens/network_error_model.h"
13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
14 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
18 class ErrorScreenActor
;
20 // A class that handles the WebUI hooks for the app launch splash screen.
21 class AppLaunchSplashScreenHandler
22 : public BaseScreenHandler
,
23 public AppLaunchSplashScreenActor
,
24 public NetworkStateInformer::NetworkStateInformerObserver
{
26 AppLaunchSplashScreenHandler(
27 const scoped_refptr
<NetworkStateInformer
>& network_state_informer
,
28 NetworkErrorModel
* network_error_model
);
29 ~AppLaunchSplashScreenHandler() override
;
31 // BaseScreenHandler implementation:
32 void DeclareLocalizedValues(
33 ::login::LocalizedValuesBuilder
* builder
) override
;
34 void Initialize() override
;
36 // WebUIMessageHandler implementation:
37 void RegisterMessages() override
;
39 // AppLaunchSplashScreenActor implementation:
40 void Show(const std::string
& app_id
) override
;
41 void PrepareToShow() override
;
43 void ToggleNetworkConfig(bool visible
) override
;
44 void UpdateAppLaunchState(AppLaunchState state
) override
;
45 void SetDelegate(AppLaunchSplashScreenHandler::Delegate
* delegate
) override
;
46 void ShowNetworkConfigureUI() override
;
47 bool IsNetworkReady() override
;
49 // NetworkStateInformer::NetworkStateInformerObserver implementation:
50 void OnNetworkReady() override
;
51 void UpdateState(NetworkError::ErrorReason reason
) override
;
54 void PopulateAppInfo(base::DictionaryValue
* out_info
);
55 void SetLaunchText(const std::string
& text
);
56 int GetProgressMessageFromState(AppLaunchState state
);
57 void HandleConfigureNetwork();
58 void HandleCancelAppLaunch();
59 void HandleContinueAppLaunch();
60 void HandleNetworkConfigRequested();
62 AppLaunchSplashScreenHandler::Delegate
* delegate_
;
65 AppLaunchState state_
;
67 scoped_refptr
<NetworkStateInformer
> network_state_informer_
;
68 NetworkErrorModel
* network_error_model_
;
70 // True if we are online.
73 // True if we have network config screen was already shown before.
74 bool network_config_done_
;
76 // True if we have manually requested network config screen.
77 bool network_config_requested_
;
79 DISALLOW_COPY_AND_ASSIGN(AppLaunchSplashScreenHandler
);
82 } // namespace chromeos
84 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDLER_H_