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_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
7 | 7 |
8 #if defined(OS_MACOSX) | 8 #if defined(OS_MACOSX) |
9 #include <OpenGL/OpenGL.h> | 9 #include <OpenGL/OpenGL.h> |
10 #endif | 10 #endif |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
17 #include "base/process/kill.h" | 17 #include "base/process/kill.h" |
18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
19 #include "cc/output/compositor_frame.h" | 19 #include "cc/output/compositor_frame.h" |
20 #include "content/browser/renderer_host/event_with_latency_info.h" | 20 #include "content/browser/renderer_host/event_with_latency_info.h" |
21 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
22 #include "content/common/input/input_event_ack_state.h" | 22 #include "content/common/input/input_event_ack_state.h" |
| 23 #include "content/public/browser/readback_types.h" |
23 #include "content/public/browser/render_widget_host_view.h" | 24 #include "content/public/browser/render_widget_host_view.h" |
24 #include "ipc/ipc_listener.h" | 25 #include "ipc/ipc_listener.h" |
25 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" | 26 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" |
26 #include "third_party/WebKit/public/web/WebPopupType.h" | 27 #include "third_party/WebKit/public/web/WebPopupType.h" |
27 #include "third_party/WebKit/public/web/WebTextDirection.h" | 28 #include "third_party/WebKit/public/web/WebTextDirection.h" |
28 #include "ui/base/ime/text_input_mode.h" | 29 #include "ui/base/ime/text_input_mode.h" |
29 #include "ui/base/ime/text_input_type.h" | 30 #include "ui/base/ime/text_input_type.h" |
30 #include "ui/gfx/display.h" | 31 #include "ui/gfx/display.h" |
31 #include "ui/gfx/native_widget_types.h" | 32 #include "ui/gfx/native_widget_types.h" |
32 #include "ui/gfx/range/range.h" | 33 #include "ui/gfx/range/range.h" |
(...skipping 16 matching lines...) Expand all Loading... |
49 namespace content { | 50 namespace content { |
50 class BrowserAccessibilityDelegate; | 51 class BrowserAccessibilityDelegate; |
51 class BrowserAccessibilityManager; | 52 class BrowserAccessibilityManager; |
52 class SyntheticGesture; | 53 class SyntheticGesture; |
53 class SyntheticGestureTarget; | 54 class SyntheticGestureTarget; |
54 class WebCursor; | 55 class WebCursor; |
55 struct DidOverscrollParams; | 56 struct DidOverscrollParams; |
56 struct NativeWebKeyboardEvent; | 57 struct NativeWebKeyboardEvent; |
57 struct WebPluginGeometry; | 58 struct WebPluginGeometry; |
58 | 59 |
59 // TODO(Sikugu): Though we have the return status of the result here, | |
60 // we should add the reason for failure as a new parameter to handle cases | |
61 // efficiently. | |
62 typedef const base::Callback<void(bool, const SkBitmap&)> | |
63 CopyFromCompositingSurfaceCallback; | |
64 | |
65 // Basic implementation shared by concrete RenderWidgetHostView subclasses. | 60 // Basic implementation shared by concrete RenderWidgetHostView subclasses. |
66 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, | 61 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
67 public IPC::Listener { | 62 public IPC::Listener { |
68 public: | 63 public: |
69 ~RenderWidgetHostViewBase() override; | 64 ~RenderWidgetHostViewBase() override; |
70 | 65 |
71 // RenderWidgetHostView implementation. | 66 // RenderWidgetHostView implementation. |
72 void SetBackgroundColor(SkColor color) override; | 67 void SetBackgroundColor(SkColor color) override; |
73 void SetBackgroundColorToDefault() final; | 68 void SetBackgroundColorToDefault() final; |
74 bool GetBackgroundOpaque() override; | 69 bool GetBackgroundOpaque() override; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 virtual void SelectionBoundsChanged( | 249 virtual void SelectionBoundsChanged( |
255 const ViewHostMsg_SelectionBounds_Params& params) = 0; | 250 const ViewHostMsg_SelectionBounds_Params& params) = 0; |
256 | 251 |
257 // Copies the contents of the compositing surface, providing a new SkBitmap | 252 // Copies the contents of the compositing surface, providing a new SkBitmap |
258 // result via an asynchronously-run |callback|. |src_subrect| is specified in | 253 // result via an asynchronously-run |callback|. |src_subrect| is specified in |
259 // layer space coordinates for the current platform (e.g., DIP for Aura/Mac, | 254 // layer space coordinates for the current platform (e.g., DIP for Aura/Mac, |
260 // physical for Android), and is the region to be copied from this view. The | 255 // physical for Android), and is the region to be copied from this view. The |
261 // copy is then scaled to a SkBitmap of size |dst_size|. |callback| is run | 256 // copy is then scaled to a SkBitmap of size |dst_size|. |callback| is run |
262 // with true on success, false otherwise. A smaller region than |src_subrect| | 257 // with true on success, false otherwise. A smaller region than |src_subrect| |
263 // may be copied if the underlying surface is smaller than |src_subrect|. | 258 // may be copied if the underlying surface is smaller than |src_subrect|. |
264 virtual void CopyFromCompositingSurface( | 259 virtual void CopyFromCompositingSurface(const gfx::Rect& src_subrect, |
265 const gfx::Rect& src_subrect, | 260 const gfx::Size& dst_size, |
266 const gfx::Size& dst_size, | 261 ReadbackRequestCallback& callback, |
267 CopyFromCompositingSurfaceCallback& callback, | 262 const SkColorType color_type) = 0; |
268 const SkColorType color_type) = 0; | |
269 | 263 |
270 // Copies the contents of the compositing surface, populating the given | 264 // Copies the contents of the compositing surface, populating the given |
271 // |target| with YV12 image data. |src_subrect| is specified in layer space | 265 // |target| with YV12 image data. |src_subrect| is specified in layer space |
272 // coordinates for the current platform (e.g., DIP for Aura/Mac, physical for | 266 // coordinates for the current platform (e.g., DIP for Aura/Mac, physical for |
273 // Android), and is the region to be copied from this view. The copy is then | 267 // Android), and is the region to be copied from this view. The copy is then |
274 // scaled and letterboxed with black borders to fit |target|. Finally, | 268 // scaled and letterboxed with black borders to fit |target|. Finally, |
275 // |callback| is asynchronously run with true/false for | 269 // |callback| is asynchronously run with true/false for |
276 // success/failure. |target| must point to an allocated, YV12 video frame of | 270 // success/failure. |target| must point to an allocated, YV12 video frame of |
277 // the intended size. This operation will fail if there is no available | 271 // the intended size. This operation will fail if there is no available |
278 // compositing surface. | 272 // compositing surface. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 base::OneShotTimer<RenderWidgetHostViewBase> flush_input_timer_; | 419 base::OneShotTimer<RenderWidgetHostViewBase> flush_input_timer_; |
426 | 420 |
427 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; | 421 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; |
428 | 422 |
429 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); | 423 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |
430 }; | 424 }; |
431 | 425 |
432 } // namespace content | 426 } // namespace content |
433 | 427 |
434 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 428 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
OLD | NEW |