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_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/output/begin_frame_args.h" | 22 #include "cc/output/begin_frame_args.h" |
23 #include "cc/scheduler/begin_frame_source.h" | 23 #include "cc/scheduler/begin_frame_source.h" |
24 #include "components/viz/service/frame_sinks/frame_evictor.h" | 24 #include "components/viz/service/frame_sinks/frame_evictor.h" |
25 #include "content/browser/android/content_view_core_impl_observer.h" | 25 #include "content/browser/android/content_view_core_impl_observer.h" |
| 26 #include "content/browser/renderer_host/fullscreen_jank_detector.h" |
26 #include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h" | 27 #include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h" |
27 #include "content/browser/renderer_host/input/stylus_text_selector.h" | 28 #include "content/browser/renderer_host/input/stylus_text_selector.h" |
28 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 29 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
29 #include "content/browser/renderer_host/text_input_manager.h" | 30 #include "content/browser/renderer_host/text_input_manager.h" |
30 #include "content/common/content_export.h" | 31 #include "content/common/content_export.h" |
31 #include "content/public/browser/readback_types.h" | 32 #include "content/public/browser/readback_types.h" |
32 #include "gpu/command_buffer/common/mailbox.h" | 33 #include "gpu/command_buffer/common/mailbox.h" |
33 #include "third_party/skia/include/core/SkColor.h" | 34 #include "third_party/skia/include/core/SkColor.h" |
34 #include "ui/android/delegated_frame_host_android.h" | 35 #include "ui/android/delegated_frame_host_android.h" |
35 #include "ui/android/view_android.h" | 36 #include "ui/android/view_android.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void ClearCompositorFrame() override; | 155 void ClearCompositorFrame() override; |
155 void SetIsInVR(bool is_in_vr) override; | 156 void SetIsInVR(bool is_in_vr) override; |
156 bool IsInVR() const override; | 157 bool IsInVR() const override; |
157 void DidOverscroll(const ui::DidOverscrollParams& params) override; | 158 void DidOverscroll(const ui::DidOverscrollParams& params) override; |
158 void DidStopFlinging() override; | 159 void DidStopFlinging() override; |
159 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, | 160 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, |
160 const SkBitmap& zoomed_bitmap) override; | 161 const SkBitmap& zoomed_bitmap) override; |
161 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() | 162 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() |
162 override; | 163 override; |
163 void OnDidNavigateMainFrameToNewPage() override; | 164 void OnDidNavigateMainFrameToNewPage() override; |
| 165 void OnFullscreenStateChanged() override; |
164 void SetNeedsBeginFrames(bool needs_begin_frames) override; | 166 void SetNeedsBeginFrames(bool needs_begin_frames) override; |
165 cc::FrameSinkId GetFrameSinkId() override; | 167 cc::FrameSinkId GetFrameSinkId() override; |
166 cc::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, | 168 cc::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, |
167 const gfx::Point& point, | 169 const gfx::Point& point, |
168 gfx::Point* transformed_point) override; | 170 gfx::Point* transformed_point) override; |
169 void ProcessMouseEvent(const blink::WebMouseEvent& event, | 171 void ProcessMouseEvent(const blink::WebMouseEvent& event, |
170 const ui::LatencyInfo& latency) override; | 172 const ui::LatencyInfo& latency) override; |
171 void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event, | 173 void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event, |
172 const ui::LatencyInfo& latency) override; | 174 const ui::LatencyInfo& latency) override; |
173 void ProcessTouchEvent(const blink::WebTouchEvent& event, | 175 void ProcessTouchEvent(const blink::WebTouchEvent& event, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 233 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
232 | 234 |
233 // cc::BeginFrameObserver implementation. | 235 // cc::BeginFrameObserver implementation. |
234 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 236 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
235 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; | 237 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
236 void OnBeginFrameSourcePausedChanged(bool paused) override; | 238 void OnBeginFrameSourcePausedChanged(bool paused) override; |
237 | 239 |
238 // Non-virtual methods | 240 // Non-virtual methods |
239 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 241 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
240 SkColor GetCachedBackgroundColor() const; | 242 SkColor GetCachedBackgroundColor() const; |
| 243 void ClearThumbnailPlaceholder(); |
241 void SendKeyEvent(const NativeWebKeyboardEvent& event); | 244 void SendKeyEvent(const NativeWebKeyboardEvent& event); |
242 void SendMouseEvent(const ui::MotionEventAndroid&, int action_button); | 245 void SendMouseEvent(const ui::MotionEventAndroid&, int action_button); |
243 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); | 246 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); |
244 void SendGestureEvent(const blink::WebGestureEvent& event); | 247 void SendGestureEvent(const blink::WebGestureEvent& event); |
245 bool ShowSelectionMenu(const ContextMenuParams& params); | 248 bool ShowSelectionMenu(const ContextMenuParams& params); |
246 void ResolveTapDisambiguation(double timestamp_seconds, | 249 void ResolveTapDisambiguation(double timestamp_seconds, |
247 gfx::Point tap_viewport_offset, | 250 gfx::Point tap_viewport_offset, |
248 bool is_long_press); | 251 bool is_long_press); |
249 void set_ime_adapter(ImeAdapterAndroid* ime_adapter) { | 252 void set_ime_adapter(ImeAdapterAndroid* ime_adapter) { |
250 ime_adapter_android_ = ime_adapter; | 253 ime_adapter_android_ = ime_adapter; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 void OnFrameMetadataUpdated(const cc::CompositorFrameMetadata& frame_metadata, | 315 void OnFrameMetadataUpdated(const cc::CompositorFrameMetadata& frame_metadata, |
313 bool is_transparent); | 316 bool is_transparent); |
314 | 317 |
315 void ShowInternal(); | 318 void ShowInternal(); |
316 void HideInternal(); | 319 void HideInternal(); |
317 void AttachLayers(); | 320 void AttachLayers(); |
318 void RemoveLayers(); | 321 void RemoveLayers(); |
319 | 322 |
320 void UpdateBackgroundColor(SkColor color); | 323 void UpdateBackgroundColor(SkColor color); |
321 | 324 |
| 325 void EvictFrameIfNecessary(); |
| 326 |
322 // DevTools ScreenCast support for Android WebView. | 327 // DevTools ScreenCast support for Android WebView. |
323 void SynchronousCopyContents(const gfx::Rect& src_subrect_in_pixel, | 328 void SynchronousCopyContents(const gfx::Rect& src_subrect_in_pixel, |
324 const gfx::Size& dst_size_in_pixel, | 329 const gfx::Size& dst_size_in_pixel, |
325 const ReadbackRequestCallback& callback, | 330 const ReadbackRequestCallback& callback, |
326 const SkColorType color_type); | 331 const SkColorType color_type); |
327 | 332 |
328 void DestroyDelegatedContent(); | 333 void DestroyDelegatedContent(); |
329 void OnLostResources(); | 334 void OnLostResources(); |
330 | 335 |
331 enum BeginFrameRequestType { | 336 enum BeginFrameRequestType { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 // The last scroll offset of the view. | 434 // The last scroll offset of the view. |
430 gfx::Vector2dF last_scroll_offset_; | 435 gfx::Vector2dF last_scroll_offset_; |
431 | 436 |
432 float prev_top_shown_pix_; | 437 float prev_top_shown_pix_; |
433 float prev_bottom_shown_pix_; | 438 float prev_bottom_shown_pix_; |
434 | 439 |
435 base::TimeTicks prev_mousedown_timestamp_; | 440 base::TimeTicks prev_mousedown_timestamp_; |
436 gfx::Point prev_mousedown_point_; | 441 gfx::Point prev_mousedown_point_; |
437 int left_click_count_ = 0; | 442 int left_click_count_ = 0; |
438 | 443 |
| 444 // Identifies janky frames. |
| 445 std::unique_ptr<FullscreenJankDetector> fullscreen_jank_detector_; |
| 446 |
439 cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ = | 447 cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ = |
440 nullptr; | 448 nullptr; |
441 | 449 |
442 base::ObserverList<DestructionObserver> destruction_observers_; | 450 base::ObserverList<DestructionObserver> destruction_observers_; |
443 | 451 |
444 MouseWheelPhaseHandler mouse_wheel_phase_handler_; | 452 MouseWheelPhaseHandler mouse_wheel_phase_handler_; |
445 | 453 |
446 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; | 454 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; |
447 | 455 |
448 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 456 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
449 }; | 457 }; |
450 | 458 |
451 } // namespace content | 459 } // namespace content |
452 | 460 |
453 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 461 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
OLD | NEW |