electron/atom/browser/osr_web_contents_view.cc

130 lines
3.3 KiB
C++
Raw Normal View History

2016-07-30 19:35:14 +00:00
// Copyright (c) 2016 GitHub, Inc.
2016-07-20 09:30:06 +00:00
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/osr_web_contents_view.h"
namespace atom {
2016-08-01 11:27:39 +00:00
OffScreenWebContentsView::OffScreenWebContentsView(bool transparent):
transparent_(transparent),
web_contents_(nullptr) {
2016-07-20 09:30:06 +00:00
}
2016-07-29 12:50:27 +00:00
2016-07-20 09:30:06 +00:00
OffScreenWebContentsView::~OffScreenWebContentsView() {
}
2016-07-27 12:36:22 +00:00
void OffScreenWebContentsView::SetWebContents(
content::WebContents* web_contents) {
web_contents_ = web_contents;
}
2016-07-30 18:39:17 +00:00
gfx::NativeView OffScreenWebContentsView::GetNativeView() const {
2016-07-20 09:30:06 +00:00
return gfx::NativeView();
}
2016-07-30 18:39:17 +00:00
gfx::NativeView OffScreenWebContentsView::GetContentNativeView() const {
2016-07-20 09:30:06 +00:00
return gfx::NativeView();
}
2016-07-30 18:39:17 +00:00
gfx::NativeWindow OffScreenWebContentsView::GetTopLevelNativeWindow() const {
2016-07-20 09:30:06 +00:00
return gfx::NativeWindow();
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::GetContainerBounds(gfx::Rect* out) const {
2016-07-20 09:30:06 +00:00
*out = GetViewBounds();
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::SizeContents(const gfx::Size& size) {
2016-07-20 09:30:06 +00:00
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::Focus() {
2016-07-20 09:30:06 +00:00
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::SetInitialFocus() {
2016-07-20 09:30:06 +00:00
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::StoreFocus() {
2016-07-20 09:30:06 +00:00
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::RestoreFocus() {
2016-07-20 09:30:06 +00:00
}
2016-07-30 18:39:17 +00:00
content::DropData* OffScreenWebContentsView::GetDropData() const {
2016-07-20 09:30:06 +00:00
return nullptr;
}
2016-07-30 18:39:17 +00:00
gfx::Rect OffScreenWebContentsView::GetViewBounds() const {
2016-07-20 09:30:06 +00:00
return view_ ? view_->GetViewBounds() : gfx::Rect();
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::CreateView(const gfx::Size& initial_size,
gfx::NativeView context) {
2016-07-20 09:30:06 +00:00
}
content::RenderWidgetHostViewBase*
OffScreenWebContentsView::CreateViewForWidget(
2016-07-30 18:39:17 +00:00
content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
2016-07-27 12:36:22 +00:00
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
2016-08-01 11:27:39 +00:00
view_ = new OffScreenRenderWidgetHostView(transparent_, render_widget_host,
2016-07-29 12:50:27 +00:00
relay->window.get());
2016-07-20 09:30:06 +00:00
return view_;
}
content::RenderWidgetHostViewBase*
OffScreenWebContentsView::CreateViewForPopupWidget(
2016-07-30 18:39:17 +00:00
content::RenderWidgetHost* render_widget_host) {
2016-07-27 12:36:22 +00:00
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
2016-08-01 11:27:39 +00:00
view_ = new OffScreenRenderWidgetHostView(transparent_, render_widget_host,
2016-07-29 12:50:27 +00:00
relay->window.get());
2016-07-20 09:30:06 +00:00
return view_;
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::SetPageTitle(const base::string16& title) {
2016-07-20 09:30:06 +00:00
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::RenderViewCreated(
content::RenderViewHost* host) {
2016-08-01 11:27:39 +00:00
if (view_)
view_->InstallTransparency();
2016-07-20 09:30:06 +00:00
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::RenderViewSwappedIn(
content::RenderViewHost* host) {
2016-07-20 09:30:06 +00:00
}
2016-07-30 18:39:17 +00:00
void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled) {
2016-07-20 09:30:06 +00:00
}
#if defined(OS_MACOSX)
void OffScreenWebContentsView::SetAllowOtherViews(bool allow) {
}
bool OffScreenWebContentsView::GetAllowOtherViews() const {
return false;
}
bool OffScreenWebContentsView::IsEventTracking() const {
return false;
}
void OffScreenWebContentsView::CloseTabAfterEventTracking() {
}
#endif // defined(OS_MACOSX)
void OffScreenWebContentsView::StartDragging(
const content::DropData& drop_data,
blink::WebDragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const content::DragEventSourceInfo& event_info) {
2016-08-01 10:06:46 +00:00
if (web_contents_)
web_contents_->SystemDragEnded();
}
void OffScreenWebContentsView::UpdateDragCursor(
blink::WebDragOperation operation) {
}
2016-07-20 09:30:06 +00:00
} // namespace atom