2014-06-30 22:30:29 +00: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 13:20:13 -05:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_
|
2014-06-30 22:30:29 +00:00
|
|
|
|
|
|
|
#include "content/browser/renderer_host/render_view_host_delegate_view.h"
|
|
|
|
#include "content/browser/web_contents/web_contents_view.h"
|
2017-04-20 15:28:17 -04:00
|
|
|
#include "third_party/skia/include/core/SkColor.h"
|
2014-06-30 22:30:29 +00:00
|
|
|
|
|
|
|
namespace content {
|
2015-07-16 17:40:01 -04:00
|
|
|
class BrowserPluginGuest;
|
2014-06-30 22:30:29 +00:00
|
|
|
class WebContents;
|
|
|
|
class WebContentsViewDelegate;
|
2017-07-26 19:19:27 -04:00
|
|
|
} // namespace content
|
2014-06-30 22:30:29 +00:00
|
|
|
|
2017-02-10 17:44:11 -05:00
|
|
|
class CefBrowserHostImpl;
|
2014-06-30 22:30:29 +00:00
|
|
|
class CefRenderWidgetHostViewOSR;
|
|
|
|
|
|
|
|
// An implementation of WebContentsView for off-screen rendering.
|
|
|
|
class CefWebContentsViewOSR : public content::WebContentsView,
|
|
|
|
public content::RenderViewHostDelegateView {
|
|
|
|
public:
|
2018-07-02 19:46:03 -05:00
|
|
|
explicit CefWebContentsViewOSR(SkColor background_color,
|
|
|
|
bool use_shared_texture,
|
|
|
|
bool use_external_begin_frame);
|
2014-11-12 19:25:15 +00:00
|
|
|
~CefWebContentsViewOSR() override;
|
2014-06-30 22:30:29 +00:00
|
|
|
|
2017-02-15 16:03:00 -05:00
|
|
|
void WebContentsCreated(content::WebContents* web_contents);
|
2015-11-17 13:20:13 -05:00
|
|
|
content::WebContents* web_contents() const { return web_contents_; }
|
2014-09-30 18:52:26 +00:00
|
|
|
|
2020-07-27 20:38:48 -07:00
|
|
|
void RenderViewCreated();
|
|
|
|
|
2014-06-30 22:30:29 +00:00
|
|
|
// WebContentsView methods.
|
2014-11-12 19:25:15 +00:00
|
|
|
gfx::NativeView GetNativeView() const override;
|
|
|
|
gfx::NativeView GetContentNativeView() const override;
|
|
|
|
gfx::NativeWindow GetTopLevelNativeWindow() const override;
|
2020-07-08 13:23:29 -04:00
|
|
|
gfx::Rect GetContainerBounds() const override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void Focus() override;
|
|
|
|
void SetInitialFocus() override;
|
|
|
|
void StoreFocus() override;
|
|
|
|
void RestoreFocus() override;
|
2017-12-07 16:44:24 -05:00
|
|
|
void FocusThroughTabTraversal(bool reverse) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
content::DropData* GetDropData() const override;
|
|
|
|
gfx::Rect GetViewBounds() const override;
|
2019-11-12 11:11:44 -05:00
|
|
|
void CreateView(gfx::NativeView context) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
content::RenderWidgetHostViewBase* CreateViewForWidget(
|
2020-02-10 12:10:17 -05:00
|
|
|
content::RenderWidgetHost* render_widget_host) override;
|
2018-10-02 15:14:11 +03:00
|
|
|
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
|
2014-11-12 19:25:15 +00:00
|
|
|
content::RenderWidgetHost* render_widget_host) override;
|
|
|
|
void SetPageTitle(const base::string16& title) override;
|
2018-07-06 13:11:55 -04:00
|
|
|
void RenderViewReady() override;
|
2018-07-13 15:29:20 -04:00
|
|
|
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
|
|
|
content::RenderViewHost* new_host) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void SetOverscrollControllerEnabled(bool enabled) override;
|
2014-06-30 22:30:29 +00:00
|
|
|
|
2020-08-28 18:39:23 -04:00
|
|
|
#if defined(OS_MAC)
|
2019-03-13 21:27:37 +00:00
|
|
|
bool CloseTabAfterEventTrackingIfNeeded() override;
|
2014-06-30 22:30:29 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// RenderViewHostDelegateView methods.
|
2017-05-17 11:29:28 +02:00
|
|
|
void StartDragging(const content::DropData& drop_data,
|
|
|
|
blink::WebDragOperationsMask allowed_ops,
|
|
|
|
const gfx::ImageSkia& image,
|
|
|
|
const gfx::Vector2d& image_offset,
|
|
|
|
const content::DragEventSourceInfo& event_info,
|
|
|
|
content::RenderWidgetHostImpl* source_rwh) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void UpdateDragCursor(blink::WebDragOperation operation) override;
|
2017-07-26 19:19:27 -04:00
|
|
|
virtual void GotFocus(
|
|
|
|
content::RenderWidgetHostImpl* render_widget_host) override;
|
|
|
|
virtual void LostFocus(
|
|
|
|
content::RenderWidgetHostImpl* render_widget_host) override;
|
2017-05-12 18:28:25 +00:00
|
|
|
virtual void TakeFocus(bool reverse) override;
|
2014-06-30 22:30:29 +00:00
|
|
|
|
|
|
|
private:
|
2017-02-10 17:44:11 -05:00
|
|
|
CefRenderWidgetHostViewOSR* GetView() const;
|
|
|
|
CefBrowserHostImpl* GetBrowser() const;
|
|
|
|
|
2017-04-20 15:28:17 -04:00
|
|
|
const SkColor background_color_;
|
2018-07-02 19:46:03 -05:00
|
|
|
const bool use_shared_texture_;
|
|
|
|
const bool use_external_begin_frame_;
|
2015-11-17 13:20:13 -05:00
|
|
|
|
2014-06-30 22:30:29 +00:00
|
|
|
content::WebContents* web_contents_;
|
2015-07-16 17:40:01 -04:00
|
|
|
|
2014-06-30 22:30:29 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefWebContentsViewOSR);
|
|
|
|
};
|
|
|
|
|
2015-11-17 13:20:13 -05:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_
|