Chromium Code Reviews| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 void ClearCompositorFrame() override; | 154 void ClearCompositorFrame() override; |
| 155 void SetIsInVR(bool is_in_vr) override; | 155 void SetIsInVR(bool is_in_vr) override; |
| 156 bool IsInVR() const override; | 156 bool IsInVR() const override; |
| 157 void DidOverscroll(const ui::DidOverscrollParams& params) override; | 157 void DidOverscroll(const ui::DidOverscrollParams& params) override; |
| 158 void DidStopFlinging() override; | 158 void DidStopFlinging() override; |
| 159 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, | 159 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, |
| 160 const SkBitmap& zoomed_bitmap) override; | 160 const SkBitmap& zoomed_bitmap) override; |
| 161 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() | 161 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() |
| 162 override; | 162 override; |
| 163 void OnDidNavigateMainFrameToNewPage() override; | 163 void OnDidNavigateMainFrameToNewPage() override; |
| 164 void OnFullscreenStateChanged(bool entered_fullscreen) override; | |
| 164 void SetNeedsBeginFrames(bool needs_begin_frames) override; | 165 void SetNeedsBeginFrames(bool needs_begin_frames) override; |
| 165 cc::FrameSinkId GetFrameSinkId() override; | 166 cc::FrameSinkId GetFrameSinkId() override; |
| 166 cc::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, | 167 cc::FrameSinkId FrameSinkIdAtPoint(cc::SurfaceHittestDelegate* delegate, |
| 167 const gfx::Point& point, | 168 const gfx::Point& point, |
| 168 gfx::Point* transformed_point) override; | 169 gfx::Point* transformed_point) override; |
| 169 void ProcessMouseEvent(const blink::WebMouseEvent& event, | 170 void ProcessMouseEvent(const blink::WebMouseEvent& event, |
| 170 const ui::LatencyInfo& latency) override; | 171 const ui::LatencyInfo& latency) override; |
| 171 void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event, | 172 void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event, |
| 172 const ui::LatencyInfo& latency) override; | 173 const ui::LatencyInfo& latency) override; |
| 173 void ProcessTouchEvent(const blink::WebTouchEvent& event, | 174 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; | 232 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| 232 | 233 |
| 233 // cc::BeginFrameObserver implementation. | 234 // cc::BeginFrameObserver implementation. |
| 234 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 235 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
| 235 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; | 236 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
| 236 void OnBeginFrameSourcePausedChanged(bool paused) override; | 237 void OnBeginFrameSourcePausedChanged(bool paused) override; |
| 237 | 238 |
| 238 // Non-virtual methods | 239 // Non-virtual methods |
| 239 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 240 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
| 240 SkColor GetCachedBackgroundColor() const; | 241 SkColor GetCachedBackgroundColor() const; |
| 242 bool CanShowThumbnailPlaceholder() const; | |
| 241 void SendKeyEvent(const NativeWebKeyboardEvent& event); | 243 void SendKeyEvent(const NativeWebKeyboardEvent& event); |
| 242 void SendMouseEvent(const ui::MotionEventAndroid&, int action_button); | 244 void SendMouseEvent(const ui::MotionEventAndroid&, int action_button); |
| 243 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); | 245 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); |
| 244 void SendGestureEvent(const blink::WebGestureEvent& event); | 246 void SendGestureEvent(const blink::WebGestureEvent& event); |
| 245 void ResolveTapDisambiguation(double timestamp_seconds, | 247 void ResolveTapDisambiguation(double timestamp_seconds, |
| 246 gfx::Point tap_viewport_offset, | 248 gfx::Point tap_viewport_offset, |
| 247 bool is_long_press); | 249 bool is_long_press); |
| 248 void set_ime_adapter(ImeAdapterAndroid* ime_adapter) { | 250 void set_ime_adapter(ImeAdapterAndroid* ime_adapter) { |
| 249 ime_adapter_android_ = ime_adapter; | 251 ime_adapter_android_ = ime_adapter; |
| 250 } | 252 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 RenderWidgetHostViewBase* updated_view) override; | 299 RenderWidgetHostViewBase* updated_view) override; |
| 298 void OnTextSelectionChanged(TextInputManager* text_input_manager, | 300 void OnTextSelectionChanged(TextInputManager* text_input_manager, |
| 299 RenderWidgetHostViewBase* updated_view) override; | 301 RenderWidgetHostViewBase* updated_view) override; |
| 300 | 302 |
| 301 ImeAdapterAndroid* ime_adapter_for_testing() { return ime_adapter_android_; } | 303 ImeAdapterAndroid* ime_adapter_for_testing() { return ime_adapter_android_; } |
| 302 | 304 |
| 303 // Exposed for tests. | 305 // Exposed for tests. |
| 304 cc::SurfaceId SurfaceIdForTesting() const override; | 306 cc::SurfaceId SurfaceIdForTesting() const override; |
| 305 | 307 |
| 306 private: | 308 private: |
| 309 enum class FullscreenState { | |
| 310 kNotFullscreen, | |
| 311 kEnteringFullscreen, | |
| 312 kFullscreen, | |
| 313 kExitingFullscreen, | |
| 314 kFullscreenRotation, | |
| 315 }; | |
| 316 | |
| 307 void RunAckCallbacks(); | 317 void RunAckCallbacks(); |
| 308 | 318 |
| 309 void SendReclaimCompositorResources(bool is_swap_ack); | 319 void SendReclaimCompositorResources(bool is_swap_ack); |
| 310 | 320 |
| 311 void OnFrameMetadataUpdated(const cc::CompositorFrameMetadata& frame_metadata, | 321 void OnFrameMetadataUpdated(const cc::CompositorFrameMetadata& frame_metadata, |
| 312 bool is_transparent); | 322 bool is_transparent); |
| 313 | 323 |
| 314 void ShowInternal(); | 324 void ShowInternal(); |
| 315 void HideInternal(); | 325 void HideInternal(); |
| 316 void AttachLayers(); | 326 void AttachLayers(); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 342 void RequestDisallowInterceptTouchEvent(); | 352 void RequestDisallowInterceptTouchEvent(); |
| 343 | 353 |
| 344 bool SyncCompositorOnMessageReceived(const IPC::Message& message); | 354 bool SyncCompositorOnMessageReceived(const IPC::Message& message); |
| 345 | 355 |
| 346 void ComputeEventLatencyOSTouchHistograms(const ui::MotionEvent& event); | 356 void ComputeEventLatencyOSTouchHistograms(const ui::MotionEvent& event); |
| 347 | 357 |
| 348 void CreateOverscrollControllerIfPossible(); | 358 void CreateOverscrollControllerIfPossible(); |
| 349 | 359 |
| 350 WebContentsAccessibilityAndroid* GetWebContentsAccessibilityAndroid() const; | 360 WebContentsAccessibilityAndroid* GetWebContentsAccessibilityAndroid() const; |
| 351 | 361 |
| 362 void UpdateFullscreenState(bool physical_backing_resized); | |
| 363 | |
| 352 // The model object. | 364 // The model object. |
| 353 RenderWidgetHostImpl* host_; | 365 RenderWidgetHostImpl* host_; |
| 354 | 366 |
| 355 // The begin frame source being observed. Null if none. | 367 // The begin frame source being observed. Null if none. |
| 356 cc::BeginFrameSource* begin_frame_source_; | 368 cc::BeginFrameSource* begin_frame_source_; |
| 357 cc::BeginFrameArgs last_begin_frame_args_; | 369 cc::BeginFrameArgs last_begin_frame_args_; |
| 358 uint32_t latest_confirmed_begin_frame_source_id_; | 370 uint32_t latest_confirmed_begin_frame_source_id_; |
| 359 uint64_t latest_confirmed_begin_frame_sequence_number_; | 371 uint64_t latest_confirmed_begin_frame_sequence_number_; |
| 360 | 372 |
| 361 // Indicates whether and for what reason a request for begin frames has been | 373 // 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... | |
| 421 std::unique_ptr<viz::FrameEvictor> frame_evictor_; | 433 std::unique_ptr<viz::FrameEvictor> frame_evictor_; |
| 422 | 434 |
| 423 bool observing_root_window_; | 435 bool observing_root_window_; |
| 424 | 436 |
| 425 // The last scroll offset of the view. | 437 // The last scroll offset of the view. |
| 426 gfx::Vector2dF last_scroll_offset_; | 438 gfx::Vector2dF last_scroll_offset_; |
| 427 | 439 |
| 428 float prev_top_shown_pix_; | 440 float prev_top_shown_pix_; |
| 429 float prev_bottom_shown_pix_; | 441 float prev_bottom_shown_pix_; |
| 430 | 442 |
| 443 FullscreenState fullscreen_state_ = FullscreenState::kNotFullscreen; | |
| 444 | |
| 445 // While we could simply take a mismatch in fullscreen states as the trigger | |
|
aelias_OOO_until_Jul13
2017/06/16 22:46:41
I think there's a bug on the renderer side then.
Khushal
2017/06/19 18:46:34
We use the state transitions in FullscreenControll
aelias_OOO_until_Jul13
2017/06/19 19:01:32
I'm not sure precisely what is going wrong, but it
| |
| 446 // for a transition, and assume the transition to have finished once the | |
| 447 // fullscreen states and sizes match, we have cases where we reach this | |
| 448 // consistent state before the physical backing size changes. Therefore we | |
| 449 // defer assuming the transition to be completed until a resize event is | |
| 450 // received, which is marked by |fullscreen_transition_awaiting_resize_|. | |
| 451 // | |
| 452 // Note that this assumes that every transition will be followed by a change | |
| 453 // in the view's physical backing size. | |
| 454 bool fullscreen_transition_awaiting_resize_ = false; | |
| 455 bool current_frame_is_fullscreen_ = false; | |
| 456 bool web_contents_is_fullscreen_ = false; | |
| 457 | |
| 431 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = | 458 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = |
| 432 nullptr; | 459 nullptr; |
| 433 | 460 |
| 434 base::ObserverList<DestructionObserver> destruction_observers_; | 461 base::ObserverList<DestructionObserver> destruction_observers_; |
| 435 | 462 |
| 436 MouseWheelPhaseHandler mouse_wheel_phase_handler_; | 463 MouseWheelPhaseHandler mouse_wheel_phase_handler_; |
| 437 | 464 |
| 438 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; | 465 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; |
| 439 | 466 |
| 440 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 467 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
| 441 }; | 468 }; |
| 442 | 469 |
| 443 } // namespace content | 470 } // namespace content |
| 444 | 471 |
| 445 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 472 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| OLD | NEW |