OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_LOGIN_WEBUI_LOGIN_DISPLAY_HOST_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_HOST_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | |
12 #include "content/public/browser/notification_registrar.h" | |
13 #include "content/public/browser/web_contents_observer.h" | |
14 | |
15 namespace gfx { | |
16 class Rect; | |
17 } // namespace gfx | |
18 | |
19 namespace chromeos { | |
20 | |
21 class OobeUI; | |
22 class WebUILoginDisplay; | |
23 class WebUILoginView; | |
24 | |
25 // WebUI-specific implementation of the OOBE/login screen host. Uses | |
26 // WebUILoginDisplay as the login screen UI implementation, | |
27 class WebUILoginDisplayHost : public LoginDisplayHostImpl, | |
28 public content::WebContentsObserver { | |
29 public: | |
30 explicit WebUILoginDisplayHost(const gfx::Rect& background_bounds); | |
31 virtual ~WebUILoginDisplayHost(); | |
32 | |
33 // LoginDisplayHost implementation: | |
34 virtual LoginDisplay* CreateLoginDisplay( | |
35 LoginDisplay::Delegate* delegate) OVERRIDE; | |
36 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; | |
37 virtual views::Widget* GetWidget() const OVERRIDE; | |
38 virtual void OpenProxySettings() OVERRIDE; | |
39 virtual void SetOobeProgressBarVisible(bool visible) OVERRIDE; | |
40 virtual void SetShutdownButtonEnabled(bool enable) OVERRIDE; | |
41 virtual void SetStatusAreaVisible(bool visible) OVERRIDE; | |
42 virtual void StartWizard(const std::string& first_screen_name, | |
43 DictionaryValue* screen_parameters) OVERRIDE; | |
44 virtual void StartSignInScreen() OVERRIDE; | |
45 virtual void OnPreferencesChanged() OVERRIDE; | |
46 | |
47 // LoginDisplayHostImpl overrides: | |
48 virtual WizardController* CreateWizardController() OVERRIDE; | |
49 virtual void OnBrowserCreated() OVERRIDE; | |
50 | |
51 // Returns instance of the OOBE WebUI. | |
52 OobeUI* GetOobeUI() const; | |
53 | |
54 // Returns the current login view. | |
55 WebUILoginView* login_view() { return login_view_; } | |
56 | |
57 protected: | |
58 // content::NotificationObserver implementation. | |
59 virtual void Observe(int type, | |
60 const content::NotificationSource& source, | |
61 const content::NotificationDetails& details) OVERRIDE; | |
62 | |
63 private: | |
64 // Overridden from content::WebContentsObserver: | |
65 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | |
66 | |
67 // Loads given URL. Creates WebUILoginView if needed. | |
68 void LoadURL(const GURL& url); | |
69 | |
70 // Shows OOBE/sign in WebUI that was previously initialized in hidden state. | |
71 void ShowWebUI(); | |
72 | |
73 // Starts postponed WebUI (OOBE/sign in) if it was waiting for | |
74 // wallpaper animation end. | |
75 void StartPostponedWebUI(); | |
76 | |
77 // Initializes |login_window_| and |login_view_| fields if needed. | |
78 void InitLoginWindowAndView(); | |
79 | |
80 // Closes |login_window_| and resets |login_window_| and | |
81 // |login_view_| fields. | |
82 void ResetLoginWindowAndView(); | |
83 | |
84 // Container of the screen we are displaying. | |
85 views::Widget* login_window_; | |
86 | |
87 // Container of the view we are displaying. | |
88 WebUILoginView* login_view_; | |
89 | |
90 // Login display we are using. | |
91 WebUILoginDisplay* webui_login_display_; | |
92 | |
93 // True if alternate boot animation is enabled. | |
94 bool is_boot_animation2_enabled_; | |
95 | |
96 // True if the login display is the current screen. | |
97 bool is_showing_login_; | |
98 | |
99 // True if NOTIFICATION_WALLPAPER_ANIMATION_FINISHED notification has been | |
100 // received. | |
101 bool is_wallpaper_loaded_; | |
102 | |
103 // Stores status area current visibility to be applied once login WebUI | |
104 // is shown. | |
105 bool status_area_saved_visibility_; | |
106 | |
107 // If true, WebUI is initialized in a hidden state and shown after the | |
108 // wallpaper animation is finished (when it is enabled) or the user pods have | |
109 // been loaded (otherwise). | |
110 // By default is true. Could be used to tune performance if needed. | |
111 bool initialize_webui_hidden_; | |
112 | |
113 // True if WebUI is initialized in hidden state and we're waiting for | |
114 // wallpaper load animation to finish. | |
115 bool waiting_for_wallpaper_load_; | |
116 | |
117 // True if WebUI is initialized in hidden state and we're waiting for user | |
118 // pods to load. | |
119 bool waiting_for_user_pods_; | |
120 | |
121 content::NotificationRegistrar registrar_; | |
122 | |
123 // How many times renderer has crashed. | |
124 int crash_count_; | |
125 | |
126 // Way to restore if renderer have crashed. | |
127 enum { | |
128 RESTORE_UNKNOWN, | |
129 RESTORE_WIZARD, | |
130 RESTORE_SIGN_IN | |
131 } restore_path_; | |
132 | |
133 // Stored parameters for StartWizard, required to restore in case of crash. | |
134 std::string wizard_first_screen_name_; | |
135 scoped_ptr<DictionaryValue> wizard_screen_parameters_; | |
136 | |
137 // Old value of the ash::internal::kIgnoreSoloWindowFramePainterPolicy | |
138 // property of the root window for |login_window_|. | |
139 bool old_ignore_solo_window_frame_painter_policy_value_; | |
140 | |
141 DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplayHost); | |
142 }; | |
143 | |
144 } // namespace chromeos | |
145 | |
146 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_HOST_H_ | |
OLD | NEW |