OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/chromeos/login/login_html_dialog.h" | 9 #include "chrome/browser/chromeos/login/login_html_dialog.h" |
10 #include "chrome/browser/chromeos/status/status_area_host.h" | 10 #include "chrome/browser/chromeos/status/status_area_button.h" |
11 #include "chrome/browser/tab_first_render_watcher.h" | 11 #include "chrome/browser/tab_first_render_watcher.h" |
12 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" | 12 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" |
13 #include "content/browser/tab_contents/tab_contents_delegate.h" | 13 #include "content/browser/tab_contents/tab_contents_delegate.h" |
14 #include "views/widget/widget_delegate.h" | 14 #include "views/widget/widget_delegate.h" |
15 | 15 |
16 class DOMView; | 16 class DOMView; |
17 class GURL; | 17 class GURL; |
18 class Profile; | 18 class Profile; |
19 class WebUI; | 19 class WebUI; |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 class View; | 22 class View; |
23 class Widget; | 23 class Widget; |
24 } | 24 } |
25 | 25 |
26 namespace chromeos { | 26 namespace chromeos { |
27 | 27 |
28 class StatusAreaView; | 28 class StatusAreaViewChromeos; |
29 | 29 |
30 // View used to render a WebUI supporting Widget. This widget is used for the | 30 // View used to render a WebUI supporting Widget. This widget is used for the |
31 // WebUI based start up and lock screens. It contains a StatusAreaView and | 31 // WebUI based start up and lock screens. It contains a StatusAreaView and |
32 // DOMView. | 32 // DOMView. |
33 class WebUILoginView : public views::WidgetDelegateView, | 33 class WebUILoginView : public views::WidgetDelegateView, |
34 public StatusAreaHost, | 34 public StatusAreaButton::Delegate, |
35 public TabContentsDelegate, | 35 public TabContentsDelegate, |
36 public chromeos::LoginHtmlDialog::Delegate, | 36 public LoginHtmlDialog::Delegate, |
37 public TabFirstRenderWatcher::Delegate { | 37 public TabFirstRenderWatcher::Delegate { |
38 public: | 38 public: |
39 static const int kStatusAreaCornerPadding; | 39 static const int kStatusAreaCornerPadding; |
40 | 40 |
41 WebUILoginView(); | 41 WebUILoginView(); |
42 virtual ~WebUILoginView(); | 42 virtual ~WebUILoginView(); |
43 | 43 |
44 // Initializes the webui login view. | 44 // Initializes the webui login view. |
45 virtual void Init(views::Widget* login_window); | 45 virtual void Init(views::Widget* login_window); |
46 | 46 |
47 // Overridden from views::Views: | 47 // Overridden from views::Views: |
48 virtual bool AcceleratorPressed( | 48 virtual bool AcceleratorPressed( |
49 const views::Accelerator& accelerator) OVERRIDE; | 49 const views::Accelerator& accelerator) OVERRIDE; |
50 virtual std::string GetClassName() const OVERRIDE; | 50 virtual std::string GetClassName() const OVERRIDE; |
51 | 51 |
52 // Overridden from StatusAreaHost: | |
53 virtual gfx::NativeWindow GetNativeWindow() const; | |
54 | |
55 // Called when WebUI window is created. | 52 // Called when WebUI window is created. |
56 virtual void OnWindowCreated(); | 53 virtual void OnWindowCreated(); |
57 | 54 |
| 55 // Gets the native window from the view widget. |
| 56 gfx::NativeWindow GetNativeWindow() const; |
| 57 |
58 // Invokes SetWindowType for the window. This is invoked during startup and | 58 // Invokes SetWindowType for the window. This is invoked during startup and |
59 // after we've painted. | 59 // after we've painted. |
60 void UpdateWindowType(); | 60 void UpdateWindowType(); |
61 | 61 |
62 // Loads given page. Should be called after Init() has been called. | 62 // Loads given page. Should be called after Init() has been called. |
63 void LoadURL(const GURL& url); | 63 void LoadURL(const GURL& url); |
64 | 64 |
65 // Returns current WebUI. | 65 // Returns current WebUI. |
66 WebUI* GetWebUI(); | 66 WebUI* GetWebUI(); |
67 | 67 |
68 // Toggles whether status area is enabled. | 68 // Toggles whether status area is enabled. |
69 void SetStatusAreaEnabled(bool enable); | 69 void SetStatusAreaEnabled(bool enable); |
70 | 70 |
71 // Toggles status area visibility. | 71 // Toggles status area visibility. |
72 void SetStatusAreaVisible(bool visible); | 72 void SetStatusAreaVisible(bool visible); |
73 | 73 |
74 protected: | 74 protected: |
75 // Overridden from views::View: | 75 // Overridden from views::View: |
76 virtual void Layout() OVERRIDE; | 76 virtual void Layout() OVERRIDE; |
77 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 77 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
78 | 78 |
79 // Overridden from StatusAreaHost: | 79 // Overridden from StatusAreaButton::Delegate: |
80 virtual Profile* GetProfile() const OVERRIDE; | 80 virtual bool ShouldExecuteStatusAreaCommand( |
81 virtual void ExecuteBrowserCommand(int id) const OVERRIDE; | 81 const views::View* button_view, int command_id) const OVERRIDE; |
82 virtual bool ShouldOpenButtonOptions( | 82 virtual void ExecuteStatusAreaCommand( |
83 const views::View* button_view) const OVERRIDE; | 83 const views::View* button_view, int command_id) OVERRIDE; |
84 virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE; | 84 virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const OVERRIDE; |
85 virtual ScreenMode GetScreenMode() const OVERRIDE; | 85 virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE; |
86 virtual TextStyle GetTextStyle() const OVERRIDE; | |
87 virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; | 86 virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; |
88 | 87 |
89 // Overridden from LoginHtmlDialog::Delegate: | 88 // Overridden from LoginHtmlDialog::Delegate: |
90 virtual void OnDialogClosed() OVERRIDE; | 89 virtual void OnDialogClosed() OVERRIDE; |
91 virtual void OnLocaleChanged() OVERRIDE; | 90 virtual void OnLocaleChanged() OVERRIDE; |
92 | 91 |
93 // TabFirstRenderWatcher::Delegate implementation. | 92 // TabFirstRenderWatcher::Delegate implementation. |
94 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; | 93 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; |
95 virtual void OnTabMainFrameLoaded() OVERRIDE; | 94 virtual void OnTabMainFrameLoaded() OVERRIDE; |
96 virtual void OnTabMainFrameFirstRender() OVERRIDE; | 95 virtual void OnTabMainFrameFirstRender() OVERRIDE; |
97 | 96 |
98 // Creates and adds the status area (separate window). | 97 // Creates and adds the status area (separate window). |
99 virtual void InitStatusArea(); | 98 virtual void InitStatusArea(); |
100 | 99 |
101 StatusAreaView* status_area_; | 100 StatusAreaViewChromeos* status_area_; |
102 | 101 |
103 // DOMView for rendering a webpage as a webui login. | 102 // DOMView for rendering a webpage as a webui login. |
104 DOMView* webui_login_; | 103 DOMView* webui_login_; |
105 | 104 |
106 private: | 105 private: |
107 // Map type for the accelerator-to-identifier map. | 106 // Map type for the accelerator-to-identifier map. |
108 typedef std::map<views::Accelerator, std::string> AccelMap; | 107 typedef std::map<views::Accelerator, std::string> AccelMap; |
109 | 108 |
110 // Overridden from TabContentsDelegate. | 109 // Overridden from TabContentsDelegate. |
111 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; | 110 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 142 |
144 // Caches StatusArea visibility setting before it has been initialized. | 143 // Caches StatusArea visibility setting before it has been initialized. |
145 bool status_area_visibility_on_init_; | 144 bool status_area_visibility_on_init_; |
146 | 145 |
147 DISALLOW_COPY_AND_ASSIGN(WebUILoginView); | 146 DISALLOW_COPY_AND_ASSIGN(WebUILoginView); |
148 }; | 147 }; |
149 | 148 |
150 } // namespace chromeos | 149 } // namespace chromeos |
151 | 150 |
152 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ | 151 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_VIEW_H_ |
OLD | NEW |