mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Simplify OSR guest view implementation
This commit is contained in:
@@ -2233,26 +2233,13 @@ bool CefBrowserHostImpl::CanDragEnter(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::ShouldCreateWebContents(
|
||||
void CefBrowserHostImpl::GetCustomWebContentsView(
|
||||
content::WebContents* web_contents,
|
||||
int route_id,
|
||||
int main_frame_route_id,
|
||||
int32_t main_frame_widget_route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace,
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
// In cases where the navigation will occur in a new render process the
|
||||
// |route_id| value will be MSG_ROUTING_NONE here (because the existing
|
||||
// renderer will not be able to communicate with the new renderer) and
|
||||
// OpenURLFromTab will be called after WebContentsCreated.
|
||||
CefBrowserInfoManager::GetInstance()->ShouldCreateWebContents(
|
||||
CefBrowserInfoManager::GetInstance()->GetCustomWebContentsView(
|
||||
web_contents, target_url, view, delegate_view);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::WebContentsCreated(
|
||||
|
@@ -402,16 +402,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
content::WebContents* source,
|
||||
const content::DropData& data,
|
||||
blink::WebDragOperationsMask operations_allowed) override;
|
||||
bool ShouldCreateWebContents(
|
||||
void GetCustomWebContentsView(
|
||||
content::WebContents* web_contents,
|
||||
int route_id,
|
||||
int main_frame_route_id,
|
||||
int32_t main_frame_widget_route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace,
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) override;
|
||||
void WebContentsCreated(content::WebContents* source_contents,
|
||||
|
@@ -257,7 +257,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
return allow;
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::ShouldCreateWebContents(
|
||||
void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
content::WebContents* web_contents,
|
||||
const GURL& target_url,
|
||||
content::WebContentsView** view,
|
||||
@@ -276,7 +276,7 @@ void CefBrowserInfoManager::ShouldCreateWebContents(
|
||||
}
|
||||
|
||||
pending_popup->step =
|
||||
CefBrowserInfoManager::PendingPopup::SHOULD_CREATE_WEB_CONTENTS;
|
||||
CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW;
|
||||
PushPendingPopup(std::move(pending_popup));
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ void CefBrowserInfoManager::WebContentsCreated(
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
|
||||
PopPendingPopup(
|
||||
CefBrowserInfoManager::PendingPopup::SHOULD_CREATE_WEB_CONTENTS,
|
||||
CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW,
|
||||
source_contents->GetRenderViewHost()->GetProcess()->GetID(),
|
||||
source_contents->GetRenderViewHost()->GetRoutingID(),
|
||||
target_url);
|
||||
|
@@ -72,9 +72,9 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
int opener_render_frame_id,
|
||||
bool* no_javascript_access);
|
||||
|
||||
// Called from CefBrowserHostImpl::ShouldCreateWebContents. See comments on
|
||||
// Called from CefBrowserHostImpl::GetCustomWebContentsView. See comments on
|
||||
// PendingPopup for more information.
|
||||
void ShouldCreateWebContents(
|
||||
void GetCustomWebContentsView(
|
||||
content::WebContents* web_contents,
|
||||
const GURL& target_url,
|
||||
content::WebContentsView** view,
|
||||
@@ -138,7 +138,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// an extension guest view then the popup is canceled and
|
||||
// CefBrowserHostImpl::OpenURLFromTab is called.
|
||||
// And then the following calls may occur at the same time:
|
||||
// - CefBrowserHostImpl::ShouldCreateWebContents (UIT)
|
||||
// - CefBrowserHostImpl::GetCustomWebContentsView (UIT)
|
||||
// Creates the OSR views for windowless popups.
|
||||
// - CefBrowserHostImpl::WebContentsCreated (UIT)
|
||||
// Creates the CefBrowserHostImpl representation for the popup.
|
||||
@@ -150,7 +150,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// to differentiate between them at different processing steps.
|
||||
enum Step {
|
||||
CAN_CREATE_WINDOW,
|
||||
SHOULD_CREATE_WEB_CONTENTS
|
||||
GET_CUSTOM_WEB_CONTENTS_VIEW,
|
||||
} step;
|
||||
|
||||
// Initial state from ViewHostMsg_CreateWindow.
|
||||
@@ -170,11 +170,11 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
|
||||
};
|
||||
|
||||
// Between the calls to CanCreateWindow and ShouldCreateWebContents
|
||||
// Between the calls to CanCreateWindow and GetCustomWebContentsView
|
||||
// RenderViewHostImpl::CreateNewWindow() will call
|
||||
// RenderProcessHostImpl::FilterURL() which, in the case of "javascript:"
|
||||
// URIs, rewrites the URL to "about:blank". We need to apply the same filter
|
||||
// otherwise ShouldCreateWebContents will fail to retrieve the PopupInfo.
|
||||
// otherwise GetCustomWebContentsView will fail to retrieve the PopupInfo.
|
||||
static void FilterPendingPopupURL(
|
||||
int render_process_id,
|
||||
std::unique_ptr<PendingPopup> pending_popup);
|
||||
|
@@ -49,8 +49,7 @@ void CefMimeHandlerViewGuestDelegate::OverrideWebContentsCreateParams(
|
||||
}
|
||||
}
|
||||
|
||||
bool CefMimeHandlerViewGuestDelegate::OnGuestAttached(
|
||||
content::WebContentsView* guest_view,
|
||||
void CefMimeHandlerViewGuestDelegate::OnGuestAttached(
|
||||
content::WebContentsView* parent_view) {
|
||||
content::WebContents* web_contents = guest_->web_contents();
|
||||
DCHECK(web_contents);
|
||||
@@ -68,24 +67,9 @@ bool CefMimeHandlerViewGuestDelegate::OnGuestAttached(
|
||||
info->guest_render_id_manager()->add_render_frame_id(
|
||||
main_frame_host->GetProcess()->GetID(),
|
||||
main_frame_host->GetRoutingID());
|
||||
|
||||
if (owner_browser->IsWindowless()) {
|
||||
// Use the OSR view instead of the default WebContentsViewGuest.
|
||||
content::WebContentsImpl* web_contents_impl =
|
||||
static_cast<content::WebContentsImpl*>(web_contents);
|
||||
CefWebContentsViewOSR* view_osr =
|
||||
static_cast<CefWebContentsViewOSR*>(
|
||||
web_contents_impl->GetView());
|
||||
view_osr->set_web_contents(web_contents);
|
||||
view_osr->set_guest(web_contents_impl->GetBrowserPluginGuest());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefMimeHandlerViewGuestDelegate::OnGuestDetached(
|
||||
content::WebContentsView* guest_view,
|
||||
void CefMimeHandlerViewGuestDelegate::OnGuestDetached(
|
||||
content::WebContentsView* parent_view) {
|
||||
content::WebContents* web_contents = guest_->web_contents();
|
||||
DCHECK(web_contents);
|
||||
@@ -113,21 +97,6 @@ bool CefMimeHandlerViewGuestDelegate::OnGuestDetached(
|
||||
context->OnRenderFrameDeleted(render_process_id, render_frame_id,
|
||||
is_main_frame, true);
|
||||
}
|
||||
|
||||
// Do nothing when the browser is windowless.
|
||||
return owner_browser->IsWindowless();
|
||||
}
|
||||
|
||||
bool CefMimeHandlerViewGuestDelegate::CreateViewForWidget(
|
||||
content::WebContentsView* guest_view,
|
||||
content::RenderWidgetHost* render_widget_host) {
|
||||
CefRefPtr<CefBrowserHostImpl> owner_browser = GetOwnerBrowser(guest_);
|
||||
if (owner_browser->IsWindowless()) {
|
||||
static_cast<CefWebContentsViewOSR*>(guest_view)->CreateViewForWidget(
|
||||
render_widget_host, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefMimeHandlerViewGuestDelegate::HandleContextMenu(
|
||||
|
@@ -22,13 +22,8 @@ class CefMimeHandlerViewGuestDelegate : public MimeHandlerViewGuestDelegate {
|
||||
// MimeHandlerViewGuestDelegate methods.
|
||||
void OverrideWebContentsCreateParams(
|
||||
content::WebContents::CreateParams* params) override;
|
||||
bool OnGuestAttached(content::WebContentsView* guest_view,
|
||||
content::WebContentsView* parent_view) override;
|
||||
bool OnGuestDetached(content::WebContentsView* guest_view,
|
||||
content::WebContentsView* parent_view) override;
|
||||
bool CreateViewForWidget(
|
||||
content::WebContentsView* guest_view,
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
void OnGuestAttached(content::WebContentsView* parent_view) override;
|
||||
void OnGuestDetached(content::WebContentsView* parent_view) override;
|
||||
bool HandleContextMenu(content::WebContents* web_contents,
|
||||
const content::ContextMenuParams& params) override;
|
||||
|
||||
|
@@ -473,8 +473,11 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
DCHECK(render_widget_host_);
|
||||
DCHECK(!render_widget_host_->GetView());
|
||||
|
||||
if (parent_host_view_) {
|
||||
browser_impl_ = parent_host_view_->browser_impl();
|
||||
DCHECK(browser_impl_);
|
||||
} else if (content::RenderViewHost::From(render_widget_host_)) {
|
||||
// CefBrowserHostImpl might not be created at this time for popups.
|
||||
if (content::RenderViewHost::From(render_widget_host_)) {
|
||||
browser_impl_ = CefBrowserHostImpl::GetBrowserForHost(
|
||||
content::RenderViewHost::From(render_widget_host_));
|
||||
}
|
||||
@@ -539,8 +542,7 @@ CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
||||
// Called for full-screen widgets.
|
||||
void CefRenderWidgetHostViewOSR::InitAsChild(gfx::NativeView parent_view) {
|
||||
DCHECK(parent_host_view_);
|
||||
browser_impl_ = parent_host_view_->browser_impl();
|
||||
DCHECK(browser_impl_.get());
|
||||
DCHECK(browser_impl_);
|
||||
|
||||
if (parent_host_view_->child_host_view_) {
|
||||
// Cancel the previous popup widget.
|
||||
@@ -745,8 +747,7 @@ void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||
content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) {
|
||||
DCHECK_EQ(parent_host_view_, parent_host_view);
|
||||
browser_impl_ = parent_host_view_->browser_impl();
|
||||
DCHECK(browser_impl_.get());
|
||||
DCHECK(browser_impl_);
|
||||
|
||||
if (parent_host_view_->popup_host_view_) {
|
||||
// Cancel the previous popup widget.
|
||||
@@ -775,6 +776,18 @@ void CefRenderWidgetHostViewOSR::InitAsFullscreen(
|
||||
NOTREACHED() << "Fullscreen widgets are not supported in OSR";
|
||||
}
|
||||
|
||||
// Called for the "platform view" created by WebContentsViewGuest and owned by
|
||||
// RenderWidgetHostViewGuest.
|
||||
void CefRenderWidgetHostViewOSR::InitAsGuest(
|
||||
content::RenderWidgetHostView* parent_host_view,
|
||||
content::RenderWidgetHostViewGuest* guest_view) {
|
||||
DCHECK_EQ(parent_host_view_, parent_host_view);
|
||||
DCHECK(browser_impl_);
|
||||
|
||||
parent_host_view_->AddGuestHostView(this);
|
||||
parent_host_view_->RegisterGuestViewFrameSwappedCallback(guest_view);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateCursor(
|
||||
const content::WebCursor& cursor) {
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::UpdateCursor");
|
||||
@@ -1342,24 +1355,6 @@ void CefRenderWidgetHostViewOSR::OnPaint(
|
||||
ReleaseResize();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::AddGuestHostView(
|
||||
CefRenderWidgetHostViewOSR* guest_host) {
|
||||
guest_host_views_.insert(guest_host);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::RemoveGuestHostView(
|
||||
CefRenderWidgetHostViewOSR* guest_host) {
|
||||
guest_host_views_.erase(guest_host);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::RegisterGuestViewFrameSwappedCallback(
|
||||
content::RenderWidgetHostViewGuest* guest_host_view) {
|
||||
guest_host_view->RegisterFrameSwappedCallback(base::MakeUnique<base::Closure>(
|
||||
base::Bind(&CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
base::Unretained(guest_host_view))));
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
|
||||
ui::Compositor* CefRenderWidgetHostViewOSR::GetCompositor() const {
|
||||
@@ -1542,6 +1537,24 @@ void CefRenderWidgetHostViewOSR::OnScrollOffsetChanged() {
|
||||
is_scroll_offset_changed_pending_ = false;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::AddGuestHostView(
|
||||
CefRenderWidgetHostViewOSR* guest_host) {
|
||||
guest_host_views_.insert(guest_host);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::RemoveGuestHostView(
|
||||
CefRenderWidgetHostViewOSR* guest_host) {
|
||||
guest_host_views_.erase(guest_host);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::RegisterGuestViewFrameSwappedCallback(
|
||||
content::RenderWidgetHostViewGuest* guest_host_view) {
|
||||
guest_host_view->RegisterFrameSwappedCallback(base::MakeUnique<base::Closure>(
|
||||
base::Bind(&CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
base::Unretained(guest_host_view))));
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped(
|
||||
content::RenderWidgetHostViewGuest* guest_host_view) {
|
||||
InvalidateInternal(
|
||||
|
@@ -130,6 +130,8 @@ class CefRenderWidgetHostViewOSR
|
||||
const gfx::Rect& pos) override;
|
||||
void InitAsFullscreen(
|
||||
content::RenderWidgetHostView* reference_host_view) override;
|
||||
void InitAsGuest(content::RenderWidgetHostView* parent_host_view,
|
||||
content::RenderWidgetHostViewGuest* guest_view) override;
|
||||
void UpdateCursor(const content::WebCursor& cursor) override;
|
||||
void SetIsLoading(bool is_loading) override;
|
||||
void RenderProcessGone(base::TerminationStatus status,
|
||||
@@ -229,14 +231,6 @@ class CefRenderWidgetHostViewOSR
|
||||
void ImeFinishComposingText(bool keep_selection);
|
||||
void ImeCancelComposition();
|
||||
|
||||
void AddGuestHostView(CefRenderWidgetHostViewOSR* guest_host);
|
||||
void RemoveGuestHostView(CefRenderWidgetHostViewOSR* guest_host);
|
||||
|
||||
// Register a callback that will be executed when |guest_host_view| receives
|
||||
// OnSwapCompositorFrame. The callback triggers repaint of the embedder view.
|
||||
void RegisterGuestViewFrameSwappedCallback(
|
||||
content::RenderWidgetHostViewGuest* guest_host_view);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser_impl() const { return browser_impl_; }
|
||||
void set_browser_impl(CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
browser_impl_ = browser;
|
||||
@@ -270,6 +264,14 @@ class CefRenderWidgetHostViewOSR
|
||||
|
||||
void OnScrollOffsetChanged();
|
||||
|
||||
void AddGuestHostView(CefRenderWidgetHostViewOSR* guest_host);
|
||||
void RemoveGuestHostView(CefRenderWidgetHostViewOSR* guest_host);
|
||||
|
||||
// Register a callback that will be executed when |guest_host_view| receives
|
||||
// OnSwapCompositorFrame. The callback triggers repaint of the embedder view.
|
||||
void RegisterGuestViewFrameSwappedCallback(
|
||||
content::RenderWidgetHostViewGuest* guest_host_view);
|
||||
|
||||
void OnGuestViewFrameSwapped(
|
||||
content::RenderWidgetHostViewGuest* guest_host_view);
|
||||
|
||||
|
@@ -18,9 +18,7 @@
|
||||
|
||||
CefWebContentsViewOSR::CefWebContentsViewOSR(bool transparent)
|
||||
: transparent_(transparent),
|
||||
web_contents_(NULL),
|
||||
view_(NULL),
|
||||
guest_(NULL) {
|
||||
web_contents_(NULL) {
|
||||
}
|
||||
|
||||
CefWebContentsViewOSR::~CefWebContentsViewOSR() {
|
||||
@@ -32,11 +30,6 @@ void CefWebContentsViewOSR::set_web_contents(
|
||||
web_contents_ = web_contents;
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::set_guest(content::BrowserPluginGuest* guest) {
|
||||
DCHECK(!guest_);
|
||||
guest_ = guest;
|
||||
}
|
||||
|
||||
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
|
||||
return gfx::NativeView();
|
||||
}
|
||||
@@ -50,39 +43,18 @@ gfx::NativeWindow CefWebContentsViewOSR::GetTopLevelNativeWindow() const {
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::GetScreenInfo(content::ScreenInfo* results) const {
|
||||
if (view_)
|
||||
view_->GetScreenInfo(results);
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
if (view)
|
||||
view->GetScreenInfo(results);
|
||||
else
|
||||
WebContentsView::GetDefaultScreenInfo(results);
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::GetContainerBounds(gfx::Rect* out) const {
|
||||
if (guest_) {
|
||||
// Based on WebContentsViewGuest::GetContainerBounds.
|
||||
if (guest_->embedder_web_contents()) {
|
||||
// We need embedder container's bounds to calculate our bounds.
|
||||
guest_->embedder_web_contents()->GetView()->GetContainerBounds(out);
|
||||
gfx::Point guest_coordinates = guest_->GetScreenCoordinates(gfx::Point());
|
||||
out->Offset(guest_coordinates.x(), guest_coordinates.y());
|
||||
} else {
|
||||
out->set_origin(gfx::Point());
|
||||
}
|
||||
out->set_size(size_);
|
||||
return;
|
||||
}
|
||||
|
||||
*out = GetViewBounds();
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::SizeContents(const gfx::Size& size) {
|
||||
if (guest_) {
|
||||
// Based on WebContentsViewGuest::SizeContents.
|
||||
size_ = size;
|
||||
content::RenderWidgetHostView* rwhv =
|
||||
web_contents_->GetRenderWidgetHostView();
|
||||
if (rwhv)
|
||||
rwhv->SetSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::Focus() {
|
||||
@@ -102,71 +74,49 @@ content::DropData* CefWebContentsViewOSR::GetDropData() const {
|
||||
}
|
||||
|
||||
gfx::Rect CefWebContentsViewOSR::GetViewBounds() const {
|
||||
if (guest_) {
|
||||
// Based on WebContentsViewGuest::GetViewBounds.
|
||||
return gfx::Rect(size_);
|
||||
}
|
||||
|
||||
return view_ ? view_->GetViewBounds() : gfx::Rect();
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
return view ? view->GetViewBounds() : gfx::Rect();
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::CreateView(const gfx::Size& initial_size,
|
||||
gfx::NativeView context) {
|
||||
if (guest_) {
|
||||
// Based on WebContentsViewGuest::CreateView.
|
||||
size_ = initial_size;
|
||||
}
|
||||
}
|
||||
|
||||
content::RenderWidgetHostViewBase* CefWebContentsViewOSR::CreateViewForWidget(
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
bool is_guest_view_hack) {
|
||||
content::RenderWidgetHost* embedder_render_widget_host) {
|
||||
if (render_widget_host->GetView()) {
|
||||
return static_cast<content::RenderWidgetHostViewBase*>(
|
||||
render_widget_host->GetView());
|
||||
}
|
||||
|
||||
if (guest_) {
|
||||
// Based on WebContentsViewGuest::CreateViewForWidget.
|
||||
content::WebContents* embedder_web_contents =
|
||||
guest_->embedder_web_contents();
|
||||
CefRenderWidgetHostViewOSR* embedder_host_view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(
|
||||
embedder_web_contents->GetRenderViewHost()->GetWidget()->GetView());
|
||||
|
||||
CefRenderWidgetHostViewOSR* platform_widget =
|
||||
new CefRenderWidgetHostViewOSR(transparent_, render_widget_host,
|
||||
embedder_host_view);
|
||||
embedder_host_view->AddGuestHostView(platform_widget);
|
||||
|
||||
content::RenderWidgetHostViewGuest* guest_host_view =
|
||||
content::RenderWidgetHostViewGuest::Create(
|
||||
render_widget_host,
|
||||
guest_,
|
||||
platform_widget->GetWeakPtr());
|
||||
embedder_host_view->RegisterGuestViewFrameSwappedCallback(guest_host_view);
|
||||
return guest_host_view;
|
||||
CefRenderWidgetHostViewOSR* embedder_host_view = nullptr;
|
||||
if (embedder_render_widget_host) {
|
||||
embedder_host_view = static_cast<CefRenderWidgetHostViewOSR*>(
|
||||
embedder_render_widget_host->GetView());
|
||||
}
|
||||
|
||||
view_ = new CefRenderWidgetHostViewOSR(transparent_, render_widget_host,
|
||||
NULL);
|
||||
return view_;
|
||||
return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host,
|
||||
embedder_host_view);
|
||||
}
|
||||
|
||||
// Called for popup and fullscreen widgets.
|
||||
content::RenderWidgetHostViewBase*
|
||||
CefWebContentsViewOSR::CreateViewForPopupWidget(
|
||||
content::RenderWidgetHost* render_widget_host) {
|
||||
return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host,
|
||||
view_);
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
CHECK(view);
|
||||
|
||||
return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host, view);
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
|
||||
if (view_)
|
||||
view_->InstallTransparency();
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
if (view)
|
||||
view->InstallTransparency();
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewSwappedIn(
|
||||
@@ -199,33 +149,7 @@ void CefWebContentsViewOSR::StartDragging(
|
||||
const gfx::Vector2d& image_offset,
|
||||
const content::DragEventSourceInfo& event_info,
|
||||
content::RenderWidgetHostImpl* source_rwh) {
|
||||
if (guest_) {
|
||||
// Based on WebContentsViewGuest::StartDragging.
|
||||
content::WebContentsImpl* embedder_web_contents =
|
||||
guest_->embedder_web_contents();
|
||||
embedder_web_contents->GetBrowserPluginEmbedder()->StartDrag(guest_);
|
||||
content::RenderViewHostImpl* embedder_render_view_host =
|
||||
static_cast<content::RenderViewHostImpl*>(
|
||||
embedder_web_contents->GetRenderViewHost());
|
||||
CHECK(embedder_render_view_host);
|
||||
content::RenderViewHostDelegateView* view =
|
||||
embedder_render_view_host->GetDelegate()->GetDelegateView();
|
||||
if (view) {
|
||||
content::RecordAction(
|
||||
base::UserMetricsAction("BrowserPlugin.Guest.StartDrag"));
|
||||
view->StartDragging(drop_data, allowed_ops, image, image_offset,
|
||||
event_info, source_rwh);
|
||||
} else {
|
||||
embedder_web_contents->SystemDragEnded(source_rwh);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser;
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(view_);
|
||||
if (view)
|
||||
browser = view->browser_impl();
|
||||
CefRefPtr<CefBrowserHostImpl> browser = GetBrowser();
|
||||
if (browser.get()) {
|
||||
browser->StartDragging(drop_data, allowed_ops, image, image_offset,
|
||||
event_info, source_rwh);
|
||||
@@ -236,24 +160,22 @@ void CefWebContentsViewOSR::StartDragging(
|
||||
|
||||
void CefWebContentsViewOSR::UpdateDragCursor(
|
||||
blink::WebDragOperation operation) {
|
||||
if (guest_) {
|
||||
// Based on WebContentsViewGuest::UpdateDragCursor.
|
||||
content::RenderViewHostImpl* embedder_render_view_host =
|
||||
static_cast<content::RenderViewHostImpl*>(
|
||||
guest_->embedder_web_contents()->GetRenderViewHost());
|
||||
CHECK(embedder_render_view_host);
|
||||
content::RenderViewHostDelegateView* view =
|
||||
embedder_render_view_host->GetDelegate()->GetDelegateView();
|
||||
if (view)
|
||||
view->UpdateDragCursor(operation);
|
||||
return;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser;
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(view_);
|
||||
if (view)
|
||||
browser = view->browser_impl();
|
||||
CefRefPtr<CefBrowserHostImpl> browser = GetBrowser();
|
||||
if (browser.get())
|
||||
browser->UpdateDragCursor(operation);
|
||||
}
|
||||
|
||||
CefRenderWidgetHostViewOSR* CefWebContentsViewOSR::GetView() const {
|
||||
if (web_contents_) {
|
||||
return static_cast<CefRenderWidgetHostViewOSR*>(
|
||||
web_contents_->GetRenderViewHost()->GetWidget()->GetView());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefBrowserHostImpl* CefWebContentsViewOSR::GetBrowser() const {
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
if (view)
|
||||
return view->browser_impl().get();
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ class WebContents;
|
||||
class WebContentsViewDelegate;
|
||||
}
|
||||
|
||||
class CefBrowserHostImpl;
|
||||
class CefRenderWidgetHostViewOSR;
|
||||
|
||||
// An implementation of WebContentsView for off-screen rendering.
|
||||
@@ -26,7 +27,6 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
|
||||
void set_web_contents(content::WebContents* web_contents);
|
||||
content::WebContents* web_contents() const { return web_contents_; }
|
||||
void set_guest(content::BrowserPluginGuest* guest);
|
||||
|
||||
// WebContentsView methods.
|
||||
gfx::NativeView GetNativeView() const override;
|
||||
@@ -45,7 +45,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
gfx::NativeView context) override;
|
||||
content::RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
bool is_guest_view_hack) override;
|
||||
content::RenderWidgetHost* embedder_render_widget_host) override;
|
||||
content::RenderWidgetHostViewBase* CreateViewForPopupWidget(
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
void SetPageTitle(const base::string16& title) override;
|
||||
@@ -71,13 +71,12 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
void UpdateDragCursor(blink::WebDragOperation operation) override;
|
||||
|
||||
private:
|
||||
CefRenderWidgetHostViewOSR* GetView() const;
|
||||
CefBrowserHostImpl* GetBrowser() const;
|
||||
|
||||
const bool transparent_;
|
||||
|
||||
content::WebContents* web_contents_;
|
||||
CefRenderWidgetHostViewOSR* view_;
|
||||
|
||||
content::BrowserPluginGuest* guest_;
|
||||
gfx::Size size_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefWebContentsViewOSR);
|
||||
};
|
||||
|
@@ -58,6 +58,9 @@ patches = [
|
||||
# Fix multiple handling of WM_MOUSEWHEEL messages on Windows.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1481
|
||||
#
|
||||
# Support custom RenderWidgetHostViewOSR for BrowserPluginGuest.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1565
|
||||
#
|
||||
# Fix focus/activation handling and keyboard input on Windows and Linux.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1677
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1679
|
||||
@@ -65,7 +68,7 @@ patches = [
|
||||
#
|
||||
# Support creation of captionless windows with resizable borders.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1749
|
||||
'name': 'views_widget_180_1481_1677_1749',
|
||||
'name': 'views_widget_180_1481_1565_1677_1749',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
@@ -77,7 +80,10 @@ patches = [
|
||||
{
|
||||
# Allow specification of a custom WebContentsView.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1257
|
||||
'name': 'web_contents_1257',
|
||||
#
|
||||
# Support custom RenderWidgetHostViewOSR for BrowserPluginGuest.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1565
|
||||
'name': 'web_contents_1257_1565',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
@@ -87,18 +93,10 @@ patches = [
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Allow specification of a custom WebContentsViewGuest implementation for
|
||||
# MimeHandlerView.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1565
|
||||
'name': 'mime_handler_view_1565',
|
||||
'path': '../extensions/browser/guest_view/mime_handler_view/',
|
||||
},
|
||||
{
|
||||
# Allow specification of a custom WebContentsViewGuest implementation for
|
||||
# BrowserPluginGuest.
|
||||
# Support custom RenderWidgetHostViewOSR for BrowserPluginGuest.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1565
|
||||
'name': 'browser_plugin_guest_1565',
|
||||
'path': '../content/',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Allow customization of the WebView background color.
|
||||
|
@@ -1,97 +1,270 @@
|
||||
diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc
|
||||
index d4d4f14..977e24e 100644
|
||||
--- browser/browser_plugin/browser_plugin_guest.cc
|
||||
+++ browser/browser_plugin/browser_plugin_guest.cc
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
-#include "content/browser/web_contents/web_contents_view_guest.h"
|
||||
+#include "content/browser/web_contents/web_contents_view.h"
|
||||
#include "content/common/browser_plugin/browser_plugin_constants.h"
|
||||
#include "content/common/browser_plugin/browser_plugin_messages.h"
|
||||
#include "content/common/content_constants_internal.h"
|
||||
@@ -310,20 +310,19 @@ void BrowserPluginGuest::InitInternal(
|
||||
guest_window_rect_ = params.view_rect;
|
||||
|
||||
if (owner_web_contents_ != owner_web_contents) {
|
||||
- WebContentsViewGuest* new_view = nullptr;
|
||||
+ WebContentsView* new_view = nullptr;
|
||||
if (!GuestMode::IsCrossProcessFrameGuest(GetWebContents())) {
|
||||
- new_view =
|
||||
- static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
||||
+ new_view = GetWebContents()->GetView();
|
||||
diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc
|
||||
index d4d4f14..15e28ea 100644
|
||||
--- content/browser/browser_plugin/browser_plugin_guest.cc
|
||||
+++ content/browser/browser_plugin/browser_plugin_guest.cc
|
||||
@@ -316,14 +316,20 @@ void BrowserPluginGuest::InitInternal(
|
||||
static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
||||
}
|
||||
|
||||
if (owner_web_contents_ && new_view)
|
||||
- new_view->OnGuestDetached(owner_web_contents_->GetView());
|
||||
+ delegate_->OnGuestDetached(new_view, owner_web_contents_->GetView());
|
||||
- if (owner_web_contents_ && new_view)
|
||||
+ if (owner_web_contents_ && new_view) {
|
||||
new_view->OnGuestDetached(owner_web_contents_->GetView());
|
||||
+ if (delegate_)
|
||||
+ delegate_->OnGuestDetached(owner_web_contents_->GetView());
|
||||
+ }
|
||||
|
||||
// Once a BrowserPluginGuest has an embedder WebContents, it's considered to
|
||||
// be attached.
|
||||
owner_web_contents_ = owner_web_contents;
|
||||
if (new_view)
|
||||
- new_view->OnGuestAttached(owner_web_contents_->GetView());
|
||||
+ delegate_->OnGuestAttached(new_view, owner_web_contents_->GetView());
|
||||
- if (new_view)
|
||||
+ if (new_view) {
|
||||
new_view->OnGuestAttached(owner_web_contents_->GetView());
|
||||
+ if (delegate_)
|
||||
+ delegate_->OnGuestAttached(owner_web_contents_->GetView());
|
||||
+ }
|
||||
}
|
||||
|
||||
RendererPreferences* renderer_prefs =
|
||||
@@ -796,11 +795,10 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
||||
->GetWidget()
|
||||
->Init();
|
||||
GetWebContents()->GetMainFrame()->Init();
|
||||
- WebContentsViewGuest* web_contents_view =
|
||||
- static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
||||
@@ -800,7 +806,8 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
||||
static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
||||
if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) {
|
||||
- web_contents_view->CreateViewForWidget(
|
||||
web_contents_view->CreateViewForWidget(
|
||||
- web_contents()->GetRenderViewHost()->GetWidget(), true);
|
||||
+ delegate_->CreateViewForWidget(
|
||||
+ GetWebContents()->GetView(),
|
||||
+ web_contents()->GetRenderViewHost()->GetWidget());
|
||||
+ web_contents()->GetRenderViewHost()->GetWidget(),
|
||||
+ embedder_web_contents->GetRenderViewHost()->GetWidget());
|
||||
}
|
||||
}
|
||||
|
||||
diff --git public/browser/browser_plugin_guest_delegate.cc public/browser/browser_plugin_guest_delegate.cc
|
||||
index 8d691ef..eb13b5d 100644
|
||||
--- public/browser/browser_plugin_guest_delegate.cc
|
||||
+++ public/browser/browser_plugin_guest_delegate.cc
|
||||
@@ -4,6 +4,8 @@
|
||||
diff --git content/browser/frame_host/interstitial_page_impl.cc content/browser/frame_host/interstitial_page_impl.cc
|
||||
index 4fbe442..3267a71 100644
|
||||
--- content/browser/frame_host/interstitial_page_impl.cc
|
||||
+++ content/browser/frame_host/interstitial_page_impl.cc
|
||||
@@ -587,7 +587,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() {
|
||||
WebContentsView* wcv =
|
||||
static_cast<WebContentsImpl*>(web_contents())->GetView();
|
||||
RenderWidgetHostViewBase* view =
|
||||
- wcv->CreateViewForWidget(render_view_host_->GetWidget(), false);
|
||||
+ wcv->CreateViewForWidget(render_view_host_->GetWidget(), nullptr);
|
||||
RenderWidgetHostImpl::From(render_view_host_->GetWidget())->SetView(view);
|
||||
render_view_host_->AllowBindings(BINDINGS_POLICY_DOM_AUTOMATION);
|
||||
|
||||
#include "content/public/browser/browser_plugin_guest_delegate.h"
|
||||
diff --git content/browser/web_contents/web_contents_view.h content/browser/web_contents/web_contents_view.h
|
||||
index e4401f8..f2fdb9b 100644
|
||||
--- content/browser/web_contents/web_contents_view.h
|
||||
+++ content/browser/web_contents/web_contents_view.h
|
||||
@@ -86,13 +86,9 @@ class WebContentsView {
|
||||
// Sets up the View that holds the rendered web page, receives messages for
|
||||
// it and contains page plugins. The host view should be sized to the current
|
||||
// size of the WebContents.
|
||||
- //
|
||||
- // |is_guest_view_hack| is temporary hack and will be removed once
|
||||
- // RenderWidgetHostViewGuest is not dependent on platform view.
|
||||
- // TODO(lazyboy): Remove |is_guest_view_hack| once http://crbug.com/330264 is
|
||||
- // fixed.
|
||||
virtual RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
- RenderWidgetHost* render_widget_host, bool is_guest_view_hack) = 0;
|
||||
+ RenderWidgetHost* render_widget_host,
|
||||
+ RenderWidgetHost* embedder_render_widget_host) = 0;
|
||||
|
||||
+#include "content/browser/web_contents/web_contents_view_guest.h"
|
||||
+
|
||||
namespace content {
|
||||
|
||||
bool BrowserPluginGuestDelegate::CanRunInDetachedState() const {
|
||||
@@ -48,4 +50,23 @@ SiteInstance* BrowserPluginGuestDelegate::GetOwnerSiteInstance() {
|
||||
return nullptr;
|
||||
// Creates a new View that holds a popup and receives messages for it.
|
||||
virtual RenderWidgetHostViewBase* CreateViewForPopupWidget(
|
||||
diff --git content/browser/web_contents/web_contents_view_aura.cc content/browser/web_contents/web_contents_view_aura.cc
|
||||
index 7ac4946..2a06e81 100644
|
||||
--- content/browser/web_contents/web_contents_view_aura.cc
|
||||
+++ content/browser/web_contents/web_contents_view_aura.cc
|
||||
@@ -817,7 +817,8 @@ void WebContentsViewAura::CreateView(
|
||||
}
|
||||
|
||||
+void BrowserPluginGuestDelegate::OnGuestAttached(
|
||||
+ content::WebContentsView* guest_view,
|
||||
+ content::WebContentsView* parent_view) {
|
||||
+ static_cast<WebContentsViewGuest*>(guest_view)->OnGuestAttached(parent_view);
|
||||
+}
|
||||
RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
|
||||
- RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
|
||||
+ RenderWidgetHost* render_widget_host,
|
||||
+ RenderWidgetHost* embedder_render_widget_host) {
|
||||
if (render_widget_host->GetView()) {
|
||||
// During testing, the view will already be set up in most cases to the
|
||||
// test view, so we don't want to clobber it with a real one. To verify that
|
||||
@@ -830,7 +831,8 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
|
||||
}
|
||||
|
||||
RenderWidgetHostViewAura* view =
|
||||
- new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack);
|
||||
+ new RenderWidgetHostViewAura(render_widget_host,
|
||||
+ !!embedder_render_widget_host);
|
||||
view->InitAsChild(GetRenderWidgetHostViewParent());
|
||||
|
||||
RenderWidgetHostImpl* host_impl =
|
||||
diff --git content/browser/web_contents/web_contents_view_aura.h content/browser/web_contents/web_contents_view_aura.h
|
||||
index 2e7beab..a62b593 100644
|
||||
--- content/browser/web_contents/web_contents_view_aura.h
|
||||
+++ content/browser/web_contents/web_contents_view_aura.h
|
||||
@@ -110,7 +110,7 @@ class CONTENT_EXPORT WebContentsViewAura
|
||||
gfx::NativeView context) override;
|
||||
RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
RenderWidgetHost* render_widget_host,
|
||||
- bool is_guest_view_hack) override;
|
||||
+ RenderWidgetHost* embedder_render_widget_host) override;
|
||||
RenderWidgetHostViewBase* CreateViewForPopupWidget(
|
||||
RenderWidgetHost* render_widget_host) override;
|
||||
void SetPageTitle(const base::string16& title) override;
|
||||
diff --git content/browser/web_contents/web_contents_view_child_frame.cc content/browser/web_contents/web_contents_view_child_frame.cc
|
||||
index 9b17012..b4fb5ab 100644
|
||||
--- content/browser/web_contents/web_contents_view_child_frame.cc
|
||||
+++ content/browser/web_contents/web_contents_view_child_frame.cc
|
||||
@@ -86,7 +86,7 @@ void WebContentsViewChildFrame::CreateView(const gfx::Size& initial_size,
|
||||
|
||||
RenderWidgetHostViewBase* WebContentsViewChildFrame::CreateViewForWidget(
|
||||
RenderWidgetHost* render_widget_host,
|
||||
- bool is_guest_view_hack) {
|
||||
+ RenderWidgetHost* embedder_render_widget_host) {
|
||||
return RenderWidgetHostViewChildFrame::Create(render_widget_host);
|
||||
}
|
||||
|
||||
diff --git content/browser/web_contents/web_contents_view_child_frame.h content/browser/web_contents/web_contents_view_child_frame.h
|
||||
index c83f2f0..a19b931 100644
|
||||
--- content/browser/web_contents/web_contents_view_child_frame.h
|
||||
+++ content/browser/web_contents/web_contents_view_child_frame.h
|
||||
@@ -40,7 +40,7 @@ class WebContentsViewChildFrame : public WebContentsView,
|
||||
gfx::NativeView context) override;
|
||||
RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
RenderWidgetHost* render_widget_host,
|
||||
- bool is_guest_view_hack) override;
|
||||
+ RenderWidgetHost* embedder_render_widget_host) override;
|
||||
RenderWidgetHostViewBase* CreateViewForPopupWidget(
|
||||
RenderWidgetHost* render_widget_host) override;
|
||||
void SetPageTitle(const base::string16& title) override;
|
||||
diff --git content/browser/web_contents/web_contents_view_guest.cc content/browser/web_contents/web_contents_view_guest.cc
|
||||
index b2b86fa..00c9126 100644
|
||||
--- content/browser/web_contents/web_contents_view_guest.cc
|
||||
+++ content/browser/web_contents/web_contents_view_guest.cc
|
||||
@@ -72,6 +72,8 @@ void WebContentsViewGuest::GetScreenInfo(ScreenInfo* screen_info) const {
|
||||
|
||||
void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) {
|
||||
#if defined(USE_AURA)
|
||||
+ if (!platform_view_->GetNativeView())
|
||||
+ return;
|
||||
// In aura, ScreenPositionClient doesn't work properly if we do
|
||||
// not have the native view associated with this WebContentsViewGuest in the
|
||||
// view hierarchy. We add this view as embedder's child here.
|
||||
@@ -83,6 +85,8 @@ void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) {
|
||||
|
||||
void WebContentsViewGuest::OnGuestDetached(WebContentsView* old_parent_view) {
|
||||
#if defined(USE_AURA)
|
||||
+ if (!platform_view_->GetNativeView())
|
||||
+ return;
|
||||
old_parent_view->GetNativeView()->RemoveChild(
|
||||
platform_view_->GetNativeView());
|
||||
#endif // defined(USE_AURA)
|
||||
@@ -133,7 +137,8 @@ void WebContentsViewGuest::CreateView(const gfx::Size& initial_size,
|
||||
}
|
||||
|
||||
RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget(
|
||||
- RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
|
||||
+ RenderWidgetHost* render_widget_host,
|
||||
+ RenderWidgetHost* embedder_render_widget_host) {
|
||||
if (render_widget_host->GetView()) {
|
||||
// During testing, the view will already be set up in most cases to the
|
||||
// test view, so we don't want to clobber it with a real one. To verify that
|
||||
@@ -145,11 +150,19 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget(
|
||||
render_widget_host->GetView());
|
||||
}
|
||||
|
||||
+ embedder_render_widget_host =
|
||||
+ guest_->embedder_web_contents()->GetRenderViewHost()->GetWidget();
|
||||
RenderWidgetHostViewBase* platform_widget =
|
||||
- platform_view_->CreateViewForWidget(render_widget_host, true);
|
||||
+ platform_view_->CreateViewForWidget(render_widget_host,
|
||||
+ embedder_render_widget_host);
|
||||
|
||||
- return RenderWidgetHostViewGuest::Create(render_widget_host, guest_,
|
||||
- platform_widget->GetWeakPtr());
|
||||
+ RenderWidgetHostViewGuest* guest_view =
|
||||
+ RenderWidgetHostViewGuest::Create(render_widget_host, guest_,
|
||||
+ platform_widget->GetWeakPtr());
|
||||
+ platform_widget->InitAsGuest(embedder_render_widget_host->GetView(),
|
||||
+ guest_view);
|
||||
+
|
||||
+void BrowserPluginGuestDelegate::OnGuestDetached(
|
||||
+ content::WebContentsView* guest_view,
|
||||
+ content::WebContentsView* parent_view) {
|
||||
+ static_cast<WebContentsViewGuest*>(guest_view)->OnGuestAttached(parent_view);
|
||||
+}
|
||||
+
|
||||
+void BrowserPluginGuestDelegate::CreateViewForWidget(
|
||||
+ content::WebContentsView* guest_view,
|
||||
+ content::RenderWidgetHost* render_widget_host) {
|
||||
+ static_cast<WebContentsViewGuest*>(guest_view)->CreateViewForWidget(
|
||||
+ render_widget_host, true);
|
||||
+}
|
||||
+
|
||||
} // namespace content
|
||||
diff --git public/browser/browser_plugin_guest_delegate.h public/browser/browser_plugin_guest_delegate.h
|
||||
index a32205c..1d93d7b 100644
|
||||
--- public/browser/browser_plugin_guest_delegate.h
|
||||
+++ public/browser/browser_plugin_guest_delegate.h
|
||||
+ return guest_view;
|
||||
}
|
||||
|
||||
RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForPopupWidget(
|
||||
diff --git content/browser/web_contents/web_contents_view_guest.h content/browser/web_contents/web_contents_view_guest.h
|
||||
index 0102d7e..b89d66c 100644
|
||||
--- content/browser/web_contents/web_contents_view_guest.h
|
||||
+++ content/browser/web_contents/web_contents_view_guest.h
|
||||
@@ -58,7 +58,7 @@ class WebContentsViewGuest : public WebContentsView,
|
||||
gfx::NativeView context) override;
|
||||
RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
RenderWidgetHost* render_widget_host,
|
||||
- bool is_guest_view_hack) override;
|
||||
+ RenderWidgetHost* embedder_render_widget_host) override;
|
||||
RenderWidgetHostViewBase* CreateViewForPopupWidget(
|
||||
RenderWidgetHost* render_widget_host) override;
|
||||
void SetPageTitle(const base::string16& title) override;
|
||||
diff --git content/browser/web_contents/web_contents_view_mac.h content/browser/web_contents/web_contents_view_mac.h
|
||||
index 3b34cbd..a22e22e 100644
|
||||
--- content/browser/web_contents/web_contents_view_mac.h
|
||||
+++ content/browser/web_contents/web_contents_view_mac.h
|
||||
@@ -89,7 +89,7 @@ class WebContentsViewMac : public WebContentsView,
|
||||
gfx::NativeView context) override;
|
||||
RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
RenderWidgetHost* render_widget_host,
|
||||
- bool is_guest_view_hack) override;
|
||||
+ RenderWidgetHost* embedder_render_widget_host) override;
|
||||
RenderWidgetHostViewBase* CreateViewForPopupWidget(
|
||||
RenderWidgetHost* render_widget_host) override;
|
||||
void SetPageTitle(const base::string16& title) override;
|
||||
diff --git content/browser/web_contents/web_contents_view_mac.mm content/browser/web_contents/web_contents_view_mac.mm
|
||||
index ea529e5..4dc4f6c 100644
|
||||
--- content/browser/web_contents/web_contents_view_mac.mm
|
||||
+++ content/browser/web_contents/web_contents_view_mac.mm
|
||||
@@ -341,7 +341,8 @@ void WebContentsViewMac::CreateView(
|
||||
}
|
||||
|
||||
RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget(
|
||||
- RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
|
||||
+ RenderWidgetHost* render_widget_host,
|
||||
+ RenderWidgetHost* embedder_render_widget_host) {
|
||||
if (render_widget_host->GetView()) {
|
||||
// During testing, the view will already be set up in most cases to the
|
||||
// test view, so we don't want to clobber it with a real one. To verify that
|
||||
@@ -354,7 +355,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget(
|
||||
}
|
||||
|
||||
RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(
|
||||
- render_widget_host, is_guest_view_hack);
|
||||
+ render_widget_host, !!embedder_render_widget_host);
|
||||
if (delegate()) {
|
||||
base::scoped_nsobject<NSObject<RenderWidgetHostViewMacDelegate> >
|
||||
rw_delegate(
|
||||
diff --git content/browser/web_contents/web_contents_view_mus.cc content/browser/web_contents/web_contents_view_mus.cc
|
||||
index 959a27f..19a48df 100644
|
||||
--- content/browser/web_contents/web_contents_view_mus.cc
|
||||
+++ content/browser/web_contents/web_contents_view_mus.cc
|
||||
@@ -128,7 +128,7 @@ void WebContentsViewMus::CreateView(const gfx::Size& initial_size,
|
||||
|
||||
RenderWidgetHostViewBase* WebContentsViewMus::CreateViewForWidget(
|
||||
RenderWidgetHost* render_widget_host,
|
||||
- bool is_guest_view_hack) {
|
||||
+ RenderWidgetHost* embedder_render_widget_host) {
|
||||
RenderWidgetHostViewBase* view = new RenderWidgetHostViewMus(
|
||||
mus_window_->window(), RenderWidgetHostImpl::From(render_widget_host));
|
||||
view->InitAsChild(GetNativeView());
|
||||
diff --git content/browser/web_contents/web_contents_view_mus.h content/browser/web_contents/web_contents_view_mus.h
|
||||
index f47f8e3b..95709c1 100644
|
||||
--- content/browser/web_contents/web_contents_view_mus.h
|
||||
+++ content/browser/web_contents/web_contents_view_mus.h
|
||||
@@ -60,7 +60,7 @@ class WebContentsViewMus : public WebContentsView,
|
||||
gfx::NativeView context) override;
|
||||
RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
RenderWidgetHost* render_widget_host,
|
||||
- bool is_guest_view_hack) override;
|
||||
+ RenderWidgetHost* embedder_render_widget_host) override;
|
||||
RenderWidgetHostViewBase* CreateViewForPopupWidget(
|
||||
RenderWidgetHost* render_widget_host) override;
|
||||
void SetPageTitle(const base::string16& title) override;
|
||||
diff --git content/public/browser/browser_plugin_guest_delegate.h content/public/browser/browser_plugin_guest_delegate.h
|
||||
index a32205c..49f3c35 100644
|
||||
--- content/public/browser/browser_plugin_guest_delegate.h
|
||||
+++ content/public/browser/browser_plugin_guest_delegate.h
|
||||
@@ -19,6 +19,7 @@ namespace content {
|
||||
class GuestHost;
|
||||
class RenderWidgetHost;
|
||||
@@ -100,21 +273,91 @@ index a32205c..1d93d7b 100644
|
||||
|
||||
// Objects implement this interface to get notified about changes in the guest
|
||||
// WebContents and to provide necessary functionality.
|
||||
@@ -85,6 +86,17 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
|
||||
@@ -85,6 +86,10 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
|
||||
// content module.
|
||||
virtual void SetGuestHost(GuestHost* guest_host) {}
|
||||
|
||||
+ // Called when a guest is attached or detached.
|
||||
+ virtual void OnGuestAttached(content::WebContentsView* guest_view,
|
||||
+ content::WebContentsView* parent_view);
|
||||
+ virtual void OnGuestDetached(content::WebContentsView* guest_view,
|
||||
+ content::WebContentsView* parent_view);
|
||||
+
|
||||
+ // Called to create the view for the widget.
|
||||
+ virtual void CreateViewForWidget(
|
||||
+ content::WebContentsView* guest_view,
|
||||
+ content::RenderWidgetHost* render_widget_host);
|
||||
+ virtual void OnGuestAttached(content::WebContentsView* parent_view) {}
|
||||
+ virtual void OnGuestDetached(content::WebContentsView* parent_view) {}
|
||||
+
|
||||
// Sets the position of the context menu for the guest contents. The value
|
||||
// reported from the guest renderer should be ignored. The reported value
|
||||
// from the guest renderer is incorrect in situations where BrowserPlugin is
|
||||
diff --git extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
|
||||
index 049af16..0b63d7b 100644
|
||||
--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
|
||||
+++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
|
||||
@@ -179,6 +179,8 @@ void MimeHandlerViewGuest::CreateWebContents(
|
||||
WebContents::CreateParams params(browser_context(),
|
||||
guest_site_instance.get());
|
||||
params.guest_delegate = this;
|
||||
+ if (delegate_)
|
||||
+ delegate_->OverrideWebContentsCreateParams(¶ms);
|
||||
callback.Run(WebContents::Create(params));
|
||||
}
|
||||
|
||||
@@ -203,6 +205,18 @@ bool MimeHandlerViewGuest::ZoomPropagatesFromEmbedderToGuest() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
+void MimeHandlerViewGuest::OnGuestAttached(
|
||||
+ content::WebContentsView* parent_view) {
|
||||
+ if (delegate_)
|
||||
+ delegate_->OnGuestAttached(parent_view);
|
||||
+}
|
||||
+
|
||||
+void MimeHandlerViewGuest::OnGuestDetached(
|
||||
+ content::WebContentsView* parent_view) {
|
||||
+ if (delegate_)
|
||||
+ delegate_->OnGuestDetached(parent_view);
|
||||
+}
|
||||
+
|
||||
WebContents* MimeHandlerViewGuest::OpenURLFromTab(
|
||||
WebContents* source,
|
||||
const content::OpenURLParams& params) {
|
||||
diff --git extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
|
||||
index d237318..3701bd2 100644
|
||||
--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
|
||||
+++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
|
||||
@@ -83,6 +83,10 @@ class MimeHandlerViewGuest :
|
||||
bool ShouldHandleFindRequestsForEmbedder() const final;
|
||||
bool ZoomPropagatesFromEmbedderToGuest() const final;
|
||||
|
||||
+ // content::BrowserPluginGuestDelegate implementation
|
||||
+ void OnGuestAttached(content::WebContentsView* parent_view) override;
|
||||
+ void OnGuestDetached(content::WebContentsView* parent_view) override;
|
||||
+
|
||||
// WebContentsDelegate implementation.
|
||||
content::WebContents* OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
diff --git extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h
|
||||
index e065104d..ea3f547 100644
|
||||
--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h
|
||||
+++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h
|
||||
@@ -6,9 +6,9 @@
|
||||
#define EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_DELEGATE_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
+#include "content/public/browser/web_contents.h"
|
||||
|
||||
namespace content {
|
||||
-class WebContents;
|
||||
struct ContextMenuParams;
|
||||
} // namespace content
|
||||
|
||||
@@ -21,6 +21,14 @@ class MimeHandlerViewGuestDelegate {
|
||||
public:
|
||||
MimeHandlerViewGuestDelegate() {}
|
||||
virtual ~MimeHandlerViewGuestDelegate() {}
|
||||
+
|
||||
+ // Provides an opportunity to supply a custom view implementation.
|
||||
+ virtual void OverrideWebContentsCreateParams(
|
||||
+ content::WebContents::CreateParams* params) {}
|
||||
+
|
||||
+ // Called when a guest is attached or detached.
|
||||
+ virtual void OnGuestAttached(content::WebContentsView* parent_view) {}
|
||||
+ virtual void OnGuestDetached(content::WebContentsView* parent_view) {}
|
||||
|
||||
// Handles context menu, or returns false if unhandled.
|
||||
virtual bool HandleContextMenu(content::WebContents* web_contents,
|
||||
|
@@ -26,10 +26,18 @@ index 6408c68..735a253 100644
|
||||
return renderer_frame_number_;
|
||||
}
|
||||
diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h
|
||||
index 88e7a04..0e6a740 100644
|
||||
index 88e7a04..483a3d4 100644
|
||||
--- content/browser/renderer_host/render_widget_host_view_base.h
|
||||
+++ content/browser/renderer_host/render_widget_host_view_base.h
|
||||
@@ -107,6 +107,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
@@ -67,6 +67,7 @@ class BrowserAccessibilityDelegate;
|
||||
class BrowserAccessibilityManager;
|
||||
class RenderWidgetHostImpl;
|
||||
class RenderWidgetHostViewBaseObserver;
|
||||
+class RenderWidgetHostViewGuest;
|
||||
class SyntheticGesture;
|
||||
class SyntheticGestureTarget;
|
||||
class TextInputManager;
|
||||
@@ -107,6 +108,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
void EndFrameSubscription() override;
|
||||
void FocusedNodeTouched(const gfx::Point& location_dips_screen,
|
||||
bool editable) override;
|
||||
@@ -38,7 +46,20 @@ index 88e7a04..0e6a740 100644
|
||||
|
||||
// This only needs to be overridden by RenderWidgetHostViewBase subclasses
|
||||
// that handle content embedded within other RenderWidgetHostViews.
|
||||
@@ -488,6 +490,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
@@ -327,6 +330,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
// helps to position the full screen widget on the correct monitor.
|
||||
virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0;
|
||||
|
||||
+ // Perform all the initialization steps necessary for this object to represent
|
||||
+ // the platform widget owned by |guest_view| and embedded in
|
||||
+ // |parent_host_view|.
|
||||
+ virtual void InitAsGuest(RenderWidgetHostView* parent_host_view,
|
||||
+ RenderWidgetHostViewGuest* guest_view) {}
|
||||
+
|
||||
// Sets the cursor to the one associated with the specified cursor_type
|
||||
virtual void UpdateCursor(const WebCursor& cursor) = 0;
|
||||
|
||||
@@ -488,6 +497,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
// destroyed before the RWHV is destroyed.
|
||||
TextInputManager* text_input_manager_;
|
||||
|
||||
@@ -171,7 +192,7 @@ index c1ee992..6591ddf 100644
|
||||
// a reference.
|
||||
corewm::TooltipWin* tooltip_;
|
||||
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
||||
index 8550a32..9cdd035 100644
|
||||
index 8550a32..8120781 100644
|
||||
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
||||
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
||||
@@ -195,6 +195,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
||||
@@ -190,7 +211,16 @@ index 8550a32..9cdd035 100644
|
||||
close_widget_factory_(this),
|
||||
weak_factory_(this) {}
|
||||
|
||||
@@ -545,7 +547,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
|
||||
@@ -243,6 +245,8 @@ std::vector<aura::Window*> DesktopWindowTreeHostX11::GetAllOpenWindows() {
|
||||
}
|
||||
|
||||
gfx::Rect DesktopWindowTreeHostX11::GetX11RootWindowBounds() const {
|
||||
+ if (!screen_bounds_.IsEmpty())
|
||||
+ return screen_bounds_;
|
||||
return bounds_in_pixels_;
|
||||
}
|
||||
|
||||
@@ -545,7 +549,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
|
||||
// Actually free our native resources.
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
||||
@@ -200,7 +230,7 @@ index 8550a32..9cdd035 100644
|
||||
xwindow_ = None;
|
||||
|
||||
desktop_native_widget_aura_->OnHostClosed();
|
||||
@@ -686,6 +689,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
|
||||
@@ -686,6 +691,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
|
||||
}
|
||||
|
||||
gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const {
|
||||
@@ -209,15 +239,6 @@ index 8550a32..9cdd035 100644
|
||||
return ToDIPRect(bounds_in_pixels_);
|
||||
}
|
||||
|
||||
@@ -1202,6 +1207,8 @@ void DesktopWindowTreeHostX11::HideImpl() {
|
||||
}
|
||||
|
||||
gfx::Rect DesktopWindowTreeHostX11::GetBounds() const {
|
||||
+ if (!screen_bounds_.IsEmpty())
|
||||
+ return screen_bounds_;
|
||||
return bounds_in_pixels_;
|
||||
}
|
||||
|
||||
@@ -1261,6 +1268,8 @@ void DesktopWindowTreeHostX11::SetBounds(
|
||||
}
|
||||
|
127
patch/patches/web_contents_1257_1565.patch
Normal file
127
patch/patches/web_contents_1257_1565.patch
Normal file
@@ -0,0 +1,127 @@
|
||||
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
|
||||
index 5740537..c826ad9 100644
|
||||
--- content/browser/web_contents/web_contents_impl.cc
|
||||
+++ content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -1578,6 +1578,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
std::string unique_name;
|
||||
frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
|
||||
|
||||
+ if (params.view && params.delegate_view) {
|
||||
+ view_.reset(params.view);
|
||||
+ render_view_host_delegate_view_ = params.delegate_view;
|
||||
+ }
|
||||
+
|
||||
+ if (!view_) {
|
||||
WebContentsViewDelegate* delegate =
|
||||
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
|
||||
|
||||
@@ -1602,6 +1608,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
&render_view_host_delegate_view_));
|
||||
}
|
||||
}
|
||||
+ }
|
||||
|
||||
if (browser_plugin_guest_ && !GuestMode::IsCrossProcessFrameGuest(this)) {
|
||||
view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(),
|
||||
@@ -2107,6 +2114,12 @@ void WebContentsImpl::CreateNewWindow(
|
||||
create_params.renderer_initiated_creation =
|
||||
main_frame_route_id != MSG_ROUTING_NONE;
|
||||
|
||||
+ if (delegate_) {
|
||||
+ delegate_->GetCustomWebContentsView(this, params.target_url,
|
||||
+ &create_params.view,
|
||||
+ &create_params.delegate_view);
|
||||
+ }
|
||||
+
|
||||
WebContentsImpl* new_contents = NULL;
|
||||
if (!is_guest) {
|
||||
create_params.context = view_->GetNativeView();
|
||||
@@ -2136,7 +2149,7 @@ void WebContentsImpl::CreateNewWindow(
|
||||
// TODO(brettw): It seems bogus that we have to call this function on the
|
||||
// newly created object and give it one of its own member variables.
|
||||
new_view->CreateViewForWidget(
|
||||
- new_contents->GetRenderViewHost()->GetWidget(), false);
|
||||
+ new_contents->GetRenderViewHost()->GetWidget(), nullptr);
|
||||
}
|
||||
// Save the created window associated with the route so we can show it
|
||||
// later.
|
||||
@@ -4937,7 +4950,7 @@ NavigationEntry*
|
||||
void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(
|
||||
RenderViewHost* render_view_host) {
|
||||
RenderWidgetHostViewBase* rwh_view =
|
||||
- view_->CreateViewForWidget(render_view_host->GetWidget(), false);
|
||||
+ view_->CreateViewForWidget(render_view_host->GetWidget(), nullptr);
|
||||
|
||||
// Now that the RenderView has been created, we need to tell it its size.
|
||||
if (rwh_view)
|
||||
diff --git content/public/browser/web_contents.cc content/public/browser/web_contents.cc
|
||||
index fa0afb5..d677b31 100644
|
||||
--- content/public/browser/web_contents.cc
|
||||
+++ content/public/browser/web_contents.cc
|
||||
@@ -29,7 +29,9 @@ WebContents::CreateParams::CreateParams(BrowserContext* context,
|
||||
guest_delegate(nullptr),
|
||||
context(nullptr),
|
||||
renderer_initiated_creation(false),
|
||||
- initialize_renderer(false) {
|
||||
+ initialize_renderer(false),
|
||||
+ view(nullptr),
|
||||
+ delegate_view(nullptr) {
|
||||
}
|
||||
|
||||
WebContents::CreateParams::CreateParams(const CreateParams& other) = default;
|
||||
diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h
|
||||
index af944f7..cde1d7b 100644
|
||||
--- content/public/browser/web_contents.h
|
||||
+++ content/public/browser/web_contents.h
|
||||
@@ -59,9 +59,11 @@ class PageState;
|
||||
class RenderFrameHost;
|
||||
class RenderProcessHost;
|
||||
class RenderViewHost;
|
||||
+class RenderViewHostDelegateView;
|
||||
class RenderWidgetHost;
|
||||
class RenderWidgetHostView;
|
||||
class WebContentsDelegate;
|
||||
+class WebContentsView;
|
||||
struct CustomContextMenuContext;
|
||||
struct DropData;
|
||||
struct Manifest;
|
||||
@@ -162,6 +164,10 @@ class WebContents : public PageNavigator,
|
||||
// Note that the pre-created renderer process may not be used if the first
|
||||
// navigation requires a dedicated or privileged process, such as a WebUI.
|
||||
bool initialize_renderer;
|
||||
+
|
||||
+ // Optionally specify the view and delegate view.
|
||||
+ content::WebContentsView* view;
|
||||
+ content::RenderViewHostDelegateView* delegate_view;
|
||||
};
|
||||
|
||||
// Creates a new WebContents.
|
||||
diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h
|
||||
index 2beb83c..28df8ee 100644
|
||||
--- content/public/browser/web_contents_delegate.h
|
||||
+++ content/public/browser/web_contents_delegate.h
|
||||
@@ -42,9 +42,11 @@ class ColorChooser;
|
||||
class JavaScriptDialogManager;
|
||||
class PageState;
|
||||
class RenderFrameHost;
|
||||
+class RenderViewHostDelegateView;
|
||||
class SessionStorageNamespace;
|
||||
class WebContents;
|
||||
class WebContentsImpl;
|
||||
+class WebContentsView;
|
||||
struct ColorSuggestion;
|
||||
struct ContextMenuParams;
|
||||
struct DropData;
|
||||
@@ -305,6 +307,12 @@ class CONTENT_EXPORT WebContentsDelegate {
|
||||
const std::string& partition_id,
|
||||
SessionStorageNamespace* session_storage_namespace);
|
||||
|
||||
+ virtual void GetCustomWebContentsView(
|
||||
+ WebContents* web_contents,
|
||||
+ const GURL& target_url,
|
||||
+ content::WebContentsView** view,
|
||||
+ content::RenderViewHostDelegateView** delegate_view) {}
|
||||
+
|
||||
// Notifies the delegate about the creation of a new WebContents. This
|
||||
// typically happens when popups are created.
|
||||
virtual void WebContentsCreated(WebContents* source_contents,
|
Reference in New Issue
Block a user