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 |
(...skipping 11 matching lines...) Expand all Loading... | |
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/frame_sinks/frame_evictor.h" | 24 #include "components/viz/frame_sinks/frame_evictor.h" |
25 #include "content/browser/accessibility/browser_accessibility_manager.h" | 25 #include "content/browser/accessibility/browser_accessibility_manager.h" |
26 #include "content/browser/android/content_view_core_impl_observer.h" | 26 #include "content/browser/android/content_view_core_impl_observer.h" |
27 #include "content/browser/renderer_host/input/stylus_text_selector.h" | 27 #include "content/browser/renderer_host/input/stylus_text_selector.h" |
28 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
29 #include "content/browser/renderer_host/text_input_manager.h" | 29 #include "content/browser/renderer_host/text_input_manager.h" |
30 #include "content/common/content_export.h" | 30 #include "content/common/content_export.h" |
31 #include "content/public/browser/readback_types.h" | 31 #include "content/public/browser/readback_types.h" |
32 #include "content/public/browser/web_contents_observer.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" |
36 #include "ui/android/view_client.h" | 37 #include "ui/android/view_client.h" |
37 #include "ui/android/window_android_observer.h" | 38 #include "ui/android/window_android_observer.h" |
38 #include "ui/events/gesture_detection/filtered_gesture_provider.h" | 39 #include "ui/events/gesture_detection/filtered_gesture_provider.h" |
39 #include "ui/gfx/geometry/size.h" | 40 #include "ui/gfx/geometry/size.h" |
40 #include "ui/gfx/geometry/vector2d_f.h" | 41 #include "ui/gfx/geometry/vector2d_f.h" |
41 #include "ui/gfx/selection_bound.h" | 42 #include "ui/gfx/selection_bound.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
63 class CONTENT_EXPORT RenderWidgetHostViewAndroid | 64 class CONTENT_EXPORT RenderWidgetHostViewAndroid |
64 : public RenderWidgetHostViewBase, | 65 : public RenderWidgetHostViewBase, |
65 public ui::GestureProviderClient, | 66 public ui::GestureProviderClient, |
66 public ui::ViewClient, | 67 public ui::ViewClient, |
67 public ui::WindowAndroidObserver, | 68 public ui::WindowAndroidObserver, |
68 public viz::FrameEvictorClient, | 69 public viz::FrameEvictorClient, |
69 public StylusTextSelectorClient, | 70 public StylusTextSelectorClient, |
70 public ui::TouchSelectionControllerClient, | 71 public ui::TouchSelectionControllerClient, |
71 public content::ContentViewCoreImplObserver, | 72 public content::ContentViewCoreImplObserver, |
72 public content::TextInputManager::Observer, | 73 public content::TextInputManager::Observer, |
74 public content::WebContentsObserver, | |
Khushal
2017/06/07 05:36:01
You can not use WebContentsObserver here. renderer
steimel
2017/06/13 23:15:44
Done.
| |
73 public ui::DelegatedFrameHostAndroid::Client, | 75 public ui::DelegatedFrameHostAndroid::Client, |
74 public cc::BeginFrameObserver { | 76 public cc::BeginFrameObserver { |
75 public: | 77 public: |
76 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, | 78 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, |
77 ContentViewCoreImpl* content_view_core); | 79 ContentViewCoreImpl* content_view_core); |
78 ~RenderWidgetHostViewAndroid() override; | 80 ~RenderWidgetHostViewAndroid() override; |
79 | 81 |
80 void Blur(); | 82 void Blur(); |
81 | 83 |
82 // Interface used to observe the destruction of a RenderWidgetHostViewAndroid. | 84 // Interface used to observe the destruction of a RenderWidgetHostViewAndroid. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 void OnDetachCompositor() override; | 199 void OnDetachCompositor() override; |
198 void OnAnimate(base::TimeTicks begin_frame_time) override; | 200 void OnAnimate(base::TimeTicks begin_frame_time) override; |
199 void OnActivityStopped() override; | 201 void OnActivityStopped() override; |
200 void OnActivityStarted() override; | 202 void OnActivityStarted() override; |
201 | 203 |
202 // content::ContentViewCoreImplObserver implementation. | 204 // content::ContentViewCoreImplObserver implementation. |
203 void OnContentViewCoreDestroyed() override; | 205 void OnContentViewCoreDestroyed() override; |
204 void OnAttachedToWindow() override; | 206 void OnAttachedToWindow() override; |
205 void OnDetachedFromWindow() override; | 207 void OnDetachedFromWindow() override; |
206 | 208 |
209 // content::WebContentsObserver implementation. | |
210 void DidToggleFullscreenModeForTab(bool entered_fullscreen, | |
211 bool will_cause_resize) override; | |
212 | |
207 // viz::FrameEvictor implementation | 213 // viz::FrameEvictor implementation |
208 void EvictDelegatedFrame() override; | 214 void EvictDelegatedFrame() override; |
209 | 215 |
210 // StylusTextSelectorClient implementation. | 216 // StylusTextSelectorClient implementation. |
211 void OnStylusSelectBegin(float x0, float y0, float x1, float y1) override; | 217 void OnStylusSelectBegin(float x0, float y0, float x1, float y1) override; |
212 void OnStylusSelectUpdate(float x, float y) override; | 218 void OnStylusSelectUpdate(float x, float y) override; |
213 void OnStylusSelectEnd() override {}; | 219 void OnStylusSelectEnd() override {}; |
214 void OnStylusSelectTap(base::TimeTicks time, float x, float y) override; | 220 void OnStylusSelectTap(base::TimeTicks time, float x, float y) override; |
215 | 221 |
216 // ui::TouchSelectionControllerClient implementation. | 222 // ui::TouchSelectionControllerClient implementation. |
(...skipping 12 matching lines...) Expand all Loading... | |
229 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 235 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
230 | 236 |
231 // cc::BeginFrameObserver implementation. | 237 // cc::BeginFrameObserver implementation. |
232 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 238 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
233 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; | 239 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
234 void OnBeginFrameSourcePausedChanged(bool paused) override; | 240 void OnBeginFrameSourcePausedChanged(bool paused) override; |
235 | 241 |
236 // Non-virtual methods | 242 // Non-virtual methods |
237 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 243 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
238 SkColor GetCachedBackgroundColor() const; | 244 SkColor GetCachedBackgroundColor() const; |
245 bool can_use_static_layer() const { return !fullscreen_transitioning_; } | |
239 void SendKeyEvent(const NativeWebKeyboardEvent& event); | 246 void SendKeyEvent(const NativeWebKeyboardEvent& event); |
240 void SendMouseEvent(const ui::MotionEventAndroid&, int action_button); | 247 void SendMouseEvent(const ui::MotionEventAndroid&, int action_button); |
241 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); | 248 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); |
242 void SendGestureEvent(const blink::WebGestureEvent& event); | 249 void SendGestureEvent(const blink::WebGestureEvent& event); |
243 void ResolveTapDisambiguation(double timestamp_seconds, | 250 void ResolveTapDisambiguation(double timestamp_seconds, |
244 gfx::Point tap_viewport_offset, | 251 gfx::Point tap_viewport_offset, |
245 bool is_long_press); | 252 bool is_long_press); |
246 void set_ime_adapter(ImeAdapterAndroid* ime_adapter) { | 253 void set_ime_adapter(ImeAdapterAndroid* ime_adapter) { |
247 ime_adapter_android_ = ime_adapter; | 254 ime_adapter_android_ = ime_adapter; |
248 } | 255 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 void SendBeginFrame(cc::BeginFrameArgs args); | 345 void SendBeginFrame(cc::BeginFrameArgs args); |
339 bool Animate(base::TimeTicks frame_time); | 346 bool Animate(base::TimeTicks frame_time); |
340 void RequestDisallowInterceptTouchEvent(); | 347 void RequestDisallowInterceptTouchEvent(); |
341 | 348 |
342 bool SyncCompositorOnMessageReceived(const IPC::Message& message); | 349 bool SyncCompositorOnMessageReceived(const IPC::Message& message); |
343 | 350 |
344 void ComputeEventLatencyOSTouchHistograms(const ui::MotionEvent& event); | 351 void ComputeEventLatencyOSTouchHistograms(const ui::MotionEvent& event); |
345 | 352 |
346 void CreateOverscrollControllerIfPossible(); | 353 void CreateOverscrollControllerIfPossible(); |
347 | 354 |
355 bool HasFullscreenTransitionJank(const cc::CompositorFrame& frame) const; | |
mlamouri (slow - plz ping)
2017/06/12 13:10:07
nit: that name is quite confusing as we don't know
steimel
2017/06/13 23:15:44
Refactoring replaced all three of these functions
| |
356 void HideFullscreenTransitionJank(); | |
mlamouri (slow - plz ping)
2017/06/12 13:10:07
nit: maybe drop "jank"?
steimel
2017/06/13 23:15:44
Same as above
| |
357 void EndFullscreenTransition(); | |
mlamouri (slow - plz ping)
2017/06/12 13:10:07
Can we re-use this for non-fullscreen transitions?
steimel
2017/06/13 23:15:44
The new function should be re-useable
| |
358 | |
348 // The model object. | 359 // The model object. |
349 RenderWidgetHostImpl* host_; | 360 RenderWidgetHostImpl* host_; |
350 | 361 |
351 // The begin frame source being observed. Null if none. | 362 // The begin frame source being observed. Null if none. |
352 cc::BeginFrameSource* begin_frame_source_; | 363 cc::BeginFrameSource* begin_frame_source_; |
353 cc::BeginFrameArgs last_begin_frame_args_; | 364 cc::BeginFrameArgs last_begin_frame_args_; |
354 uint32_t latest_confirmed_begin_frame_source_id_; | 365 uint32_t latest_confirmed_begin_frame_source_id_; |
355 uint64_t latest_confirmed_begin_frame_sequence_number_; | 366 uint64_t latest_confirmed_begin_frame_sequence_number_; |
356 | 367 |
357 // Indicates whether and for what reason a request for begin frames has been | 368 // Indicates whether and for what reason a request for begin frames has been |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 std::unique_ptr<viz::FrameEvictor> frame_evictor_; | 428 std::unique_ptr<viz::FrameEvictor> frame_evictor_; |
418 | 429 |
419 bool observing_root_window_; | 430 bool observing_root_window_; |
420 | 431 |
421 // The last scroll offset of the view. | 432 // The last scroll offset of the view. |
422 gfx::Vector2dF last_scroll_offset_; | 433 gfx::Vector2dF last_scroll_offset_; |
423 | 434 |
424 float prev_top_shown_pix_; | 435 float prev_top_shown_pix_; |
425 float prev_bottom_shown_pix_; | 436 float prev_bottom_shown_pix_; |
426 | 437 |
438 bool fullscreen_transitioning_ = false; | |
439 bool awaiting_resize_ = false; | |
440 | |
427 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = | 441 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = |
428 nullptr; | 442 nullptr; |
429 | 443 |
430 base::ObserverList<DestructionObserver> destruction_observers_; | 444 base::ObserverList<DestructionObserver> destruction_observers_; |
431 | 445 |
432 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; | 446 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; |
433 | 447 |
434 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 448 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
435 }; | 449 }; |
436 | 450 |
437 } // namespace content | 451 } // namespace content |
438 | 452 |
439 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 453 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
OLD | NEW |