OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UI_WEBUI_LOGIN_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEBUI_LOGIN_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEBUI_LOGIN_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEBUI_LOGIN_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class FrameObserver { | 47 class FrameObserver { |
48 public: | 48 public: |
49 // Called when a frame failed to load. | 49 // Called when a frame failed to load. |
50 virtual void OnFrameError(const std::string& frame_unique_name) = 0; | 50 virtual void OnFrameError(const std::string& frame_unique_name) = 0; |
51 }; | 51 }; |
52 | 52 |
53 // Internal class name. | 53 // Internal class name. |
54 static const char kViewClassName[]; | 54 static const char kViewClassName[]; |
55 | 55 |
56 WebUILoginView(); | 56 WebUILoginView(); |
57 virtual ~WebUILoginView(); | 57 ~WebUILoginView() override; |
58 | 58 |
59 // Initializes the webui login view. | 59 // Initializes the webui login view. |
60 virtual void Init(); | 60 virtual void Init(); |
61 | 61 |
62 // Overridden from views::View: | 62 // Overridden from views::View: |
63 virtual bool AcceleratorPressed( | 63 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
64 const ui::Accelerator& accelerator) override; | 64 const char* GetClassName() const override; |
65 virtual const char* GetClassName() const override; | 65 void RequestFocus() override; |
66 virtual void RequestFocus() override; | |
67 | 66 |
68 // Overridden from ChromeWebModalDialogManagerDelegate: | 67 // Overridden from ChromeWebModalDialogManagerDelegate: |
69 virtual web_modal::WebContentsModalDialogHost* | 68 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() |
70 GetWebContentsModalDialogHost() override; | 69 override; |
71 | 70 |
72 // Overridden from web_modal::WebContentsModalDialogHost: | 71 // Overridden from web_modal::WebContentsModalDialogHost: |
73 virtual gfx::NativeView GetHostView() const override; | 72 gfx::NativeView GetHostView() const override; |
74 virtual gfx::Point GetDialogPosition(const gfx::Size& size) override; | 73 gfx::Point GetDialogPosition(const gfx::Size& size) override; |
75 virtual gfx::Size GetMaximumDialogSize() override; | 74 gfx::Size GetMaximumDialogSize() override; |
76 virtual void AddObserver( | 75 void AddObserver(web_modal::ModalDialogHostObserver* observer) override; |
77 web_modal::ModalDialogHostObserver* observer) override; | 76 void RemoveObserver(web_modal::ModalDialogHostObserver* observer) override; |
78 virtual void RemoveObserver( | |
79 web_modal::ModalDialogHostObserver* observer) override; | |
80 | 77 |
81 // Gets the native window from the view widget. | 78 // Gets the native window from the view widget. |
82 gfx::NativeWindow GetNativeWindow() const; | 79 gfx::NativeWindow GetNativeWindow() const; |
83 | 80 |
84 // Loads given page. Should be called after Init() has been called. | 81 // Loads given page. Should be called after Init() has been called. |
85 void LoadURL(const GURL& url); | 82 void LoadURL(const GURL& url); |
86 | 83 |
87 // Returns current WebUI. | 84 // Returns current WebUI. |
88 content::WebUI* GetWebUI(); | 85 content::WebUI* GetWebUI(); |
89 | 86 |
(...skipping 19 matching lines...) Expand all Loading... |
109 // Let suppress emission of this signal. | 106 // Let suppress emission of this signal. |
110 void set_should_emit_login_prompt_visible(bool emit) { | 107 void set_should_emit_login_prompt_visible(bool emit) { |
111 should_emit_login_prompt_visible_ = emit; | 108 should_emit_login_prompt_visible_ = emit; |
112 } | 109 } |
113 | 110 |
114 void AddFrameObserver(FrameObserver* frame_observer); | 111 void AddFrameObserver(FrameObserver* frame_observer); |
115 void RemoveFrameObserver(FrameObserver* frame_observer); | 112 void RemoveFrameObserver(FrameObserver* frame_observer); |
116 | 113 |
117 protected: | 114 protected: |
118 // Overridden from views::View: | 115 // Overridden from views::View: |
119 virtual void Layout() override; | 116 void Layout() override; |
120 virtual void OnLocaleChanged() override; | 117 void OnLocaleChanged() override; |
121 virtual void ChildPreferredSizeChanged(View* child) override; | 118 void ChildPreferredSizeChanged(View* child) override; |
122 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) override; | 119 void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
123 | 120 |
124 // Overridden from content::NotificationObserver. | 121 // Overridden from content::NotificationObserver. |
125 virtual void Observe(int type, | 122 void Observe(int type, |
126 const content::NotificationSource& source, | 123 const content::NotificationSource& source, |
127 const content::NotificationDetails& details) override; | 124 const content::NotificationDetails& details) override; |
128 | 125 |
129 // WebView for rendering a webpage as a webui login. | 126 // WebView for rendering a webpage as a webui login. |
130 views::WebView* webui_login_; | 127 views::WebView* webui_login_; |
131 | 128 |
132 private: | 129 private: |
133 // Map type for the accelerator-to-identifier map. | 130 // Map type for the accelerator-to-identifier map. |
134 typedef std::map<ui::Accelerator, std::string> AccelMap; | 131 typedef std::map<ui::Accelerator, std::string> AccelMap; |
135 | 132 |
136 // Overridden from content::WebContentsDelegate. | 133 // Overridden from content::WebContentsDelegate. |
137 virtual bool HandleContextMenu( | 134 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
138 const content::ContextMenuParams& params) override; | 135 void HandleKeyboardEvent( |
139 virtual void HandleKeyboardEvent( | |
140 content::WebContents* source, | 136 content::WebContents* source, |
141 const content::NativeWebKeyboardEvent& event) override; | 137 const content::NativeWebKeyboardEvent& event) override; |
142 virtual bool IsPopupOrPanel( | 138 bool IsPopupOrPanel(const content::WebContents* source) const override; |
143 const content::WebContents* source) const override; | 139 bool TakeFocus(content::WebContents* source, bool reverse) override; |
144 virtual bool TakeFocus(content::WebContents* source, bool reverse) override; | 140 void RequestMediaAccessPermission( |
145 virtual void RequestMediaAccessPermission( | |
146 content::WebContents* web_contents, | 141 content::WebContents* web_contents, |
147 const content::MediaStreamRequest& request, | 142 const content::MediaStreamRequest& request, |
148 const content::MediaResponseCallback& callback) override; | 143 const content::MediaResponseCallback& callback) override; |
149 virtual bool CheckMediaAccessPermission( | 144 bool CheckMediaAccessPermission(content::WebContents* web_contents, |
150 content::WebContents* web_contents, | 145 const GURL& security_origin, |
151 const GURL& security_origin, | 146 content::MediaStreamType type) override; |
152 content::MediaStreamType type) override; | 147 bool PreHandleGestureEvent(content::WebContents* source, |
153 virtual bool PreHandleGestureEvent( | 148 const blink::WebGestureEvent& event) override; |
154 content::WebContents* source, | |
155 const blink::WebGestureEvent& event) override; | |
156 | 149 |
157 // Overridden from content::WebContentsObserver. | 150 // Overridden from content::WebContentsObserver. |
158 virtual void DidFailProvisionalLoad( | 151 void DidFailProvisionalLoad(content::RenderFrameHost* render_frame_host, |
159 content::RenderFrameHost* render_frame_host, | 152 const GURL& validated_url, |
160 const GURL& validated_url, | 153 int error_code, |
161 int error_code, | 154 const base::string16& error_description) override; |
162 const base::string16& error_description) override; | |
163 | 155 |
164 // Performs series of actions when login prompt is considered | 156 // Performs series of actions when login prompt is considered |
165 // to be ready and visible. | 157 // to be ready and visible. |
166 // 1. Emits LoginPromptVisible signal if needed | 158 // 1. Emits LoginPromptVisible signal if needed |
167 // 2. Notifies OOBE/sign classes. | 159 // 2. Notifies OOBE/sign classes. |
168 void OnLoginPromptVisible(); | 160 void OnLoginPromptVisible(); |
169 | 161 |
170 // Called when focus is returned from status area. | 162 // Called when focus is returned from status area. |
171 // |reverse| is true when focus is traversed backwards (using Shift-Tab). | 163 // |reverse| is true when focus is traversed backwards (using Shift-Tab). |
172 void ReturnFocus(bool reverse); | 164 void ReturnFocus(bool reverse); |
(...skipping 26 matching lines...) Expand all Loading... |
199 // TODO(gbillock): See if we can get rid of this. Perhaps in favor of | 191 // TODO(gbillock): See if we can get rid of this. Perhaps in favor of |
200 // in-content styled popups or something? There oughtta be a way... | 192 // in-content styled popups or something? There oughtta be a way... |
201 scoped_ptr<web_modal::PopupManager> popup_manager_; | 193 scoped_ptr<web_modal::PopupManager> popup_manager_; |
202 | 194 |
203 DISALLOW_COPY_AND_ASSIGN(WebUILoginView); | 195 DISALLOW_COPY_AND_ASSIGN(WebUILoginView); |
204 }; | 196 }; |
205 | 197 |
206 } // namespace chromeos | 198 } // namespace chromeos |
207 | 199 |
208 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEBUI_LOGIN_VIEW_H_ | 200 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEBUI_LOGIN_VIEW_H_ |
OLD | NEW |