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 CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/public/browser/native_web_keyboard_event.h" | 10 #include "content/public/browser/native_web_keyboard_event.h" |
11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
12 #include "ipc/ipc_sender.h" | 12 #include "ipc/ipc_sender.h" |
13 #include "third_party/WebKit/public/web/WebInputEvent.h" | 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
14 #include "third_party/WebKit/public/web/WebTextDirection.h" | 14 #include "third_party/WebKit/public/web/WebTextDirection.h" |
15 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
16 #include "ui/surface/transport_dib.h" | 16 #include "ui/surface/transport_dib.h" |
17 | 17 |
18 #if defined(TOOLKIT_GTK) | 18 #if defined(TOOLKIT_GTK) |
19 #include "ui/base/x/x11_util.h" | 19 #include "ui/base/x/x11_util.h" |
20 #elif defined(OS_MACOSX) | 20 #elif defined(OS_MACOSX) |
21 #include "skia/ext/platform_device.h" | 21 #include "skia/ext/platform_device.h" |
22 #endif | 22 #endif |
23 | 23 |
24 class SkBitmap; | 24 class SkBitmap; |
25 | 25 |
26 namespace gfx { | 26 namespace gfx { |
27 class Rect; | 27 class Rect; |
28 } | 28 } |
29 | 29 |
30 namespace WebKit { | 30 namespace blink { |
31 class WebMouseEvent; | 31 class WebMouseEvent; |
32 struct WebScreenInfo; | 32 struct WebScreenInfo; |
33 } | 33 } |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 | 36 |
37 class RenderProcessHost; | 37 class RenderProcessHost; |
38 class RenderWidgetHostImpl; | 38 class RenderWidgetHostImpl; |
39 class RenderWidgetHostIterator; | 39 class RenderWidgetHostIterator; |
40 class RenderWidgetHostView; | 40 class RenderWidgetHostView; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // CancelUpdateTextDirection(); | 168 // CancelUpdateTextDirection(); |
169 // } | 169 // } |
170 // } else if (key_event.type == WebKeyboardEvent::KEY_UP) { | 170 // } else if (key_event.type == WebKeyboardEvent::KEY_UP) { |
171 // NotifyTextDirection(); | 171 // NotifyTextDirection(); |
172 // } | 172 // } |
173 // Once we cancel updating the text direction, we have to ignore all | 173 // Once we cancel updating the text direction, we have to ignore all |
174 // succeeding UpdateTextDirection() requests until calling | 174 // succeeding UpdateTextDirection() requests until calling |
175 // NotifyTextDirection(). (We may receive keydown events even after we | 175 // NotifyTextDirection(). (We may receive keydown events even after we |
176 // canceled updating the text direction because of auto-repeat.) | 176 // canceled updating the text direction because of auto-repeat.) |
177 // Note: we cannot undo this change for compatibility with Firefox and IE. | 177 // Note: we cannot undo this change for compatibility with Firefox and IE. |
178 virtual void UpdateTextDirection(WebKit::WebTextDirection direction) = 0; | 178 virtual void UpdateTextDirection(blink::WebTextDirection direction) = 0; |
179 virtual void NotifyTextDirection() = 0; | 179 virtual void NotifyTextDirection() = 0; |
180 | 180 |
181 virtual void Focus() = 0; | 181 virtual void Focus() = 0; |
182 virtual void Blur() = 0; | 182 virtual void Blur() = 0; |
183 | 183 |
184 // Sets whether the renderer should show controls in an active state. On all | 184 // Sets whether the renderer should show controls in an active state. On all |
185 // platforms except mac, that's the same as focused. On mac, the frontmost | 185 // platforms except mac, that's the same as focused. On mac, the frontmost |
186 // window will show active controls even if the focus is not in the web | 186 // window will show active controls even if the focus is not in the web |
187 // contents, but e.g. in the omnibox. | 187 // contents, but e.g. in the omnibox. |
188 virtual void SetActive(bool active) = 0; | 188 virtual void SetActive(bool active) = 0; |
(...skipping 25 matching lines...) Expand all Loading... |
214 virtual bool CopyFromBackingStoreToCGContext(const CGRect& dest_rect, | 214 virtual bool CopyFromBackingStoreToCGContext(const CGRect& dest_rect, |
215 CGContextRef target) = 0; | 215 CGContextRef target) = 0; |
216 #endif | 216 #endif |
217 | 217 |
218 // Send a command to the renderer to turn on full accessibility. | 218 // Send a command to the renderer to turn on full accessibility. |
219 virtual void EnableFullAccessibilityMode() = 0; | 219 virtual void EnableFullAccessibilityMode() = 0; |
220 | 220 |
221 // Forwards the given message to the renderer. These are called by | 221 // Forwards the given message to the renderer. These are called by |
222 // the view when it has received a message. | 222 // the view when it has received a message. |
223 virtual void ForwardMouseEvent( | 223 virtual void ForwardMouseEvent( |
224 const WebKit::WebMouseEvent& mouse_event) = 0; | 224 const blink::WebMouseEvent& mouse_event) = 0; |
225 virtual void ForwardWheelEvent( | 225 virtual void ForwardWheelEvent( |
226 const WebKit::WebMouseWheelEvent& wheel_event) = 0; | 226 const blink::WebMouseWheelEvent& wheel_event) = 0; |
227 virtual void ForwardKeyboardEvent( | 227 virtual void ForwardKeyboardEvent( |
228 const NativeWebKeyboardEvent& key_event) = 0; | 228 const NativeWebKeyboardEvent& key_event) = 0; |
229 | 229 |
230 virtual const gfx::Vector2d& GetLastScrollOffset() const = 0; | 230 virtual const gfx::Vector2d& GetLastScrollOffset() const = 0; |
231 | 231 |
232 virtual RenderProcessHost* GetProcess() const = 0; | 232 virtual RenderProcessHost* GetProcess() const = 0; |
233 | 233 |
234 virtual int GetRoutingID() const = 0; | 234 virtual int GetRoutingID() const = 0; |
235 | 235 |
236 // Gets the View of this RenderWidgetHost. Can be NULL, e.g. if the | 236 // Gets the View of this RenderWidgetHost. Can be NULL, e.g. if the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 // Add/remove a callback that can handle key presses without requiring focus. | 292 // Add/remove a callback that can handle key presses without requiring focus. |
293 typedef base::Callback<bool(const NativeWebKeyboardEvent&)> | 293 typedef base::Callback<bool(const NativeWebKeyboardEvent&)> |
294 KeyPressEventCallback; | 294 KeyPressEventCallback; |
295 virtual void AddKeyPressEventCallback( | 295 virtual void AddKeyPressEventCallback( |
296 const KeyPressEventCallback& callback) = 0; | 296 const KeyPressEventCallback& callback) = 0; |
297 virtual void RemoveKeyPressEventCallback( | 297 virtual void RemoveKeyPressEventCallback( |
298 const KeyPressEventCallback& callback) = 0; | 298 const KeyPressEventCallback& callback) = 0; |
299 | 299 |
300 // Add/remove a callback that can handle all kinds of mouse events. | 300 // Add/remove a callback that can handle all kinds of mouse events. |
301 typedef base::Callback<bool(const WebKit::WebMouseEvent&)> MouseEventCallback; | 301 typedef base::Callback<bool(const blink::WebMouseEvent&)> MouseEventCallback; |
302 virtual void AddMouseEventCallback(const MouseEventCallback& callback) = 0; | 302 virtual void AddMouseEventCallback(const MouseEventCallback& callback) = 0; |
303 virtual void RemoveMouseEventCallback(const MouseEventCallback& callback) = 0; | 303 virtual void RemoveMouseEventCallback(const MouseEventCallback& callback) = 0; |
304 | 304 |
305 // Get the screen info corresponding to this render widget. | 305 // Get the screen info corresponding to this render widget. |
306 virtual void GetWebScreenInfo(WebKit::WebScreenInfo* result) = 0; | 306 virtual void GetWebScreenInfo(blink::WebScreenInfo* result) = 0; |
307 | 307 |
308 // Grabs snapshot from renderer side and returns the bitmap to a callback. | 308 // Grabs snapshot from renderer side and returns the bitmap to a callback. |
309 // If |src_rect| is empty, the whole contents is copied. This is an expensive | 309 // If |src_rect| is empty, the whole contents is copied. This is an expensive |
310 // operation due to the IPC, but it can be used as a fallback method when | 310 // operation due to the IPC, but it can be used as a fallback method when |
311 // CopyFromBackingStore fails due to the backing store not being available or, | 311 // CopyFromBackingStore fails due to the backing store not being available or, |
312 // in composited mode, when the accelerated surface is not available to the | 312 // in composited mode, when the accelerated surface is not available to the |
313 // browser side. | 313 // browser side. |
314 virtual void GetSnapshotFromRenderer( | 314 virtual void GetSnapshotFromRenderer( |
315 const gfx::Rect& src_subrect, | 315 const gfx::Rect& src_subrect, |
316 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; | 316 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; |
317 | 317 |
318 protected: | 318 protected: |
319 friend class RenderWidgetHostImpl; | 319 friend class RenderWidgetHostImpl; |
320 | 320 |
321 // Retrieves the implementation class. Intended only for code | 321 // Retrieves the implementation class. Intended only for code |
322 // within content/. This method is necessary because | 322 // within content/. This method is necessary because |
323 // RenderWidgetHost is the root of a diamond inheritance pattern, so | 323 // RenderWidgetHost is the root of a diamond inheritance pattern, so |
324 // subclasses inherit it virtually, which removes our ability to | 324 // subclasses inherit it virtually, which removes our ability to |
325 // static_cast to the subclass. | 325 // static_cast to the subclass. |
326 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0; | 326 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0; |
327 }; | 327 }; |
328 | 328 |
329 } // namespace content | 329 } // namespace content |
330 | 330 |
331 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ | 331 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ |
OLD | NEW |