Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.h

Issue 2133873004: content: Move Surfaces related code out of RWHVA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ANDROID_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <queue> 13 #include <queue>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/i18n/rtl.h" 17 #include "base/i18n/rtl.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/process/process.h" 20 #include "base/process/process.h"
21 #include "cc/input/selection.h" 21 #include "cc/input/selection.h"
22 #include "cc/layers/surface_layer.h" 22 #include "cc/layers/surface_layer.h"
23 #include "cc/output/begin_frame_args.h" 23 #include "cc/output/begin_frame_args.h"
24 #include "cc/surfaces/surface_factory_client.h"
25 #include "cc/surfaces/surface_id.h"
26 #include "content/browser/accessibility/browser_accessibility_manager.h" 24 #include "content/browser/accessibility/browser_accessibility_manager.h"
27 #include "content/browser/android/content_view_core_impl_observer.h" 25 #include "content/browser/android/content_view_core_impl_observer.h"
28 #include "content/browser/renderer_host/delegated_frame_evictor.h" 26 #include "content/browser/renderer_host/delegated_frame_evictor.h"
27 #include "content/browser/renderer_host/delegated_frame_host_android.h"
29 #include "content/browser/renderer_host/ime_adapter_android.h" 28 #include "content/browser/renderer_host/ime_adapter_android.h"
30 #include "content/browser/renderer_host/input/stylus_text_selector.h" 29 #include "content/browser/renderer_host/input/stylus_text_selector.h"
31 #include "content/browser/renderer_host/render_widget_host_view_base.h" 30 #include "content/browser/renderer_host/render_widget_host_view_base.h"
32 #include "content/common/content_export.h" 31 #include "content/common/content_export.h"
33 #include "content/public/browser/readback_types.h" 32 #include "content/public/browser/readback_types.h"
34 #include "gpu/command_buffer/common/mailbox.h" 33 #include "gpu/command_buffer/common/mailbox.h"
35 #include "third_party/skia/include/core/SkColor.h" 34 #include "third_party/skia/include/core/SkColor.h"
36 #include "ui/android/window_android_observer.h" 35 #include "ui/android/window_android_observer.h"
37 #include "ui/events/gesture_detection/filtered_gesture_provider.h" 36 #include "ui/events/gesture_detection/filtered_gesture_provider.h"
38 #include "ui/gfx/geometry/size.h" 37 #include "ui/gfx/geometry/size.h"
39 #include "ui/gfx/geometry/vector2d_f.h" 38 #include "ui/gfx/geometry/vector2d_f.h"
40 #include "ui/gfx/selection_bound.h"
41 #include "ui/touch_selection/touch_selection_controller.h" 39 #include "ui/touch_selection/touch_selection_controller.h"
42 40
43 namespace cc { 41 namespace cc {
44 class CopyOutputResult; 42 class CopyOutputResult;
45 class Layer; 43 class Layer;
46 class SurfaceFactory;
47 class SurfaceIdAllocator;
48 enum class SurfaceDrawStatus;
49 } 44 }
50 45
51 namespace blink { 46 namespace blink {
52 class WebExternalTextureLayer; 47 class WebExternalTextureLayer;
53 class WebTouchEvent; 48 class WebTouchEvent;
54 class WebMouseEvent; 49 class WebMouseEvent;
55 } 50 }
56 51
57 namespace content { 52 namespace content {
58 class ContentViewCoreImpl; 53 class ContentViewCoreImpl;
59 class ContentViewCoreObserver; 54 class ContentViewCoreObserver;
60 class OverscrollControllerAndroid; 55 class OverscrollControllerAndroid;
61 class RenderWidgetHost; 56 class RenderWidgetHost;
62 class RenderWidgetHostImpl; 57 class RenderWidgetHostImpl;
63 class SynchronousCompositorHost; 58 class SynchronousCompositorHost;
64 struct DidOverscrollParams; 59 struct DidOverscrollParams;
65 struct NativeWebKeyboardEvent; 60 struct NativeWebKeyboardEvent;
66 struct TextInputState; 61 struct TextInputState;
67 62
68 // ----------------------------------------------------------------------------- 63 // -----------------------------------------------------------------------------
69 // See comments in render_widget_host_view.h about this class and its members. 64 // See comments in render_widget_host_view.h about this class and its members.
70 // ----------------------------------------------------------------------------- 65 // -----------------------------------------------------------------------------
71 class CONTENT_EXPORT RenderWidgetHostViewAndroid 66 class CONTENT_EXPORT RenderWidgetHostViewAndroid
72 : public RenderWidgetHostViewBase, 67 : public RenderWidgetHostViewBase,
73 public cc::SurfaceFactoryClient,
74 public ui::GestureProviderClient, 68 public ui::GestureProviderClient,
75 public ui::WindowAndroidObserver, 69 public ui::WindowAndroidObserver,
76 public DelegatedFrameEvictorClient, 70 public DelegatedFrameEvictorClient,
71 public DelegatedFrameHostAndroidClient,
77 public StylusTextSelectorClient, 72 public StylusTextSelectorClient,
78 public ui::TouchSelectionControllerClient, 73 public ui::TouchSelectionControllerClient,
79 public content::ContentViewCoreImplObserver { 74 public content::ContentViewCoreImplObserver {
80 public: 75 public:
81 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, 76 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget,
82 ContentViewCoreImpl* content_view_core); 77 ContentViewCoreImpl* content_view_core);
83 ~RenderWidgetHostViewAndroid() override; 78 ~RenderWidgetHostViewAndroid() override;
84 79
85 void Blur(); 80 void Blur();
86 81
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 const SkBitmap& zoomed_bitmap) override; 154 const SkBitmap& zoomed_bitmap) override;
160 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() 155 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget()
161 override; 156 override;
162 void LockCompositingSurface() override; 157 void LockCompositingSurface() override;
163 void UnlockCompositingSurface() override; 158 void UnlockCompositingSurface() override;
164 void OnTextSurroundingSelectionResponse(const base::string16& content, 159 void OnTextSurroundingSelectionResponse(const base::string16& content,
165 size_t start_offset, 160 size_t start_offset,
166 size_t end_offset) override; 161 size_t end_offset) override;
167 void OnDidNavigateMainFrameToNewPage() override; 162 void OnDidNavigateMainFrameToNewPage() override;
168 163
169 // cc::SurfaceFactoryClient implementation.
170 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
171 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
172
173 // ui::GestureProviderClient implementation. 164 // ui::GestureProviderClient implementation.
174 void OnGestureEvent(const ui::GestureEventData& gesture) override; 165 void OnGestureEvent(const ui::GestureEventData& gesture) override;
175 166
176 // ui::WindowAndroidObserver implementation. 167 // ui::WindowAndroidObserver implementation.
177 void OnCompositingDidCommit() override; 168 void OnCompositingDidCommit() override;
178 void OnRootWindowVisibilityChanged(bool visible) override; 169 void OnRootWindowVisibilityChanged(bool visible) override;
179 void OnAttachCompositor() override; 170 void OnAttachCompositor() override;
180 void OnDetachCompositor() override; 171 void OnDetachCompositor() override;
181 void OnVSync(base::TimeTicks frame_time, 172 void OnVSync(base::TimeTicks frame_time,
182 base::TimeDelta vsync_period) override; 173 base::TimeDelta vsync_period) override;
(...skipping 18 matching lines...) Expand all
201 // ui::TouchSelectionControllerClient implementation. 192 // ui::TouchSelectionControllerClient implementation.
202 bool SupportsAnimation() const override; 193 bool SupportsAnimation() const override;
203 void SetNeedsAnimate() override; 194 void SetNeedsAnimate() override;
204 void MoveCaret(const gfx::PointF& position) override; 195 void MoveCaret(const gfx::PointF& position) override;
205 void MoveRangeSelectionExtent(const gfx::PointF& extent) override; 196 void MoveRangeSelectionExtent(const gfx::PointF& extent) override;
206 void SelectBetweenCoordinates(const gfx::PointF& base, 197 void SelectBetweenCoordinates(const gfx::PointF& base,
207 const gfx::PointF& extent) override; 198 const gfx::PointF& extent) override;
208 void OnSelectionEvent(ui::SelectionEventType event) override; 199 void OnSelectionEvent(ui::SelectionEventType event) override;
209 std::unique_ptr<ui::TouchHandleDrawable> CreateDrawable() override; 200 std::unique_ptr<ui::TouchHandleDrawable> CreateDrawable() override;
210 201
202 // DelegatedFrameHostAndroidClient implementation.
203 void AttachSurfaceLayer(scoped_refptr<cc::SurfaceLayer> layer) override;
204 void DetachSurfaceLayer() override;
205 void ReturnCompositorFrameResources(
206 const cc::ReturnedResourceArray& resources) override;
207
211 // Non-virtual methods 208 // Non-virtual methods
212 void SetContentViewCore(ContentViewCoreImpl* content_view_core); 209 void SetContentViewCore(ContentViewCoreImpl* content_view_core);
213 SkColor GetCachedBackgroundColor() const; 210 SkColor GetCachedBackgroundColor() const;
214 void SendKeyEvent(const NativeWebKeyboardEvent& event); 211 void SendKeyEvent(const NativeWebKeyboardEvent& event);
215 void SendMouseEvent(const blink::WebMouseEvent& event); 212 void SendMouseEvent(const blink::WebMouseEvent& event);
216 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); 213 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event);
217 void SendGestureEvent(const blink::WebGestureEvent& event); 214 void SendGestureEvent(const blink::WebGestureEvent& event);
218 215
219 void OnStartContentIntent(const GURL& content_url, bool is_main_frame); 216 void OnStartContentIntent(const GURL& content_url, bool is_main_frame);
220 void OnSetNeedsBeginFrames(bool enabled); 217 void OnSetNeedsBeginFrames(bool enabled);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // ContentViewCoreImpl is our interface to the view system. 333 // ContentViewCoreImpl is our interface to the view system.
337 ContentViewCoreImpl* content_view_core_; 334 ContentViewCoreImpl* content_view_core_;
338 335
339 ImeAdapterAndroid ime_adapter_android_; 336 ImeAdapterAndroid ime_adapter_android_;
340 337
341 // Body background color of the underlying document. 338 // Body background color of the underlying document.
342 SkColor cached_background_color_; 339 SkColor cached_background_color_;
343 340
344 scoped_refptr<cc::Layer> layer_; 341 scoped_refptr<cc::Layer> layer_;
345 342
346 std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_; 343 // Manager for consuming compositor frames from the renderer.
347 std::unique_ptr<cc::SurfaceFactory> surface_factory_; 344 std::unique_ptr<DelegatedFrameHostAndroid> delegated_frame_host_;
348 cc::SurfaceId surface_id_; 345
349 gfx::Size current_surface_size_;
350 cc::ReturnedResourceArray surface_returned_resources_; 346 cc::ReturnedResourceArray surface_returned_resources_;
351 gfx::Vector2dF location_bar_content_translation_;
352 cc::Selection<gfx::SelectionBound> current_viewport_selection_;
353 347
354 // The most recent texture size that was pushed to the texture layer. 348 // The most recent texture size that was pushed to the texture layer.
355 gfx::Size texture_size_in_layer_; 349 gfx::Size texture_size_in_layer_;
356 350
357 // The output surface id of the last received frame. 351 // The output surface id of the last received frame.
358 uint32_t last_output_surface_id_; 352 uint32_t last_output_surface_id_;
359 353
360
361 std::queue<base::Closure> ack_callbacks_; 354 std::queue<base::Closure> ack_callbacks_;
362 355
363 // Used to control and render overscroll-related effects. 356 // Used to control and render overscroll-related effects.
364 std::unique_ptr<OverscrollControllerAndroid> overscroll_controller_; 357 std::unique_ptr<OverscrollControllerAndroid> overscroll_controller_;
365 358
366 // Provides gesture synthesis given a stream of touch events (derived from 359 // Provides gesture synthesis given a stream of touch events (derived from
367 // Android MotionEvent's) and touch event acks. 360 // Android MotionEvent's) and touch event acks.
368 ui::FilteredGestureProvider gesture_provider_; 361 ui::FilteredGestureProvider gesture_provider_;
369 362
370 // Handles gesture based text selection 363 // Handles gesture based text selection
(...skipping 29 matching lines...) Expand all
400 gfx::Vector2dF last_scroll_offset_; 393 gfx::Vector2dF last_scroll_offset_;
401 394
402 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; 395 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_;
403 396
404 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); 397 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid);
405 }; 398 };
406 399
407 } // namespace content 400 } // namespace content
408 401
409 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ 402 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698