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/keyboard_listener.h" | 10 #include "content/public/browser/keyboard_listener.h" |
(...skipping 11 matching lines...) Loading... |
22 #include "skia/ext/platform_device.h" | 22 #include "skia/ext/platform_device.h" |
23 #endif | 23 #endif |
24 | 24 |
25 class SkBitmap; | 25 class SkBitmap; |
26 | 26 |
27 namespace gfx { | 27 namespace gfx { |
28 class Rect; | 28 class Rect; |
29 } | 29 } |
30 | 30 |
31 namespace WebKit { | 31 namespace WebKit { |
| 32 class WebMouseEvent; |
32 struct WebScreenInfo; | 33 struct WebScreenInfo; |
33 } | 34 } |
34 | 35 |
35 namespace content { | 36 namespace content { |
36 | 37 |
37 class RenderProcessHost; | 38 class RenderProcessHost; |
38 class RenderWidgetHostImpl; | 39 class RenderWidgetHostImpl; |
39 class RenderWidgetHostView; | 40 class RenderWidgetHostView; |
40 | 41 |
41 // A RenderWidgetHost manages the browser side of a browser<->renderer | 42 // A RenderWidgetHost manages the browser side of a browser<->renderer |
(...skipping 247 matching lines...) Loading... |
289 // Access to the implementation's IPC::Listener::OnMessageReceived. Intended | 290 // Access to the implementation's IPC::Listener::OnMessageReceived. Intended |
290 // only for test code. | 291 // only for test code. |
291 | 292 |
292 // Add a keyboard listener that can handle key presses without requiring | 293 // Add a keyboard listener that can handle key presses without requiring |
293 // focus. | 294 // focus. |
294 virtual void AddKeyboardListener(KeyboardListener* listener) = 0; | 295 virtual void AddKeyboardListener(KeyboardListener* listener) = 0; |
295 | 296 |
296 // Remove a keyboard listener. | 297 // Remove a keyboard listener. |
297 virtual void RemoveKeyboardListener(KeyboardListener* listener) = 0; | 298 virtual void RemoveKeyboardListener(KeyboardListener* listener) = 0; |
298 | 299 |
| 300 // Add/remove a callback that can handle all kinds of mouse events. |
| 301 typedef base::Callback<bool(const WebKit::WebMouseEvent&)> MouseEventCallback; |
| 302 virtual void AddMouseEventCallback(const MouseEventCallback& callback) = 0; |
| 303 virtual void RemoveMouseEventCallback(const MouseEventCallback& callback) = 0; |
| 304 |
299 // Get the screen info corresponding to this render widget. | 305 // Get the screen info corresponding to this render widget. |
300 virtual void GetWebScreenInfo(WebKit::WebScreenInfo* result) = 0; | 306 virtual void GetWebScreenInfo(WebKit::WebScreenInfo* result) = 0; |
301 | 307 |
302 // 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. |
303 // 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 |
304 // 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 |
305 // CopyFromBackingStore fails due to the backing store not being available or, | 311 // CopyFromBackingStore fails due to the backing store not being available or, |
306 // 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 |
307 // browser side. | 313 // browser side. |
308 virtual void GetSnapshotFromRenderer( | 314 virtual void GetSnapshotFromRenderer( |
309 const gfx::Rect& src_subrect, | 315 const gfx::Rect& src_subrect, |
310 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; | 316 const base::Callback<void(bool, const SkBitmap&)>& callback) = 0; |
311 | 317 |
312 protected: | 318 protected: |
313 friend class RenderWidgetHostImpl; | 319 friend class RenderWidgetHostImpl; |
314 | 320 |
315 // Retrieves the implementation class. Intended only for code | 321 // Retrieves the implementation class. Intended only for code |
316 // within content/. This method is necessary because | 322 // within content/. This method is necessary because |
317 // RenderWidgetHost is the root of a diamond inheritance pattern, so | 323 // RenderWidgetHost is the root of a diamond inheritance pattern, so |
318 // subclasses inherit it virtually, which removes our ability to | 324 // subclasses inherit it virtually, which removes our ability to |
319 // static_cast to the subclass. | 325 // static_cast to the subclass. |
320 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0; | 326 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() = 0; |
321 }; | 327 }; |
322 | 328 |
323 } // namespace content | 329 } // namespace content |
324 | 330 |
325 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ | 331 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_H_ |
OLD | NEW |