OLD | NEW |
| (Empty) |
1 // Copyright (c) 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. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_UI_APP_LAUNCH_VIEW_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_UI_APP_LAUNCH_VIEW_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "base/callback.h" | |
12 #include "content/public/browser/web_contents_observer.h" | |
13 #include "ui/views/widget/widget_delegate.h" | |
14 #include "url/gurl.h" | |
15 | |
16 namespace content { | |
17 class BrowserContent; | |
18 } | |
19 | |
20 namespace views { | |
21 class WebView; | |
22 } | |
23 | |
24 namespace chromeos { | |
25 | |
26 class AppLaunchUI; | |
27 | |
28 enum AppLaunchState { | |
29 APP_LAUNCH_STATE_LOADING_AUTH_FILE, | |
30 APP_LAUNCH_STATE_LOADING_TOKEN_SERVICE, | |
31 APP_LAUNCH_STATE_PREPARING_NETWORK, | |
32 APP_LAUNCH_STATE_INSTALLING_APPLICATION, | |
33 }; | |
34 | |
35 void ShowAppLaunchSplashScreen(const std::string& app_id); | |
36 void CloseAppLaunchSplashScreen(); | |
37 void UpdateAppLaunchSplashScreenState(AppLaunchState state); | |
38 | |
39 namespace internal { | |
40 | |
41 // Shows application launch/install splash screen in exclusive app mode (kiosk). | |
42 class AppLaunchView : public views::WidgetDelegateView, | |
43 public content::WebContentsObserver { | |
44 public: | |
45 static void ShowAppLaunchSplashScreen(const std::string& app_id); | |
46 static void CloseAppLaunchSplashScreen(); | |
47 static void UpdateAppLaunchState(AppLaunchState state); | |
48 | |
49 private: | |
50 explicit AppLaunchView(const std::string& app_id); | |
51 virtual ~AppLaunchView(); | |
52 | |
53 // views::WidgetDelegate overrides. | |
54 virtual views::View* GetContentsView() OVERRIDE; | |
55 | |
56 // content::WebContentsObserver overrides. | |
57 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | |
58 | |
59 void Show(); | |
60 | |
61 // Updates UI state of the app launch splash screen. | |
62 void UpdateState(AppLaunchState state); | |
63 | |
64 // Creates and adds web contents to our view. | |
65 void AddChildWebContents(); | |
66 | |
67 // Loads the splash screen in the WebView's webcontent. If the webcontents | |
68 // don't exist, they'll be created by WebView. | |
69 void LoadSplashScreen(); | |
70 | |
71 // Initializes container window. | |
72 void InitializeWindow(); | |
73 | |
74 // Creates and shows a frameless full screen window containing our view. | |
75 void ShowWindow(); | |
76 | |
77 // Host for the extension that implements this dialog. | |
78 views::WebView* app_launch_webview_; | |
79 | |
80 // Window that holds the webview. | |
81 views::Widget* container_window_; | |
82 | |
83 const std::string app_id_; | |
84 | |
85 // Launch state. | |
86 AppLaunchState state_; | |
87 | |
88 AppLaunchUI* app_launch_ui_; // Not owned. | |
89 | |
90 DISALLOW_COPY_AND_ASSIGN(AppLaunchView); | |
91 }; | |
92 | |
93 } // namespace internal | |
94 | |
95 } // namespace chromeos | |
96 | |
97 #endif // CHROME_BROWSER_CHROMEOS_UI_APP_LAUNCH_VIEW_H_ | |
OLD | NEW |