2014-07-01 00:30:29 +02:00
|
|
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2011 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_WEB_CONTENTS_VIEW_OSR_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
#include "content/browser/renderer_host/render_view_host_delegate_view.h"
|
|
|
|
#include "content/browser/web_contents/web_contents_view.h"
|
2017-04-20 21:28:17 +02:00
|
|
|
#include "third_party/skia/include/core/SkColor.h"
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
namespace content {
|
2015-07-16 23:40:01 +02:00
|
|
|
class BrowserPluginGuest;
|
2014-07-01 00:30:29 +02:00
|
|
|
class WebContents;
|
|
|
|
class WebContentsViewDelegate;
|
2017-07-27 01:19:27 +02:00
|
|
|
} // namespace content
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
class AlloyBrowserHostImpl;
|
2014-07-01 00:30:29 +02:00
|
|
|
class CefRenderWidgetHostViewOSR;
|
2022-05-27 11:03:31 +02:00
|
|
|
class CefTouchSelectionControllerClientOSR;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
// An implementation of WebContentsView for off-screen rendering.
|
|
|
|
class CefWebContentsViewOSR : public content::WebContentsView,
|
|
|
|
public content::RenderViewHostDelegateView {
|
|
|
|
public:
|
2018-07-03 02:46:03 +02:00
|
|
|
explicit CefWebContentsViewOSR(SkColor background_color,
|
|
|
|
bool use_shared_texture,
|
|
|
|
bool use_external_begin_frame);
|
2021-12-06 21:40:25 +01:00
|
|
|
|
|
|
|
CefWebContentsViewOSR(const CefWebContentsViewOSR&) = delete;
|
|
|
|
CefWebContentsViewOSR& operator=(const CefWebContentsViewOSR&) = delete;
|
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefWebContentsViewOSR() override;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2017-02-15 22:03:00 +01:00
|
|
|
void WebContentsCreated(content::WebContents* web_contents);
|
2015-11-17 19:20:13 +01:00
|
|
|
content::WebContents* web_contents() const { return web_contents_; }
|
2014-09-30 20:52:26 +02:00
|
|
|
|
2020-07-28 05:38:48 +02:00
|
|
|
void RenderViewCreated();
|
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
// WebContentsView methods.
|
2023-10-19 20:08:48 +02:00
|
|
|
gfx::NativeView GetNativeView() const override { return gfx::NativeView(); }
|
|
|
|
gfx::NativeView GetContentNativeView() const override {
|
|
|
|
return gfx::NativeView();
|
|
|
|
}
|
|
|
|
gfx::NativeWindow GetTopLevelNativeWindow() const override {
|
|
|
|
return gfx::NativeWindow();
|
|
|
|
}
|
2020-07-08 19:23:29 +02:00
|
|
|
gfx::Rect GetContainerBounds() const override;
|
2023-10-19 20:08:48 +02:00
|
|
|
void Focus() override {}
|
|
|
|
void SetInitialFocus() override {}
|
|
|
|
void StoreFocus() override {}
|
|
|
|
void RestoreFocus() override {}
|
|
|
|
void FocusThroughTabTraversal(bool reverse) override {}
|
|
|
|
content::DropData* GetDropData() const override { return nullptr; }
|
2014-11-12 20:25:15 +01:00
|
|
|
gfx::Rect GetViewBounds() const override;
|
2023-10-19 20:08:48 +02:00
|
|
|
void CreateView(gfx::NativeView context) override {}
|
2014-11-12 20:25:15 +01:00
|
|
|
content::RenderWidgetHostViewBase* CreateViewForWidget(
|
2020-02-10 18:10:17 +01:00
|
|
|
content::RenderWidgetHost* render_widget_host) override;
|
2018-10-02 14:14:11 +02:00
|
|
|
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
|
2014-11-12 20:25:15 +01:00
|
|
|
content::RenderWidgetHost* render_widget_host) override;
|
2023-10-19 20:08:48 +02:00
|
|
|
void SetPageTitle(const std::u16string& title) override {}
|
|
|
|
void RenderViewReady() override {}
|
2018-07-13 21:29:20 +02:00
|
|
|
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
2023-10-19 20:08:48 +02:00
|
|
|
content::RenderViewHost* new_host) override {}
|
|
|
|
void SetOverscrollControllerEnabled(bool enabled) override {}
|
|
|
|
void OnCapturerCountChanged() override {}
|
|
|
|
void UpdateWindowControlsOverlay(const gfx::Rect& bounding_rect) override {}
|
|
|
|
void CancelDragDropForPortalActivation() override {}
|
2014-07-01 00:30:29 +02:00
|
|
|
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2023-10-19 20:08:48 +02:00
|
|
|
bool CloseTabAfterEventTrackingIfNeeded() override { return false; }
|
2014-07-01 00:30:29 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// RenderViewHostDelegateView methods.
|
2022-05-27 11:03:31 +02:00
|
|
|
void ShowContextMenu(content::RenderFrameHost& render_frame_host,
|
|
|
|
const content::ContextMenuParams& params) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void StartDragging(const content::DropData& drop_data,
|
2023-10-19 20:08:48 +02:00
|
|
|
const url::Origin& source_origin,
|
2020-10-08 21:54:42 +02:00
|
|
|
blink::DragOperationsMask allowed_ops,
|
2017-05-17 11:29:28 +02:00
|
|
|
const gfx::ImageSkia& image,
|
2022-09-26 21:30:45 +02:00
|
|
|
const gfx::Vector2d& cursor_offset,
|
|
|
|
const gfx::Rect& drag_obj_rect,
|
2020-10-08 21:54:42 +02:00
|
|
|
const blink::mojom::DragEventSourceInfo& event_info,
|
2017-05-17 11:29:28 +02:00
|
|
|
content::RenderWidgetHostImpl* source_rwh) override;
|
2023-10-19 20:08:48 +02:00
|
|
|
void UpdateDragOperation(ui::mojom::DragOperation operation,
|
|
|
|
bool document_is_handling_drag) override;
|
2017-07-27 01:19:27 +02:00
|
|
|
virtual void GotFocus(
|
|
|
|
content::RenderWidgetHostImpl* render_widget_host) override;
|
|
|
|
virtual void LostFocus(
|
|
|
|
content::RenderWidgetHostImpl* render_widget_host) override;
|
2017-05-12 20:28:25 +02:00
|
|
|
virtual void TakeFocus(bool reverse) override;
|
2023-10-19 20:08:48 +02:00
|
|
|
virtual void FullscreenStateChanged(bool is_fullscreen) override {}
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
private:
|
2017-02-10 23:44:11 +01:00
|
|
|
CefRenderWidgetHostViewOSR* GetView() const;
|
2020-09-22 21:54:02 +02:00
|
|
|
AlloyBrowserHostImpl* GetBrowser() const;
|
2022-05-27 11:03:31 +02:00
|
|
|
CefTouchSelectionControllerClientOSR* GetSelectionControllerClient() const;
|
2017-02-10 23:44:11 +01:00
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
const SkColor background_color_;
|
2018-07-03 02:46:03 +02:00
|
|
|
const bool use_shared_texture_;
|
|
|
|
const bool use_external_begin_frame_;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
content::WebContents* web_contents_;
|
|
|
|
};
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_
|