/
render_widget_host_view_android.h
630 lines (522 loc) · 25.1 KB
/
render_widget_host_view_android.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
#define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
#include <stddef.h>
#include <stdint.h>
#include <deque>
#include <map>
#include <memory>
#include "base/android/jni_android.h"
#include "base/callback.h"
#include "base/callback_list.h"
#include "base/containers/queue.h"
#include "base/gtest_prod_util.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/process/process.h"
#include "base/time/time.h"
#include "cc/trees/render_frame_metadata.h"
#include "components/viz/common/quads/selection.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
#include "content/browser/renderer_host/input/stylus_text_selector.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/renderer_host/text_input_manager.h"
#include "content/common/content_export.h"
#include "content/public/browser/render_frame_host.h"
#include "third_party/blink/public/mojom/input/input_handler.mojom-forward.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/android/delegated_frame_host_android.h"
#include "ui/android/view_android.h"
#include "ui/android/window_android.h"
#include "ui/android/window_android_observer.h"
#include "ui/base/ui_base_types.h"
#include "ui/events/android/event_handler_android.h"
#include "ui/events/gesture_detection/filtered_gesture_provider.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/vector2d_f.h"
#include "ui/gfx/selection_bound.h"
#include "ui/touch_selection/touch_selection_controller.h"
namespace ui {
class MotionEventAndroid;
class OverscrollRefreshHandler;
struct DidOverscrollParams;
}
namespace content {
class GestureListenerManager;
class ImeAdapterAndroid;
class OverscrollControllerAndroid;
class SelectionPopupController;
class SynchronousCompositorHost;
class SynchronousCompositorClient;
class TextSuggestionHostAndroid;
class TouchSelectionControllerClientManagerAndroid;
class WebContentsAccessibilityAndroid;
struct NativeWebKeyboardEvent;
struct ContextMenuParams;
// -----------------------------------------------------------------------------
// See comments in render_widget_host_view.h about this class and its members.
// -----------------------------------------------------------------------------
class CONTENT_EXPORT RenderWidgetHostViewAndroid
: public RenderWidgetHostViewBase,
public StylusTextSelectorClient,
public TextInputManager::Observer,
public RenderFrameMetadataProvider::Observer,
public ui::EventHandlerAndroid,
public ui::GestureProviderClient,
public ui::TouchSelectionControllerClient,
public ui::ViewAndroidObserver,
public ui::WindowAndroidObserver {
public:
RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget,
gfx::NativeView parent_native_view);
RenderWidgetHostViewAndroid(const RenderWidgetHostViewAndroid&) = delete;
RenderWidgetHostViewAndroid& operator=(const RenderWidgetHostViewAndroid&) =
delete;
// Interface used to observe the destruction of a RenderWidgetHostViewAndroid.
class DestructionObserver {
public:
virtual void RenderWidgetHostViewDestroyed(
RenderWidgetHostViewAndroid* rwhva) = 0;
protected:
virtual ~DestructionObserver() {}
};
void AddDestructionObserver(DestructionObserver* connector);
void RemoveDestructionObserver(DestructionObserver* connector);
ui::TouchSelectionController* touch_selection_controller() {
return touch_selection_controller_.get();
}
using SurfaceIdChangedCallbackType = void(const viz::SurfaceId& new_id);
using SurfaceIdChangedCallback =
base::RepeatingCallback<SurfaceIdChangedCallbackType>;
using SurfaceIdChangedCallbackList =
base::RepeatingCallbackList<SurfaceIdChangedCallbackType>;
[[nodiscard]] base::CallbackListSubscription SubscribeToSurfaceIdChanges(
const SurfaceIdChangedCallback& callback);
// Called by DelegatedFrameHostClientAndroid
void OnSurfaceIdChanged();
// RenderWidgetHostView implementation.
void InitAsChild(gfx::NativeView parent_view) override;
void InitAsPopup(RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos,
const gfx::Rect& anchor_rect) override;
void SetSize(const gfx::Size& size) override;
void SetBounds(const gfx::Rect& rect) override;
gfx::NativeView GetNativeView() override;
gfx::NativeViewAccessible GetNativeViewAccessible() override;
void Focus() override;
bool HasFocus() override;
void Hide() override;
bool IsShowing() override;
gfx::Rect GetViewBounds() override;
gfx::Size GetVisibleViewportSize() override;
void SetInsets(const gfx::Insets& insets) override;
gfx::Size GetCompositorViewportPixelSize() override;
bool IsSurfaceAvailableForCopy() override;
void CopyFromSurface(
const gfx::Rect& src_rect,
const gfx::Size& output_size,
base::OnceCallback<void(const SkBitmap&)> callback) override;
void EnsureSurfaceSynchronizedForWebTest() override;
uint32_t GetCaptureSequenceNumber() const override;
int GetMouseWheelMinimumGranularity() const override;
void UpdateCursor(const WebCursor& cursor) override;
void SetIsLoading(bool is_loading) override;
void FocusedNodeChanged(bool is_editable_node,
const gfx::Rect& node_bounds_in_screen) override;
void RenderProcessGone() override;
void ShowWithVisibility(PageVisibilityState page_visibility) final;
void Destroy() override;
void UpdateTooltipUnderCursor(const std::u16string& tooltip_text) override;
void UpdateTooltipFromKeyboard(const std::u16string& tooltip_text,
const gfx::Rect& bounds) override;
void ClearKeyboardTriggeredTooltip() override;
void TransformPointToRootSurface(gfx::PointF* point) override;
gfx::Rect GetBoundsInRootWindow() override;
void ProcessAckedTouchEvent(
const TouchEventWithLatencyInfo& touch,
blink::mojom::InputEventResultState ack_result) override;
blink::mojom::InputEventResultState FilterInputEvent(
const blink::WebInputEvent& input_event) override;
void GestureEventAck(const blink::WebGestureEvent& event,
blink::mojom::InputEventResultState ack_result) override;
void ChildDidAckGestureEvent(
const blink::WebGestureEvent& event,
blink::mojom::InputEventResultState ack_result) override;
blink::mojom::PointerLockResult LockMouse(
bool request_unadjusted_movement) override;
blink::mojom::PointerLockResult ChangeMouseLock(
bool request_unadjusted_movement) override;
void UnlockMouse() override;
void ClearFallbackSurfaceForCommitPending() override;
void ResetFallbackToFirstNavigationSurface() override;
bool RequestRepaintForTesting() override;
void SetIsInVR(bool is_in_vr) override;
bool IsInVR() const override;
void DidOverscroll(const ui::DidOverscrollParams& params) override;
void DidStopFlinging() override;
bool CanSynchronizeVisualProperties() override;
std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget()
override;
void OnDidNavigateMainFrameToNewPage() override;
const viz::FrameSinkId& GetFrameSinkId() const override;
viz::FrameSinkId GetRootFrameSinkId() override;
viz::SurfaceId GetCurrentSurfaceId() const override;
bool TransformPointToCoordSpaceForView(
const gfx::PointF& point,
RenderWidgetHostViewBase* target_view,
gfx::PointF* transformed_point) override;
TouchSelectionControllerClientManager*
GetTouchSelectionControllerClientManager() override;
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;
void OnRendererWidgetCreated() override;
void TakeFallbackContentFrom(RenderWidgetHostView* view) override;
void OnSynchronizedDisplayPropertiesChanged(bool rotation) override;
absl::optional<SkColor> GetBackgroundColor() override;
void DidNavigate() override;
WebContentsAccessibility* GetWebContentsAccessibility() override;
viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) override;
display::ScreenInfo GetScreenInfo() const override;
std::vector<std::unique_ptr<ui::TouchEvent>> ExtractAndCancelActiveTouches()
override;
void TransferTouches(
const std::vector<std::unique_ptr<ui::TouchEvent>>& touches) override;
bool ShouldVirtualKeyboardOverlayContent() override;
// ui::EventHandlerAndroid implementation.
bool OnTouchEvent(const ui::MotionEventAndroid& m) override;
bool OnMouseEvent(const ui::MotionEventAndroid& m) override;
bool OnMouseWheelEvent(const ui::MotionEventAndroid& event) override;
bool OnGestureEvent(const ui::GestureEventAndroid& event) override;
void OnPhysicalBackingSizeChanged(
absl::optional<base::TimeDelta> deadline_override) override;
void NotifyVirtualKeyboardOverlayRect(
const gfx::Rect& keyboard_rect) override;
// ui::ViewAndroidObserver implementation:
void OnAttachedToWindow() override;
void OnDetachedFromWindow() override;
// ui::GestureProviderClient implementation.
void OnGestureEvent(const ui::GestureEventData& gesture) override;
bool RequiresDoubleTapGestureEvents() const override;
// ui::WindowAndroidObserver implementation.
void OnCompositingDidCommit() override {}
void OnRootWindowVisibilityChanged(bool visible) override;
void OnAttachCompositor() override;
void OnDetachCompositor() override;
void OnAnimate(base::TimeTicks begin_frame_time) override;
void OnActivityStopped() override;
void OnActivityStarted() override;
// StylusTextSelectorClient implementation.
void OnStylusSelectBegin(float x0, float y0, float x1, float y1) override;
void OnStylusSelectUpdate(float x, float y) override;
void OnStylusSelectEnd(float x, float y) override;
void OnStylusSelectTap(base::TimeTicks time, float x, float y) override;
// ui::TouchSelectionControllerClient implementation.
bool SupportsAnimation() const override;
void SetNeedsAnimate() override;
void MoveCaret(const gfx::PointF& position) override;
void MoveRangeSelectionExtent(const gfx::PointF& extent) override;
void SelectBetweenCoordinates(const gfx::PointF& base,
const gfx::PointF& extent) override;
void OnSelectionEvent(ui::SelectionEventType event) override;
void OnDragUpdate(const ui::TouchSelectionDraggable::Type type,
const gfx::PointF& position) override;
std::unique_ptr<ui::TouchHandleDrawable> CreateDrawable() override;
void DidScroll() override;
void ShowTouchSelectionContextMenu(const gfx::Point& location) override;
// Non-virtual methods
void UpdateNativeViewTree(gfx::NativeView parent_native_view);
// Returns the temporary background color of the underlaying document, for
// example, returns black during screen rotation.
absl::optional<SkColor> GetCachedBackgroundColor();
void SendKeyEvent(const NativeWebKeyboardEvent& event);
void SendMouseEvent(const ui::MotionEventAndroid&, int action_button);
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event);
void SendGestureEvent(const blink::WebGestureEvent& event);
bool ShowSelectionMenu(RenderFrameHost* render_frame_host,
const ContextMenuParams& params);
void set_ime_adapter(ImeAdapterAndroid* ime_adapter) {
ime_adapter_android_ = ime_adapter;
}
void set_selection_popup_controller(SelectionPopupController* controller) {
selection_popup_controller_ = controller;
}
void set_text_suggestion_host(
TextSuggestionHostAndroid* text_suggestion_host) {
text_suggestion_host_ = text_suggestion_host;
}
TextSuggestionHostAndroid* text_suggestion_host() const {
return text_suggestion_host_;
}
void SetGestureListenerManager(GestureListenerManager* manager);
void UpdateReportAllRootScrolls();
base::WeakPtr<RenderWidgetHostViewAndroid> GetWeakPtrAndroid();
bool OnTouchHandleEvent(const ui::MotionEvent& event);
int GetTouchHandleHeight();
void ResetGestureDetection();
void SetDoubleTapSupportEnabled(bool enabled);
void SetMultiTouchZoomSupportEnabled(bool enabled);
bool SynchronizeVisualProperties(
const cc::DeadlinePolicy& deadline_policy,
const absl::optional<viz::LocalSurfaceId>& child_local_surface_id);
bool HasValidFrame() const;
void MoveCaret(const gfx::Point& point);
void DismissTextHandles();
void SetTextHandlesTemporarilyHidden(bool hide_handles);
void SelectAroundCaretAck(blink::mojom::SelectAroundCaretResultPtr result);
// TODO(ericrk): Ideally we'd remove |root_scroll_offset| from this function
// once we have a reliable way to get it through RenderFrameMetadata.
void FrameTokenChangedForSynchronousCompositor(
uint32_t frame_token,
const gfx::PointF& root_scroll_offset);
void SetSynchronousCompositorClient(SynchronousCompositorClient* client);
SynchronousCompositorClient* synchronous_compositor_client() const {
return synchronous_compositor_client_;
}
void OnOverscrollRefreshHandlerAvailable();
// TextInputManager::Observer overrides.
void OnUpdateTextInputStateCalled(TextInputManager* text_input_manager,
RenderWidgetHostViewBase* updated_view,
bool did_change_state) override;
void OnImeCompositionRangeChanged(
TextInputManager* text_input_manager,
RenderWidgetHostViewBase* updated_view) override;
void OnImeCancelComposition(TextInputManager* text_input_manager,
RenderWidgetHostViewBase* updated_view) override;
void OnTextSelectionChanged(TextInputManager* text_input_manager,
RenderWidgetHostViewBase* updated_view) override;
ImeAdapterAndroid* ime_adapter_for_testing() { return ime_adapter_android_; }
ui::TouchSelectionControllerClient*
GetSelectionControllerClientManagerForTesting();
void SetSelectionControllerClientForTesting(
std::unique_ptr<ui::TouchSelectionControllerClient> client);
void SetOverscrollControllerForTesting(
ui::OverscrollRefreshHandler* overscroll_refresh_handler);
void GotFocus();
void LostFocus();
// RenderFrameMetadataProvider::Observer implementation.
void OnRenderFrameMetadataChangedBeforeActivation(
const cc::RenderFrameMetadata& metadata) override;
void OnRenderFrameMetadataChangedAfterActivation(
base::TimeTicks activation_time) override;
void OnRenderFrameSubmission() override {}
void OnLocalSurfaceIdChanged(
const cc::RenderFrameMetadata& metadata) override {}
void OnRootScrollOffsetChanged(
const gfx::PointF& root_scroll_offset) override;
void WasEvicted();
void SetWebContentsAccessibility(
WebContentsAccessibilityAndroid* web_contents_accessibility);
base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
// Methods called from Java
bool IsReady(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
void DismissTextHandles(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
// Returns an int equivalent to an Optional<SKColor>, with a value of 0
// indicating SKTransparent for not set.
jint GetBackgroundColor(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ShowContextMenuAtTouchHandle(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint x,
jint y);
// Notifies that the Visual Viewport's inset bottom has changed.
void OnViewportInsetBottomChanged(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void WriteContentBitmapToDiskAsync(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint width,
jint height,
const base::android::JavaParamRef<jstring>& jpath,
const base::android::JavaParamRef<jobject>& jcallback);
ui::DelegatedFrameHostAndroid* delegated_frame_host_for_testing() {
return delegated_frame_host_.get();
}
void SetNeedsBeginFrameForFlingProgress();
protected:
~RenderWidgetHostViewAndroid() override;
// RenderWidgetHostViewBase:
void UpdateBackgroundColor() override;
bool HasFallbackSurface() const override;
absl::optional<DisplayFeature> GetDisplayFeature() override;
void SetDisplayFeatureForTesting(
const DisplayFeature* display_feature) override;
void NotifyHostAndDelegateOnWasShown(
blink::mojom::RecordContentToVisibleTimeRequestPtr) final;
void RequestPresentationTimeFromHostOrDelegate(
blink::mojom::RecordContentToVisibleTimeRequestPtr) final;
void CancelPresentationTimeRequestForHostAndDelegate() final;
private:
friend class RenderWidgetHostViewAndroidTest;
friend class RenderWidgetHostViewAndroidRotationTest;
FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
GestureManagerListensToChildFrames);
bool ShouldReportAllRootScrolls();
MouseWheelPhaseHandler* GetMouseWheelPhaseHandler() override;
bool ShouldRouteEvents() const;
void UpdateTouchSelectionController(
const viz::Selection<gfx::SelectionBound>& selection,
float page_scale_factor,
float top_controls_height,
float top_controls_shown_ratio,
const gfx::SizeF& scrollable_viewport_size_dip);
bool UpdateControls(float dip_scale,
float top_controls_height,
float top_controls_shown_ratio,
float top_controls_min_height_offset,
float bottom_controls_height,
float bottom_controls_shown_ratio,
float bottom_controls_min_height_offset);
void OnDidUpdateVisualPropertiesComplete(
const cc::RenderFrameMetadata& metadata);
void OnFinishGetContentBitmap(const base::android::JavaRef<jobject>& obj,
const base::android::JavaRef<jobject>& callback,
const std::string& path,
const SkBitmap& bitmap);
void ShowInternal();
void HideInternal();
void AttachLayers();
void RemoveLayers();
// Helper function to update background color for WebView on fullscreen
// changes. See https://crbug.com/961223.
void UpdateWebViewBackgroundColorIfNecessary();
// DevTools ScreenCast support for Android WebView.
void SynchronousCopyContents(
const gfx::Rect& src_subrect_dip,
const gfx::Size& dst_size_in_pixel,
base::OnceCallback<void(const SkBitmap&)> callback);
void MaybeCreateSynchronousCompositor();
void ResetSynchronousCompositor();
void StartObservingRootWindow();
void StopObservingRootWindow();
bool Animate(base::TimeTicks frame_time);
void RequestDisallowInterceptTouchEvent();
void ComputeEventLatencyOSTouchHistograms(const ui::MotionEvent& event);
void CreateOverscrollControllerIfPossible();
void UpdateMouseState(int action_button,
float mousedown_x,
float mouse_down_y);
WebContentsAccessibilityAndroid* GetWebContentsAccessibilityAndroid() const;
void OnFocusInternal();
void LostFocusInternal();
void SetTextHandlesHiddenForStylus(bool hide_handles);
void SetTextHandlesHiddenInternal();
void OnUpdateScopedSelectionHandles();
void HandleSwipeToMoveCursorGestureAck(const blink::WebGestureEvent& event);
void BeginRotationBatching();
void EndRotationBatching();
void BeginRotationEmbed();
bool is_showing_;
// Window-specific bits that affect widget visibility.
bool is_window_visible_;
bool is_window_activity_started_;
// Used to customize behavior for virtual reality mode, such as the
// appearance of overscroll glow and the keyboard.
bool is_in_vr_;
// Specifies whether touch selection handles are hidden due to stylus.
bool handles_hidden_by_stylus_ = false;
// Specifies whether touch selection handles are hidden due to text selection.
bool handles_hidden_by_selection_ui_ = false;
raw_ptr<ImeAdapterAndroid> ime_adapter_android_;
raw_ptr<SelectionPopupController> selection_popup_controller_;
raw_ptr<TextSuggestionHostAndroid> text_suggestion_host_;
raw_ptr<GestureListenerManager> gesture_listener_manager_;
mutable ui::ViewAndroid view_;
std::unique_ptr<ui::DelegatedFrameHostAndroid::Client>
delegated_frame_host_client_;
// Manages the Compositor Frames received from the renderer.
std::unique_ptr<ui::DelegatedFrameHostAndroid> delegated_frame_host_;
// The most recent surface size that was pushed to the surface layer.
gfx::Size current_surface_size_;
// Used to control and render overscroll-related effects.
std::unique_ptr<OverscrollControllerAndroid> overscroll_controller_;
// Provides gesture synthesis given a stream of touch events (derived from
// Android MotionEvent's) and touch event acks.
ui::FilteredGestureProvider gesture_provider_;
// Handles gesture based text selection
StylusTextSelector stylus_text_selector_;
// Manages selection handle rendering and manipulation.
// This will always be NULL if |content_view_core_| is NULL.
std::unique_ptr<ui::TouchSelectionController> touch_selection_controller_;
std::unique_ptr<ui::TouchSelectionControllerClient>
touch_selection_controller_client_for_test_;
// Keeps track of currently active touch selection controller clients (some
// may be representing out-of-process iframes).
std::unique_ptr<TouchSelectionControllerClientManagerAndroid>
touch_selection_controller_client_manager_;
// Notifies the WindowAndroid when the page has active selection handles.
std::unique_ptr<ui::WindowAndroid::ScopedSelectionHandles>
scoped_selection_handles_;
// Bounds to use if we have no backing WebContents.
gfx::Rect default_bounds_;
const bool using_browser_compositor_;
std::unique_ptr<SynchronousCompositorHost> sync_compositor_;
uint32_t sync_compositor_last_frame_token_ = 0u;
raw_ptr<SynchronousCompositorClient> synchronous_compositor_client_;
bool observing_root_window_;
bool controls_initialized_ = false;
float prev_top_shown_pix_;
float prev_top_controls_pix_;
float prev_top_controls_translate_;
float prev_top_controls_min_height_offset_pix_;
float prev_bottom_shown_pix_;
float prev_bottom_controls_translate_;
float prev_bottom_controls_min_height_offset_pix_;
float page_scale_;
float min_page_scale_;
float max_page_scale_;
base::TimeTicks prev_mousedown_timestamp_;
gfx::Point prev_mousedown_point_;
int left_click_count_ = 0;
base::ObserverList<DestructionObserver>::Unchecked destruction_observers_;
MouseWheelPhaseHandler mouse_wheel_phase_handler_;
uint32_t latest_capture_sequence_number_ = 0u;
viz::ParentLocalSurfaceIdAllocator local_surface_id_allocator_;
bool in_rotation_ = false;
// Tracks whether rotation was due to a fullscreen transition. Upon exiting
// fullscren the subsequent rotation order will be different.
bool fullscreen_rotation_ = false;
// Tracks the time at which rotation started, along with the targeted
// viz::LocalSurfaceId which would first embed the new rotation. This is a
// deque because it is possible that one rotation may be interrupted by
// another before the first has displayed. This can occur on pages that have
// long layout and rendering time.
std::deque<std::pair<base::TimeTicks, viz::LocalSurfaceId>> rotation_metrics_;
// If true, then content was displayed before the completion of the initial
// navigation. After any content has been displayed, we need to allocate a new
// surface for all subsequent navigations.
bool pre_navigation_content_ = false;
// If true, then the next allocated surface should be embedded.
bool navigation_while_hidden_ = false;
// False at creation time until the connection to the renderer process is
// established. If the connection is lost (ie. renderer process crash) then
// this object will be destroyed and recreated for the new process.
// NOTE: Due to unfortunate circumstances, the RenderWidgetHost and the
// RenderWidgetHostView will outlive the renderer-side object if a
// cross-process navigation occurs and the main frame moves out of the
// process. At that time this value would remain true though there is no
// Widget anymore associated with it. See https://crbug.com/419087.
bool renderer_widget_created_ = false;
// Tracks whether we are in SynchronousCopyContents to avoid repeated calls
// into DevTools capture logic.
// TODO(ericrk): Make this more robust.
bool in_sync_copy_contents_ = false;
// Whether swipe-to-move-cursor gesture is activated.
bool swipe_to_move_cursor_activated_ = false;
// A cached copy of the most up to date RenderFrameMetadata.
absl::optional<cc::RenderFrameMetadata> last_render_frame_metadata_;
raw_ptr<WebContentsAccessibilityAndroid> web_contents_accessibility_ =
nullptr;
SurfaceIdChangedCallbackList surface_id_changed_callbacks_;
base::android::ScopedJavaGlobalRef<jobject> obj_;
bool is_surface_sync_throttling_ = false;
base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_{this};
};
} // namespace content
#endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_