2012-11-21 01:40:15 +01: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.
|
|
|
|
|
|
|
|
#include "libcef/browser/render_widget_host_view_osr.h"
|
|
|
|
#include "libcef/browser/web_contents_view_osr.h"
|
|
|
|
|
|
|
|
#include "content/public/browser/render_widget_host.h"
|
|
|
|
#include "content/public/browser/web_contents.h"
|
|
|
|
|
|
|
|
CefWebContentsViewOSR::CefWebContentsViewOSR(
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
content::WebContentsViewDelegate* delegate)
|
|
|
|
: web_contents_(web_contents),
|
|
|
|
view_(NULL) {
|
|
|
|
}
|
|
|
|
|
|
|
|
CefWebContentsViewOSR::~CefWebContentsViewOSR() {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Overridden from WebContentsView:
|
|
|
|
|
2013-01-14 20:21:17 +01:00
|
|
|
void CefWebContentsViewOSR::CreateView(const gfx::Size& initial_size,
|
|
|
|
gfx::NativeView context) {
|
2012-11-21 01:40:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
content::RenderWidgetHostView* CefWebContentsViewOSR::CreateViewForWidget(
|
|
|
|
content::RenderWidgetHost* render_widget_host) {
|
|
|
|
if (render_widget_host->GetView())
|
|
|
|
return render_widget_host->GetView();
|
|
|
|
|
|
|
|
view_ = new CefRenderWidgetHostViewOSR(render_widget_host);
|
|
|
|
return view_;
|
|
|
|
}
|
|
|
|
|
2013-01-12 00:00:39 +01:00
|
|
|
content::RenderWidgetHostView* CefWebContentsViewOSR::CreateViewForPopupWidget(
|
|
|
|
content::RenderWidgetHost* render_widget_host) {
|
|
|
|
CefRenderWidgetHostViewOSR* popup_widget =
|
|
|
|
new CefRenderWidgetHostViewOSR(render_widget_host);
|
|
|
|
return popup_widget;
|
|
|
|
}
|
|
|
|
|
2012-11-21 01:40:15 +01:00
|
|
|
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
|
|
|
|
return gfx::NativeView();
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::NativeView CefWebContentsViewOSR::GetContentNativeView() const {
|
|
|
|
return gfx::NativeView();
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::NativeWindow CefWebContentsViewOSR::GetTopLevelNativeWindow() const {
|
|
|
|
return gfx::NativeWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CefWebContentsViewOSR::GetContainerBounds(gfx::Rect *out) const {
|
|
|
|
*out = GetViewBounds();
|
|
|
|
}
|
|
|
|
|
2013-12-17 23:04:35 +01:00
|
|
|
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {
|
2012-11-21 01:40:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefWebContentsViewOSR::OnTabCrashed(base::TerminationStatus status,
|
|
|
|
int error_code) {
|
|
|
|
view_ = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefWebContentsViewOSR::SizeContents(const gfx::Size& size) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
|
2013-01-12 00:00:39 +01:00
|
|
|
if (view_) {
|
|
|
|
CefRenderWidgetHostViewOSR* osr_view =
|
|
|
|
static_cast<CefRenderWidgetHostViewOSR*>(view_);
|
|
|
|
osr_view->InstallTransparency();
|
|
|
|
}
|
2012-11-21 01:40:15 +01:00
|
|
|
}
|
|
|
|
|
2013-02-27 18:56:03 +01:00
|
|
|
void CefWebContentsViewOSR::RenderViewSwappedIn(content::RenderViewHost* host) {
|
|
|
|
}
|
|
|
|
|
2013-04-02 19:21:37 +02:00
|
|
|
void CefWebContentsViewOSR::SetOverscrollControllerEnabled(bool enabled) {
|
|
|
|
}
|
|
|
|
|
2012-11-21 01:40:15 +01:00
|
|
|
void CefWebContentsViewOSR::Focus() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefWebContentsViewOSR::SetInitialFocus() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefWebContentsViewOSR::StoreFocus() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefWebContentsViewOSR::RestoreFocus() {
|
|
|
|
}
|
|
|
|
|
2013-07-24 22:15:18 +02:00
|
|
|
content::DropData* CefWebContentsViewOSR::GetDropData() const {
|
2012-11-21 01:40:15 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-02-27 18:56:03 +01:00
|
|
|
gfx::Rect CefWebContentsViewOSR::GetViewBounds() const {
|
|
|
|
return view_ ? view_->GetViewBounds() : gfx::Rect();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(OS_MACOSX)
|
2012-11-21 01:40:15 +01:00
|
|
|
bool CefWebContentsViewOSR::IsEventTracking() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefWebContentsViewOSR::CloseTabAfterEventTracking() {
|
|
|
|
}
|
|
|
|
|
2013-02-27 18:56:03 +01:00
|
|
|
void CefWebContentsViewOSR::SetAllowOverlappingViews(bool overlapping) {
|
2012-11-21 01:40:15 +01:00
|
|
|
}
|
2013-06-22 04:06:32 +02:00
|
|
|
|
|
|
|
bool CefWebContentsViewOSR::GetAllowOverlappingViews() const {
|
|
|
|
return false;
|
|
|
|
}
|
2013-12-17 23:04:35 +01:00
|
|
|
|
|
|
|
void CefWebContentsViewOSR::SetOverlayView(content::WebContentsView* overlay,
|
|
|
|
const gfx::Point& offset) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefWebContentsViewOSR::RemoveOverlayView() {
|
|
|
|
}
|
2013-02-27 18:56:03 +01:00
|
|
|
#endif // defined(OS_MACOSX)
|
2012-11-21 01:40:15 +01:00
|
|
|
|
|
|
|
// RenderViewHostDelegateView methods.
|
|
|
|
|
2013-07-24 22:15:18 +02:00
|
|
|
void CefWebContentsViewOSR::StartDragging(
|
|
|
|
const content::DropData& drop_data,
|
2013-11-08 22:28:56 +01:00
|
|
|
blink::WebDragOperationsMask allowed_ops,
|
2012-11-21 01:40:15 +01:00
|
|
|
const gfx::ImageSkia& image,
|
|
|
|
const gfx::Vector2d& image_offset,
|
|
|
|
const content::DragEventSourceInfo& event_info) {
|
|
|
|
// Dragging is not supported when window rendering is disabled.
|
|
|
|
web_contents_->SystemDragEnded();
|
|
|
|
}
|
|
|
|
|
2013-07-24 22:15:18 +02:00
|
|
|
void CefWebContentsViewOSR::ShowPopupMenu(
|
|
|
|
const gfx::Rect& bounds,
|
2012-11-21 01:40:15 +01:00
|
|
|
int item_height,
|
|
|
|
double item_font_size,
|
|
|
|
int selected_item,
|
2013-07-24 22:15:18 +02:00
|
|
|
const std::vector<content::MenuItem>& items,
|
2012-11-21 01:40:15 +01:00
|
|
|
bool right_aligned,
|
|
|
|
bool allow_multiple_selection) {
|
|
|
|
}
|