OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/observer_list.h" |
12 #include "chrome/browser/extensions/scoped_gaia_auth_extension.h" | 13 #include "chrome/browser/extensions/scoped_gaia_auth_extension.h" |
| 14 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h" |
| 15 #include "components/web_modal/web_contents_modal_dialog_host.h" |
13 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
15 #include "content/public/browser/web_contents_delegate.h" | 18 #include "content/public/browser/web_contents_delegate.h" |
16 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 19 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
17 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
18 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
19 | 22 |
20 class GURL; | 23 class GURL; |
21 | 24 |
22 namespace content { | 25 namespace content { |
23 class WebUI; | 26 class WebUI; |
24 } | 27 } |
25 | 28 |
26 namespace views { | 29 namespace views { |
27 class View; | 30 class View; |
28 class WebView; | 31 class WebView; |
29 class Widget; | 32 class Widget; |
30 } | 33 } |
31 | 34 |
32 namespace chromeos { | 35 namespace chromeos { |
33 | 36 |
34 // View used to render a WebUI supporting Widget. This widget is used for the | 37 // View used to render a WebUI supporting Widget. This widget is used for the |
35 // WebUI based start up and lock screens. It contains a WebView. | 38 // WebUI based start up and lock screens. It contains a WebView. |
36 class WebUILoginView : public views::View, | 39 class WebUILoginView : public views::View, |
37 public content::WebContentsDelegate, | 40 public content::WebContentsDelegate, |
38 public content::NotificationObserver { | 41 public content::NotificationObserver, |
| 42 public ChromeWebModalDialogManagerDelegate, |
| 43 public web_modal::WebContentsModalDialogHost { |
39 public: | 44 public: |
40 // Internal class name. | 45 // Internal class name. |
41 static const char kViewClassName[]; | 46 static const char kViewClassName[]; |
42 | 47 |
43 WebUILoginView(); | 48 WebUILoginView(); |
44 virtual ~WebUILoginView(); | 49 virtual ~WebUILoginView(); |
45 | 50 |
46 // Initializes the webui login view. | 51 // Initializes the webui login view. |
47 virtual void Init(views::Widget* login_window); | 52 virtual void Init(views::Widget* login_window); |
48 | 53 |
49 // Overridden from views::Views: | 54 // Overridden from views::Views: |
50 virtual bool AcceleratorPressed( | 55 virtual bool AcceleratorPressed( |
51 const ui::Accelerator& accelerator) OVERRIDE; | 56 const ui::Accelerator& accelerator) OVERRIDE; |
52 virtual const char* GetClassName() const OVERRIDE; | 57 virtual const char* GetClassName() const OVERRIDE; |
53 | 58 |
| 59 // Overridden from ChromeWebModalDialogManagerDelegate: |
| 60 virtual web_modal::WebContentsModalDialogHost* |
| 61 GetWebContentsModalDialogHost() OVERRIDE; |
| 62 |
| 63 // Overridden from web_modal::WebContentsModalDialogHost: |
| 64 virtual gfx::NativeView GetHostView() const OVERRIDE; |
| 65 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE; |
| 66 virtual void AddObserver( |
| 67 web_modal::WebContentsModalDialogHostObserver* observer) OVERRIDE; |
| 68 virtual void RemoveObserver( |
| 69 web_modal::WebContentsModalDialogHostObserver* observer) OVERRIDE; |
| 70 |
54 // Called when WebUI window is created. | 71 // Called when WebUI window is created. |
55 virtual void OnWindowCreated(); | 72 virtual void OnWindowCreated(); |
56 | 73 |
57 // Gets the native window from the view widget. | 74 // Gets the native window from the view widget. |
58 gfx::NativeWindow GetNativeWindow() const; | 75 gfx::NativeWindow GetNativeWindow() const; |
59 | 76 |
60 // Invokes SetWindowType for the window. This is invoked during startup and | 77 // Invokes SetWindowType for the window. This is invoked during startup and |
61 // after we've painted. | 78 // after we've painted. |
62 void UpdateWindowType(); | 79 void UpdateWindowType(); |
63 | 80 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 171 |
155 // Should we emit the login-prompt-visible signal when the login page is | 172 // Should we emit the login-prompt-visible signal when the login page is |
156 // displayed? | 173 // displayed? |
157 bool should_emit_login_prompt_visible_; | 174 bool should_emit_login_prompt_visible_; |
158 | 175 |
159 // True to forward keyboard event. | 176 // True to forward keyboard event. |
160 bool forward_keyboard_event_; | 177 bool forward_keyboard_event_; |
161 | 178 |
162 scoped_ptr<ScopedGaiaAuthExtension> auth_extension_; | 179 scoped_ptr<ScopedGaiaAuthExtension> auth_extension_; |
163 | 180 |
| 181 ObserverList<web_modal::WebContentsModalDialogHostObserver> observer_list_; |
| 182 |
164 DISALLOW_COPY_AND_ASSIGN(WebUILoginView); | 183 DISALLOW_COPY_AND_ASSIGN(WebUILoginView); |
165 }; | 184 }; |
166 | 185 |
167 } // namespace chromeos | 186 } // namespace chromeos |
168 | 187 |
169 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ | 188 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ |
OLD | NEW |