d8737734bf
* chore: bump chromium in DEPS to 9321f32fb1b3af8fdfce55c7bbfacf3f75118dca * Update patches * Update electron_swiftshader_binaries deps https://chromium-review.googlesource.com/c/chromium/src/+/2056931 * Use Promise with RequestPointerLock calls https://chromium-review.googlesource.com/c/chromium/src/+/2069199 * Replace content::CursorInfo with ui::Cursor https://chromium-review.googlesource.com/c/chromium/src/+/1999201 * Convert MaterialDesignController to a true singleton. https://chromium-review.googlesource.com/c/chromium/src/+/2090877 * Drop WebContentsView::RenderViewCreated hook https://chromium-review.googlesource.com/c/chromium/src/+/2093535 * chore: bump chromium in DEPS to 6478123cfa0102ed754c70eb9bbdd391d676a4dd * Splitting context_menu_params.h into separate browser VS common parts. https://chromium-review.googlesource.com/c/chromium/src/+/2097468 * Fix DCHECK on OnThemeChanged() https://chromium-review.googlesource.com/c/chromium/src/+/2090713 * chore: bump chromium in DEPS to b0269bb003f699bc8ea7dcba8b0795ef963696d7 * Remove no longer needed patch * Check PointerLock requests for new options and update accordingly https://chromium-review.googlesource.com/c/chromium/src/+/2071788 * Address issues from review * Fixup compile error * Add additional library files * chore: bump chromium in DEPS to a41285fb8aebc8f70ed4cfe2262ea833750eaddb * Update patches Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
109 lines
3.6 KiB
Objective-C
109 lines
3.6 KiB
Objective-C
// Copyright (c) 2016 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef SHELL_BROWSER_OSR_OSR_WEB_CONTENTS_VIEW_H_
|
|
#define SHELL_BROWSER_OSR_OSR_WEB_CONTENTS_VIEW_H_
|
|
|
|
#include "shell/browser/native_window.h"
|
|
#include "shell/browser/native_window_observer.h"
|
|
|
|
#include "content/browser/renderer_host/render_view_host_delegate_view.h" // nogncheck
|
|
#include "content/browser/web_contents/web_contents_view.h" // nogncheck
|
|
#include "content/public/browser/web_contents.h"
|
|
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
|
|
|
#if defined(OS_MACOSX)
|
|
#ifdef __OBJC__
|
|
@class OffScreenView;
|
|
#else
|
|
class OffScreenView;
|
|
#endif
|
|
#endif
|
|
|
|
namespace electron {
|
|
|
|
class OffScreenWebContentsView : public content::WebContentsView,
|
|
public content::RenderViewHostDelegateView,
|
|
public NativeWindowObserver {
|
|
public:
|
|
OffScreenWebContentsView(bool transparent, const OnPaintCallback& callback);
|
|
~OffScreenWebContentsView() override;
|
|
|
|
void SetWebContents(content::WebContents*);
|
|
void SetNativeWindow(NativeWindow* window);
|
|
|
|
// NativeWindowObserver:
|
|
void OnWindowResize() override;
|
|
void OnWindowClosed() override;
|
|
|
|
gfx::Size GetSize();
|
|
|
|
// content::WebContentsView:
|
|
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;
|
|
void FocusThroughTabTraversal(bool reverse) override;
|
|
content::DropData* GetDropData() const override;
|
|
gfx::Rect GetViewBounds() const override;
|
|
void CreateView(gfx::NativeView context) override;
|
|
content::RenderWidgetHostViewBase* CreateViewForWidget(
|
|
content::RenderWidgetHost* render_widget_host) override;
|
|
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
|
|
content::RenderWidgetHost* render_widget_host) override;
|
|
void SetPageTitle(const base::string16& title) override;
|
|
void RenderViewReady() override;
|
|
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
|
content::RenderViewHost* new_host) override;
|
|
void SetOverscrollControllerEnabled(bool enabled) override;
|
|
|
|
#if defined(OS_MACOSX)
|
|
bool CloseTabAfterEventTrackingIfNeeded() override;
|
|
#endif
|
|
|
|
// content::RenderViewHostDelegateView
|
|
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;
|
|
void UpdateDragCursor(blink::WebDragOperation operation) override;
|
|
|
|
void SetPainting(bool painting);
|
|
bool IsPainting() const;
|
|
void SetFrameRate(int frame_rate);
|
|
int GetFrameRate() const;
|
|
|
|
private:
|
|
#if defined(OS_MACOSX)
|
|
void PlatformCreate();
|
|
void PlatformDestroy();
|
|
#endif
|
|
|
|
OffScreenRenderWidgetHostView* GetView() const;
|
|
|
|
NativeWindow* native_window_;
|
|
|
|
const bool transparent_;
|
|
bool painting_ = true;
|
|
int frame_rate_ = 60;
|
|
OnPaintCallback callback_;
|
|
|
|
// Weak refs.
|
|
content::WebContents* web_contents_ = nullptr;
|
|
|
|
#if defined(OS_MACOSX)
|
|
OffScreenView* offScreenView_;
|
|
#endif
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // SHELL_BROWSER_OSR_OSR_WEB_CONTENTS_VIEW_H_
|