Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / app_launch_splash_screen_handler.h
blobf2c10b5f5b1dd1f4f9e7228f850d961fae9e3811
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;
47 // NetworkStateInformer::NetworkStateInformerObserver implementation:
48 virtual void OnNetworkReady() OVERRIDE;
49 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) OVERRIDE;
51 private:
52 void PopulateAppInfo(base::DictionaryValue* out_info);
53 void SetLaunchText(const std::string& text);
54 int GetProgressMessageFromState(AppLaunchState state);
55 void HandleConfigureNetwork();
56 void HandleCancelAppLaunch();
58 AppLaunchSplashScreenHandler::Delegate* delegate_;
59 bool show_on_init_;
60 std::string app_id_;
61 AppLaunchState state_;
63 scoped_refptr<NetworkStateInformer> network_state_informer_;
64 ErrorScreenActor* error_screen_actor_;
66 DISALLOW_COPY_AND_ASSIGN(AppLaunchSplashScreenHandler);
69 } // namespace chromeos
71 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_APP_LAUNCH_SPLASH_SCREEN_HANDLER_H_