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
|
|
|
|
2017-02-10 23:44:11 +01:00
|
|
|
class CefBrowserHostImpl;
|
2014-07-01 00:30:29 +02:00
|
|
|
class CefRenderWidgetHostViewOSR;
|
|
|
|
|
|
|
|
// 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);
|
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
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
// WebContentsView methods.
|
2014-11-12 20:25:15 +01:00
|
|
|
gfx::NativeView GetNativeView() const override;
|
|
|
|
gfx::NativeView GetContentNativeView() const override;
|
|
|
|
gfx::NativeWindow GetTopLevelNativeWindow() const override;
|
|
|
|
void GetContainerBounds(gfx::Rect* out) const override;
|
|
|
|
void SizeContents(const gfx::Size& size) override;
|
|
|
|
void Focus() override;
|
|
|
|
void SetInitialFocus() override;
|
|
|
|
void StoreFocus() override;
|
|
|
|
void RestoreFocus() override;
|
2017-12-07 22:44:24 +01:00
|
|
|
void FocusThroughTabTraversal(bool reverse) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
content::DropData* GetDropData() const override;
|
|
|
|
gfx::Rect GetViewBounds() const override;
|
2019-11-12 17:11:44 +01:00
|
|
|
void CreateView(gfx::NativeView context) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
content::RenderWidgetHostViewBase* CreateViewForWidget(
|
|
|
|
content::RenderWidgetHost* render_widget_host,
|
2017-02-10 23:44:11 +01:00
|
|
|
content::RenderWidgetHost* embedder_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;
|
|
|
|
void SetPageTitle(const base::string16& title) override;
|
|
|
|
void RenderViewCreated(content::RenderViewHost* host) override;
|
2018-07-06 19:11:55 +02:00
|
|
|
void RenderViewReady() override;
|
2018-07-13 21:29:20 +02:00
|
|
|
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
|
|
|
content::RenderViewHost* new_host) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void SetOverscrollControllerEnabled(bool enabled) override;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
#if defined(OS_MACOSX)
|
2019-03-13 22:27:37 +01:00
|
|
|
bool CloseTabAfterEventTrackingIfNeeded() override;
|
2014-07-01 00:30:29 +02: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 20:25:15 +01:00
|
|
|
void UpdateDragCursor(blink::WebDragOperation operation) 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;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
private:
|
2017-02-10 23:44:11 +01:00
|
|
|
CefRenderWidgetHostViewOSR* GetView() const;
|
|
|
|
CefBrowserHostImpl* GetBrowser() const;
|
|
|
|
|
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-07-16 23:40:01 +02:00
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefWebContentsViewOSR);
|
|
|
|
};
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_
|