2014-07-01 00:30:29 +02:00
|
|
|
// Copyright (c) 2014 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions 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.
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_OSR_RENDER_WIDGET_HOST_VIEW_OSR_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_OSR_RENDER_WIDGET_HOST_VIEW_OSR_H_
|
2014-07-01 00:30:29 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-07-03 02:46:03 +02:00
|
|
|
#include <map>
|
2015-08-17 21:48:57 +02:00
|
|
|
#include <set>
|
2014-07-01 00:30:29 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "include/cef_base.h"
|
|
|
|
#include "include/cef_browser.h"
|
2019-07-16 22:09:04 +02:00
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
2019-07-16 22:09:04 +02:00
|
|
|
#include "libcef/browser/osr/host_display_client_osr.h"
|
2019-02-25 22:17:28 +01:00
|
|
|
#include "libcef/browser/osr/motion_event_osr.h"
|
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
#include "base/memory/weak_ptr.h"
|
2016-01-06 20:20:54 +01:00
|
|
|
#include "build/build_config.h"
|
2020-01-31 23:54:26 +01:00
|
|
|
#include "cc/layers/deadline_policy.h"
|
2017-09-06 23:40:58 +02:00
|
|
|
#include "components/viz/common/frame_sinks/begin_frame_source.h"
|
2018-02-15 01:12:09 +01:00
|
|
|
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
|
2018-06-16 00:19:14 +02:00
|
|
|
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
|
2014-07-01 00:30:29 +02:00
|
|
|
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
2019-02-26 17:49:41 +01:00
|
|
|
#include "content/browser/renderer_host/text_input_manager.h"
|
2020-10-08 21:54:42 +02:00
|
|
|
#include "content/public/browser/render_frame_metadata_provider.h"
|
2018-10-02 14:14:11 +02:00
|
|
|
#include "content/public/common/widget_type.h"
|
2021-06-04 03:34:56 +02:00
|
|
|
#include "third_party/abseil-cpp/absl/types/optional.h"
|
2021-12-16 23:35:54 +01:00
|
|
|
#include "third_party/blink/public/mojom/widget/record_content_to_visible_time_request.mojom-forward.h"
|
2021-02-23 21:08:33 +01:00
|
|
|
#include "ui/base/cursor/cursor.h"
|
2020-06-09 19:48:00 +02:00
|
|
|
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
|
2022-05-27 11:03:31 +02:00
|
|
|
#include "ui/base/ime/text_input_client.h"
|
2014-07-01 00:30:29 +02:00
|
|
|
#include "ui/compositor/compositor.h"
|
2019-02-25 22:17:28 +01:00
|
|
|
#include "ui/events/base_event_utils.h"
|
|
|
|
#include "ui/events/gesture_detection/filtered_gesture_provider.h"
|
|
|
|
#include "ui/events/gesture_detection/gesture_configuration.h"
|
|
|
|
#include "ui/events/gesture_detection/motion_event_generic.h"
|
2018-07-03 02:46:03 +02:00
|
|
|
#include "ui/gfx/geometry/rect.h"
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2016-04-27 22:38:52 +02:00
|
|
|
#include "content/browser/renderer_host/browser_compositor_view_mac.h"
|
2014-09-04 19:53:40 +02:00
|
|
|
#endif
|
|
|
|
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2014-07-01 00:30:29 +02:00
|
|
|
#include "ui/gfx/win/window_impl.h"
|
|
|
|
#endif
|
|
|
|
|
2022-05-27 11:03:31 +02:00
|
|
|
namespace ui {
|
|
|
|
class TouchSelectionController;
|
|
|
|
} // namespace ui
|
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
namespace content {
|
2022-05-27 11:03:31 +02:00
|
|
|
class BackingStore;
|
|
|
|
class CursorManager;
|
2018-10-24 22:37:39 +02:00
|
|
|
class DelegatedFrameHost;
|
|
|
|
class DelegatedFrameHostClient;
|
2014-07-01 00:30:29 +02:00
|
|
|
class RenderWidgetHost;
|
|
|
|
class RenderWidgetHostImpl;
|
2016-10-27 17:02:56 +02:00
|
|
|
class RenderWidgetHostViewGuest;
|
2017-07-27 01:19:27 +02:00
|
|
|
} // namespace content
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2015-01-01 17:51:56 +01:00
|
|
|
class CefCopyFrameGenerator;
|
|
|
|
class CefSoftwareOutputDeviceOSR;
|
2022-05-27 11:03:31 +02:00
|
|
|
class CefTouchSelectionControllerClientOSR;
|
2019-07-16 22:09:04 +02:00
|
|
|
class CefVideoConsumerOSR;
|
2014-07-01 00:30:29 +02:00
|
|
|
class CefWebContentsViewOSR;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CefRenderWidgetHostViewOSR
|
|
|
|
//
|
|
|
|
// An object representing the "View" of a rendered web page. This object is
|
|
|
|
// responsible for sending paint events to the the CefRenderHandler
|
|
|
|
// when window rendering is disabled. It is the implementation of the
|
|
|
|
// RenderWidgetHostView that the cross-platform RenderWidgetHost object uses
|
|
|
|
// to display the data.
|
|
|
|
//
|
|
|
|
// Comment excerpted from render_widget_host.h:
|
|
|
|
//
|
|
|
|
// "The lifetime of the RenderWidgetHostView is tied to the render process.
|
|
|
|
// If the render process dies, the RenderWidgetHostView goes away and all
|
|
|
|
// references to it must become NULL."
|
|
|
|
//
|
|
|
|
// RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2016-07-21 23:21:32 +02:00
|
|
|
class MacHelper;
|
2014-09-04 19:53:40 +02:00
|
|
|
#endif
|
2016-06-21 00:59:23 +02:00
|
|
|
|
2020-10-08 21:54:42 +02:00
|
|
|
class CefRenderWidgetHostViewOSR
|
|
|
|
: public content::RenderWidgetHostViewBase,
|
|
|
|
public content::RenderFrameMetadataProvider::Observer,
|
|
|
|
public ui::CompositorDelegate,
|
|
|
|
public content::TextInputManager::Observer,
|
|
|
|
public ui::GestureProviderClient {
|
2014-07-01 00:30:29 +02:00
|
|
|
public:
|
2017-04-20 21:28:17 +02:00
|
|
|
CefRenderWidgetHostViewOSR(SkColor background_color,
|
2018-07-03 02:46:03 +02:00
|
|
|
bool use_shared_texture,
|
|
|
|
bool use_external_begin_frame,
|
2015-11-17 19:20:13 +01:00
|
|
|
content::RenderWidgetHost* widget,
|
2020-02-10 18:10:17 +01:00
|
|
|
CefRenderWidgetHostViewOSR* parent_host_view);
|
2021-12-06 21:40:25 +01:00
|
|
|
|
|
|
|
CefRenderWidgetHostViewOSR(const CefRenderWidgetHostViewOSR&) = delete;
|
|
|
|
CefRenderWidgetHostViewOSR& operator=(const CefRenderWidgetHostViewOSR&) =
|
|
|
|
delete;
|
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefRenderWidgetHostViewOSR() override;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
// RenderWidgetHostView implementation.
|
2014-11-12 20:25:15 +01:00
|
|
|
void InitAsChild(gfx::NativeView parent_view) override;
|
|
|
|
void SetSize(const gfx::Size& size) override;
|
|
|
|
void SetBounds(const gfx::Rect& rect) override;
|
2019-06-05 16:15:45 +02:00
|
|
|
gfx::NativeView GetNativeView() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
gfx::NativeViewAccessible GetNativeViewAccessible() override;
|
|
|
|
void Focus() override;
|
2019-06-05 16:15:45 +02:00
|
|
|
bool HasFocus() override;
|
2018-05-16 11:28:49 +02:00
|
|
|
uint32_t GetCaptureSequenceNumber() const override;
|
2019-06-05 16:15:45 +02:00
|
|
|
bool IsSurfaceAvailableForCopy() override;
|
2021-12-16 23:35:54 +01:00
|
|
|
void ShowWithVisibility(
|
|
|
|
content::PageVisibilityState page_visibility) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void Hide() override;
|
|
|
|
bool IsShowing() override;
|
2019-01-17 10:56:52 +01:00
|
|
|
void EnsureSurfaceSynchronizedForWebTest() override;
|
2022-05-27 11:03:31 +02:00
|
|
|
content::TouchSelectionControllerClientManager*
|
|
|
|
GetTouchSelectionControllerClientManager() override;
|
2019-06-05 16:15:45 +02:00
|
|
|
gfx::Rect GetViewBounds() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void SetBackgroundColor(SkColor color) override;
|
2021-06-04 03:34:56 +02:00
|
|
|
absl::optional<SkColor> GetBackgroundColor() override;
|
2018-05-21 14:54:08 +02:00
|
|
|
void UpdateBackgroundColor() override;
|
2021-06-04 03:34:56 +02:00
|
|
|
absl::optional<content::DisplayFeature> GetDisplayFeature() override;
|
2020-12-02 23:31:49 +01:00
|
|
|
void SetDisplayFeatureForTesting(
|
|
|
|
const content::DisplayFeature* display_feature) override;
|
2020-03-30 22:13:42 +02:00
|
|
|
blink::mojom::PointerLockResult LockMouse(
|
|
|
|
bool request_unadjusted_movement) override;
|
2020-04-14 21:31:00 +02:00
|
|
|
blink::mojom::PointerLockResult ChangeMouseLock(
|
|
|
|
bool request_unadjusted_movement) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void UnlockMouse() override;
|
2018-04-19 17:44:42 +02:00
|
|
|
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2014-11-12 20:25:15 +01:00
|
|
|
void SetActive(bool active) override;
|
|
|
|
void ShowDefinitionForSelection() override;
|
|
|
|
void SpeakSelection() override;
|
2020-08-29 00:39:23 +02:00
|
|
|
void SetWindowFrameInScreen(const gfx::Rect& rect) override;
|
2021-04-21 00:52:34 +02:00
|
|
|
void ShowSharePicker(
|
|
|
|
const std::string& title,
|
|
|
|
const std::string& text,
|
|
|
|
const std::string& url,
|
|
|
|
const std::vector<std::string>& file_paths,
|
|
|
|
blink::mojom::ShareService::ShareCallback callback) override;
|
2022-01-24 18:58:02 +01:00
|
|
|
#endif // BUILDFLAG(IS_MAC)
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
// RenderWidgetHostViewBase implementation.
|
2023-09-15 21:51:43 +02:00
|
|
|
void InvalidateLocalSurfaceIdAndAllocationGroup() override;
|
|
|
|
void ClearFallbackSurfaceForCommitPending() override;
|
2018-09-04 11:43:21 +02:00
|
|
|
void ResetFallbackToFirstNavigationSurface() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
2021-09-20 11:06:23 +02:00
|
|
|
const gfx::Rect& bounds,
|
|
|
|
const gfx::Rect& anchor_rect) override;
|
2023-01-30 18:43:54 +01:00
|
|
|
void UpdateCursor(const ui::Cursor& cursor) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void SetIsLoading(bool is_loading) override;
|
2019-07-16 19:59:21 +02:00
|
|
|
void RenderProcessGone() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void Destroy() override;
|
2021-06-04 03:34:56 +02:00
|
|
|
void UpdateTooltipUnderCursor(const std::u16string& tooltip_text) override;
|
2018-09-14 11:18:10 +02:00
|
|
|
content::CursorManager* GetCursorManager() override;
|
2019-06-05 16:15:45 +02:00
|
|
|
gfx::Size GetCompositorViewportPixelSize() override;
|
2018-03-20 21:15:08 +01:00
|
|
|
void CopyFromSurface(
|
|
|
|
const gfx::Rect& src_rect,
|
|
|
|
const gfx::Size& output_size,
|
|
|
|
base::OnceCallback<void(const SkBitmap&)> callback) override;
|
2021-11-10 22:57:31 +01:00
|
|
|
display::ScreenInfos GetNewScreenInfosForUpdate() override;
|
2018-07-24 00:32:02 +02:00
|
|
|
void TransformPointToRootSurface(gfx::PointF* point) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
gfx::Rect GetBoundsInRootWindow() override;
|
2019-11-26 19:42:34 +01:00
|
|
|
|
2022-01-24 18:58:02 +01:00
|
|
|
#if !BUILDFLAG(IS_MAC)
|
2019-11-26 19:42:34 +01:00
|
|
|
viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(
|
|
|
|
const cc::RenderFrameMetadata& metadata) override;
|
|
|
|
#endif
|
|
|
|
|
2018-02-15 01:12:09 +01:00
|
|
|
viz::SurfaceId GetCurrentSurfaceId() const override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void ImeCompositionRangeChanged(
|
2014-07-01 00:30:29 +02:00
|
|
|
const gfx::Range& range,
|
2023-08-09 23:17:17 +02:00
|
|
|
const absl::optional<std::vector<gfx::Rect>>& character_bounds,
|
|
|
|
const absl::optional<std::vector<gfx::Rect>>& line_bounds) override;
|
2019-02-21 01:42:36 +01:00
|
|
|
std::unique_ptr<content::SyntheticGestureTarget>
|
|
|
|
CreateSyntheticGestureTarget() override;
|
2017-03-03 23:37:23 +01:00
|
|
|
bool TransformPointToCoordSpaceForView(
|
2017-12-07 22:44:24 +01:00
|
|
|
const gfx::PointF& point,
|
2017-03-03 23:37:23 +01:00
|
|
|
RenderWidgetHostViewBase* target_view,
|
2019-03-13 22:27:37 +01:00
|
|
|
gfx::PointF* transformed_point) override;
|
2018-03-20 21:15:08 +01:00
|
|
|
void DidNavigate() override;
|
2021-04-21 00:52:34 +02:00
|
|
|
void SelectionChanged(const std::u16string& text,
|
2018-04-09 19:48:23 +02:00
|
|
|
size_t offset,
|
|
|
|
const gfx::Range& range) override;
|
2020-10-08 21:54:42 +02:00
|
|
|
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;
|
2018-07-24 00:32:02 +02:00
|
|
|
const viz::FrameSinkId& GetFrameSinkId() const override;
|
2019-02-25 22:17:28 +01:00
|
|
|
viz::FrameSinkId GetRootFrameSinkId() override;
|
2021-12-16 23:35:54 +01:00
|
|
|
void NotifyHostAndDelegateOnWasShown(
|
|
|
|
blink::mojom::RecordContentToVisibleTimeRequestPtr visible_time_request)
|
|
|
|
override;
|
2023-02-27 19:52:38 +01:00
|
|
|
void RequestSuccessfulPresentationTimeFromHostOrDelegate(
|
2021-12-16 23:35:54 +01:00
|
|
|
blink::mojom::RecordContentToVisibleTimeRequestPtr visible_time_request)
|
|
|
|
override;
|
2023-02-27 19:52:38 +01:00
|
|
|
void CancelSuccessfulPresentationTimeRequestForHostAndDelegate() override;
|
2018-05-31 22:34:44 +02:00
|
|
|
|
2019-11-12 17:11:44 +01:00
|
|
|
void OnFrameComplete(const viz::BeginFrameAck& ack);
|
2018-07-03 02:46:03 +02:00
|
|
|
|
2020-10-08 21:54:42 +02:00
|
|
|
// RenderFrameMetadataProvider::Observer implementation.
|
|
|
|
void OnRenderFrameMetadataChangedBeforeActivation(
|
|
|
|
const cc::RenderFrameMetadata& metadata) override {}
|
2021-03-04 23:36:57 +01:00
|
|
|
void OnRenderFrameMetadataChangedAfterActivation(
|
|
|
|
base::TimeTicks activation_time) override;
|
2020-10-08 21:54:42 +02:00
|
|
|
void OnRenderFrameSubmission() override {}
|
|
|
|
void OnLocalSurfaceIdChanged(
|
|
|
|
const cc::RenderFrameMetadata& metadata) override {}
|
|
|
|
|
2015-01-01 17:51:56 +01:00
|
|
|
// ui::CompositorDelegate implementation.
|
2019-07-16 22:09:04 +02:00
|
|
|
std::unique_ptr<viz::HostDisplayClient> CreateHostDisplayClient() override;
|
2015-01-01 17:51:56 +01:00
|
|
|
|
2019-02-26 17:49:41 +01:00
|
|
|
// TextInputManager::Observer implementation.
|
|
|
|
void OnUpdateTextInputStateCalled(
|
|
|
|
content::TextInputManager* text_input_manager,
|
|
|
|
RenderWidgetHostViewBase* updated_view,
|
|
|
|
bool did_update_state) override;
|
|
|
|
|
2019-02-25 22:17:28 +01:00
|
|
|
// ui::GestureProviderClient implementation.
|
2020-06-09 19:48:00 +02:00
|
|
|
void ProcessAckedTouchEvent(
|
|
|
|
const content::TouchEventWithLatencyInfo& touch,
|
|
|
|
blink::mojom::InputEventResultState ack_result) override;
|
2019-02-25 22:17:28 +01:00
|
|
|
void OnGestureEvent(const ui::GestureEventData& gesture) override;
|
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
bool InstallTransparency();
|
|
|
|
|
2020-01-31 23:54:26 +01:00
|
|
|
void WasResized();
|
|
|
|
void SynchronizeVisualProperties(
|
|
|
|
const cc::DeadlinePolicy& deadline_policy,
|
2021-06-04 03:34:56 +02:00
|
|
|
const absl::optional<viz::LocalSurfaceId>& child_local_surface_id);
|
2014-07-01 00:30:29 +02:00
|
|
|
void OnScreenInfoChanged();
|
|
|
|
void Invalidate(CefBrowserHost::PaintElementType type);
|
2018-07-03 02:46:03 +02:00
|
|
|
void SendExternalBeginFrame();
|
2014-07-01 00:30:29 +02:00
|
|
|
void SendKeyEvent(const content::NativeWebKeyboardEvent& event);
|
|
|
|
void SendMouseEvent(const blink::WebMouseEvent& event);
|
|
|
|
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event);
|
2019-02-25 22:17:28 +01:00
|
|
|
void SendTouchEvent(const CefTouchEvent& event);
|
|
|
|
bool ShouldRouteEvents() const;
|
2021-09-27 09:50:07 +02:00
|
|
|
void SetFocus(bool focus);
|
2015-05-13 17:43:50 +02:00
|
|
|
void UpdateFrameRate();
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2019-07-16 22:09:04 +02:00
|
|
|
gfx::Size SizeInPixels();
|
2015-01-01 17:51:56 +01:00
|
|
|
void OnPaint(const gfx::Rect& damage_rect,
|
2019-07-16 22:09:04 +02:00
|
|
|
const gfx::Size& pixel_size,
|
|
|
|
const void* pixels);
|
|
|
|
|
|
|
|
void OnBeginFame(base::TimeTicks frame_time);
|
2015-01-01 17:51:56 +01:00
|
|
|
|
2018-10-02 14:14:11 +02:00
|
|
|
bool IsPopupWidget() const {
|
|
|
|
return widget_type_ == content::WidgetType::kPopup;
|
|
|
|
}
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void ImeSetComposition(const CefString& text,
|
|
|
|
const std::vector<CefCompositionUnderline>& underlines,
|
|
|
|
const CefRange& replacement_range,
|
|
|
|
const CefRange& selection_range);
|
2016-10-28 18:11:24 +02:00
|
|
|
void ImeCommitText(const CefString& text,
|
|
|
|
const CefRange& replacement_range,
|
|
|
|
int relative_cursor_pos);
|
|
|
|
void ImeFinishComposingText(bool keep_selection);
|
2018-05-21 14:54:08 +02:00
|
|
|
void ImeCancelComposition() override;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
CefRefPtr<AlloyBrowserHostImpl> browser_impl() const { return browser_impl_; }
|
|
|
|
void set_browser_impl(CefRefPtr<AlloyBrowserHostImpl> browser) {
|
2014-07-01 00:30:29 +02:00
|
|
|
browser_impl_ = browser;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_popup_host_view(CefRenderWidgetHostViewOSR* popup_view) {
|
2023-01-02 23:59:03 +01:00
|
|
|
if (popup_view != popup_host_view_) {
|
2019-02-25 22:17:28 +01:00
|
|
|
forward_touch_to_popup_ = false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2014-07-01 00:30:29 +02:00
|
|
|
popup_host_view_ = popup_view;
|
|
|
|
}
|
2015-06-11 17:00:05 +02:00
|
|
|
void set_child_host_view(CefRenderWidgetHostViewOSR* popup_view) {
|
|
|
|
child_host_view_ = popup_view;
|
|
|
|
}
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
content::RenderWidgetHostImpl* render_widget_host() const {
|
|
|
|
return render_widget_host_;
|
|
|
|
}
|
2016-07-21 23:21:32 +02:00
|
|
|
ui::Layer* GetRootLayer() const;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2019-01-29 21:52:46 +01:00
|
|
|
void OnPresentCompositorFrame();
|
2018-07-03 02:46:03 +02:00
|
|
|
|
2020-01-08 13:33:57 +01:00
|
|
|
void OnDidUpdateVisualPropertiesComplete(
|
|
|
|
const cc::RenderFrameMetadata& metadata);
|
|
|
|
|
2020-07-20 20:24:16 +02:00
|
|
|
void ReleaseCompositor();
|
|
|
|
|
2021-09-22 13:09:38 +02:00
|
|
|
// Marks the current viz::LocalSurfaceId as invalid. AllocateLocalSurfaceId
|
|
|
|
// must be called before submitting new CompositorFrames. May be called by
|
|
|
|
// content::DelegatedFrameHostClient::InvalidateLocalSurfaceIdOnEviction.
|
|
|
|
void InvalidateLocalSurfaceId();
|
|
|
|
|
2022-05-27 11:03:31 +02:00
|
|
|
ui::TouchSelectionController* selection_controller() const {
|
|
|
|
return selection_controller_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
CefTouchSelectionControllerClientOSR* selection_controller_client() const {
|
|
|
|
return selection_controller_client_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
ui::TextInputType GetTextInputType();
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
bool is_hidden() const { return !is_showing_; }
|
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
private:
|
|
|
|
void SetFrameRate();
|
2021-11-10 22:57:31 +01:00
|
|
|
bool SetScreenInfo();
|
2020-01-31 23:54:26 +01:00
|
|
|
bool SetViewBounds();
|
|
|
|
bool SetRootLayerSize(bool force);
|
|
|
|
|
|
|
|
// Manages resizing so that only one resize request is in-flight at a time.
|
|
|
|
bool ResizeRootLayer();
|
|
|
|
void ReleaseResizeHold();
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2015-08-17 21:48:57 +02:00
|
|
|
void CancelWidget();
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2022-05-27 11:03:31 +02:00
|
|
|
// Helper function to create a selection controller.
|
|
|
|
void CreateSelectionController();
|
|
|
|
|
2014-09-27 01:48:19 +02:00
|
|
|
void OnScrollOffsetChanged();
|
|
|
|
|
2017-02-10 23:44:11 +01:00
|
|
|
void AddGuestHostView(CefRenderWidgetHostViewOSR* guest_host);
|
|
|
|
void RemoveGuestHostView(CefRenderWidgetHostViewOSR* guest_host);
|
|
|
|
|
|
|
|
// Register a callback that will be executed when |guest_host_view| receives
|
|
|
|
// OnSwapCompositorFrame. The callback triggers repaint of the embedder view.
|
|
|
|
void RegisterGuestViewFrameSwappedCallback(
|
|
|
|
content::RenderWidgetHostViewGuest* guest_host_view);
|
|
|
|
|
2016-10-27 17:02:56 +02:00
|
|
|
void OnGuestViewFrameSwapped(
|
|
|
|
content::RenderWidgetHostViewGuest* guest_host_view);
|
|
|
|
|
|
|
|
void InvalidateInternal(const gfx::Rect& bounds_in_pixels);
|
|
|
|
|
2016-10-28 18:11:24 +02:00
|
|
|
void RequestImeCompositionUpdate(bool start_monitoring);
|
|
|
|
|
2020-02-10 18:10:17 +01:00
|
|
|
viz::FrameSinkId AllocateFrameSinkId();
|
2017-03-03 23:37:23 +01:00
|
|
|
|
2020-01-31 23:54:26 +01:00
|
|
|
// Forces the view to allocate a new viz::LocalSurfaceId for the next
|
|
|
|
// CompositorFrame submission in anticipation of a synchronization operation
|
|
|
|
// that does not involve a resize or a device scale factor change.
|
|
|
|
void AllocateLocalSurfaceId();
|
2020-10-08 21:54:42 +02:00
|
|
|
const viz::LocalSurfaceId& GetCurrentLocalSurfaceId() const;
|
2020-01-31 23:54:26 +01:00
|
|
|
|
|
|
|
// Sets the current viz::LocalSurfaceId, in cases where the embedded client
|
|
|
|
// has allocated one. Also sets child sequence number component of the
|
|
|
|
// viz::LocalSurfaceId allocator.
|
|
|
|
void UpdateLocalSurfaceIdFromEmbeddedClient(
|
2021-06-04 03:34:56 +02:00
|
|
|
const absl::optional<viz::LocalSurfaceId>& local_surface_id);
|
2020-01-31 23:54:26 +01:00
|
|
|
|
|
|
|
// Returns the current viz::LocalSurfaceIdAllocation.
|
2020-10-08 21:54:42 +02:00
|
|
|
const viz::LocalSurfaceId& GetOrCreateLocalSurfaceId();
|
2020-01-31 23:54:26 +01:00
|
|
|
|
2019-01-29 21:52:46 +01:00
|
|
|
void AddDamageRect(uint32_t sequence, const gfx::Rect& rect);
|
2018-07-03 02:46:03 +02:00
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
// Applies background color without notifying the RenderWidget about
|
|
|
|
// opaqueness changes.
|
|
|
|
void UpdateBackgroundColorFromRenderer(SkColor color);
|
|
|
|
|
2022-05-27 11:03:31 +02:00
|
|
|
// The last selection bounds reported to the view.
|
|
|
|
gfx::SelectionBound selection_start_;
|
|
|
|
gfx::SelectionBound selection_end_;
|
|
|
|
|
|
|
|
std::unique_ptr<CefTouchSelectionControllerClientOSR>
|
|
|
|
selection_controller_client_;
|
|
|
|
std::unique_ptr<ui::TouchSelectionController> selection_controller_;
|
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
// The background color of the web content.
|
|
|
|
SkColor background_color_;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2020-01-31 23:54:26 +01:00
|
|
|
int frame_rate_threshold_us_ = 0;
|
2015-01-01 17:51:56 +01:00
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<ui::Compositor> compositor_;
|
2016-07-06 21:34:09 +02:00
|
|
|
std::unique_ptr<content::DelegatedFrameHost> delegated_frame_host_;
|
2018-10-24 22:37:39 +02:00
|
|
|
std::unique_ptr<content::DelegatedFrameHostClient>
|
|
|
|
delegated_frame_host_client_;
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<ui::Layer> root_layer_;
|
2020-01-31 23:54:26 +01:00
|
|
|
|
|
|
|
// Used to allocate LocalSurfaceIds when this is embedding external content.
|
|
|
|
std::unique_ptr<viz::ParentLocalSurfaceIdAllocator>
|
|
|
|
parent_local_surface_id_allocator_;
|
2019-07-16 22:09:04 +02:00
|
|
|
viz::ParentLocalSurfaceIdAllocator compositor_local_surface_id_allocator_;
|
2017-10-20 19:45:20 +02:00
|
|
|
|
2018-09-14 11:18:10 +02:00
|
|
|
std::unique_ptr<content::CursorManager> cursor_manager_;
|
|
|
|
|
2017-01-23 18:36:54 +01:00
|
|
|
// Provides |source_id| for BeginFrameArgs that we create.
|
2017-09-06 23:40:58 +02:00
|
|
|
viz::StubBeginFrameSource begin_frame_source_;
|
|
|
|
uint64_t begin_frame_number_ = viz::BeginFrameArgs::kStartingFrameNumber;
|
2021-10-28 21:11:22 +02:00
|
|
|
bool begin_frame_pending_ = false;
|
2017-01-23 18:36:54 +01:00
|
|
|
|
2018-07-03 02:46:03 +02:00
|
|
|
bool sync_frame_rate_ = false;
|
|
|
|
bool external_begin_frame_enabled_ = false;
|
|
|
|
bool needs_external_begin_frames_ = false;
|
|
|
|
|
2020-01-31 23:54:26 +01:00
|
|
|
CefHostDisplayClientOSR* host_display_client_ = nullptr;
|
2019-07-16 22:09:04 +02:00
|
|
|
std::unique_ptr<CefVideoConsumerOSR> video_consumer_;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2020-01-31 23:54:26 +01:00
|
|
|
bool hold_resize_ = false;
|
|
|
|
bool pending_resize_ = false;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2022-01-14 17:50:23 +01:00
|
|
|
float cached_scale_factor_ = 0.0f;
|
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
// The associated Model. While |this| is being Destroyed,
|
|
|
|
// |render_widget_host_| is NULL and the message loop is run one last time
|
|
|
|
// Message handlers must check for a NULL |render_widget_host_|.
|
|
|
|
content::RenderWidgetHostImpl* render_widget_host_;
|
2015-06-11 17:00:05 +02:00
|
|
|
|
|
|
|
bool has_parent_;
|
2014-07-01 00:30:29 +02:00
|
|
|
CefRenderWidgetHostViewOSR* parent_host_view_;
|
2020-01-31 23:54:26 +01:00
|
|
|
CefRenderWidgetHostViewOSR* popup_host_view_ = nullptr;
|
|
|
|
CefRenderWidgetHostViewOSR* child_host_view_ = nullptr;
|
2015-08-17 21:48:57 +02:00
|
|
|
std::set<CefRenderWidgetHostViewOSR*> guest_host_views_;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
CefRefPtr<AlloyBrowserHostImpl> browser_impl_;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2020-01-31 23:54:26 +01:00
|
|
|
bool is_showing_ = false;
|
|
|
|
bool is_destroyed_ = false;
|
|
|
|
bool is_first_navigation_ = true;
|
|
|
|
gfx::Rect current_view_bounds_;
|
2014-07-01 00:30:29 +02:00
|
|
|
gfx::Rect popup_position_;
|
2018-07-03 02:46:03 +02:00
|
|
|
base::Lock damage_rect_lock_;
|
|
|
|
std::map<uint32_t, gfx::Rect> damage_rects_;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2019-02-25 22:17:28 +01:00
|
|
|
// Whether pinch-to-zoom should be enabled and pinch events forwarded to the
|
|
|
|
// renderer.
|
|
|
|
bool pinch_zoom_enabled_;
|
|
|
|
|
2014-09-27 01:48:19 +02:00
|
|
|
// The last scroll offset of the view.
|
2021-12-16 23:35:54 +01:00
|
|
|
gfx::PointF last_scroll_offset_;
|
2020-01-31 23:54:26 +01:00
|
|
|
bool is_scroll_offset_changed_pending_ = false;
|
2014-09-27 01:48:19 +02:00
|
|
|
|
2018-06-16 00:19:14 +02:00
|
|
|
content::MouseWheelPhaseHandler mouse_wheel_phase_handler_;
|
|
|
|
|
2018-05-16 11:28:49 +02:00
|
|
|
// Latest capture sequence number which is incremented when the caller
|
|
|
|
// requests surfaces be synchronized via
|
|
|
|
// EnsureSurfaceSynchronizedForLayoutTest().
|
|
|
|
uint32_t latest_capture_sequence_number_ = 0u;
|
|
|
|
|
2019-02-25 22:17:28 +01:00
|
|
|
// ui::GestureProviderClient implementation.
|
|
|
|
ui::FilteredGestureProvider gesture_provider_;
|
|
|
|
|
|
|
|
CefMotionEventOSR pointer_state_;
|
2020-01-31 23:54:26 +01:00
|
|
|
bool forward_touch_to_popup_ = false;
|
2019-02-25 22:17:28 +01:00
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
base::WeakPtrFactory<CefRenderWidgetHostViewOSR> weak_ptr_factory_;
|
|
|
|
};
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_OSR_RENDER_WIDGET_HOST_VIEW_OSR_H_
|