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" |
(...skipping 10 matching lines...) Expand all Loading... |
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 WebKit { |
| 31 class WebMouseEvent; |
31 struct WebScreenInfo; | 32 struct WebScreenInfo; |
32 } | 33 } |
33 | 34 |
34 namespace content { | 35 namespace content { |
35 | 36 |
36 class RenderProcessHost; | 37 class RenderProcessHost; |
37 class RenderWidgetHostImpl; | 38 class RenderWidgetHostImpl; |
38 class RenderWidgetHostView; | 39 class RenderWidgetHostView; |
39 | 40 |
40 // A RenderWidgetHost manages the browser side of a browser<->renderer | 41 // A RenderWidgetHost manages the browser side of a browser<->renderer |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 // only for test code. | 290 // only for test code. |
290 | 291 |
291 // 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. |
292 typedef base::Callback<bool(const NativeWebKeyboardEvent&)> | 293 typedef base::Callback<bool(const NativeWebKeyboardEvent&)> |
293 KeyPressEventCallback; | 294 KeyPressEventCallback; |
294 virtual void AddKeyPressEventCallback( | 295 virtual void AddKeyPressEventCallback( |
295 const KeyPressEventCallback& callback) = 0; | 296 const KeyPressEventCallback& callback) = 0; |
296 virtual void RemoveKeyPressEventCallback( | 297 virtual void RemoveKeyPressEventCallback( |
297 const KeyPressEventCallback& callback) = 0; | 298 const KeyPressEventCallback& callback) = 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 |