NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / app_launch_splash_screen_handler.h
blob50c3e33218a0369826709c3190a5d1ce0ec5f3a1
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_
8 #include <set>
9 #include <string>
11 #include "chrome/browser/chromeos/login/screens/app_launch_splash_screen_actor.h"
12 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
13 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
15 namespace chromeos {
17 class ErrorScreenActor;
19 // A class that handles the WebUI hooks for the app launch splash screen.
20 class AppLaunchSplashScreenHandler
21 : public BaseScreenHandler,
22 public AppLaunchSplashScreenActor,
23 public NetworkStateInformer::NetworkStateInformerObserver {
24 public:
25 AppLaunchSplashScreenHandler(
26 const scoped_refptr<NetworkStateInformer>& network_state_informer,
27 ErrorScreenActor* error_screen_actor);
28 virtual ~AppLaunchSplashScreenHandler();
30 // BaseScreenHandler implementation:
31 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE;
32 virtual void Initialize() OVERRIDE;
34 // WebUIMessageHandler implementation:
35 virtual void RegisterMessages() OVERRIDE;
37 // AppLaunchSplashScreenActor implementation:
38 virtual void Show(const std::string& app_id) OVERRIDE;
39 virtual void PrepareToShow() OVERRIDE;
40 virtual void Hide() OVERRIDE;
41 virtual void ToggleNetworkConfig(bool visible) OVERRIDE;
42 virtual void UpdateAppLaunchState(AppLaunchState state) OVERRIDE;
43 virtual void SetDelegate(
44 AppLaunchSplashScreenHandler::Delegate* delegate) OVERRIDE;
45 virtual void ShowNetworkConfigureUI() OVERRIDE;
46 virtual bool IsNetworkReady() OVERRIDE;
48 // NetworkStateInformer::NetworkStateInformerObserver implementation:
49 virtual void OnNetworkReady() OVERRIDE;
50 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) OVERRIDE;
52 private:
53 void PopulateAppInfo(base::DictionaryValue* out_info);
54 void SetLaunchText(const std::string& text);
55 int GetProgressMessageFromState(AppLaunchState state);
56 void HandleConfigureNetwork();
57 void HandleCancelAppLaunch();
59 AppLaunchSplashScreenHandler::Delegate* delegate_;
60 bool show_on_init_;
61 std::string app_id_;
62 AppLaunchState state_;
64 scoped_refptr<NetworkStateInformer> network_state_informer_;
65 ErrorScreenActor* error_screen_actor_;
67 DISALLOW_COPY_AND_ASSIGN(AppLaunchSplashScreenHandler);
70 } // namespace chromeos
72 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDLER_H_