90 lines
3.9 KiB
Diff
90 lines
3.9 KiB
Diff
diff --git web_contents_impl.cc web_contents_impl.cc
|
|
index 233c1e0..e95858d 100644
|
|
--- web_contents_impl.cc
|
|
+++ web_contents_impl.cc
|
|
@@ -1387,32 +1387,40 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
|
main_frame_widget_routing_id);
|
|
frame_tree_.root()->SetFrameName(params.main_frame_name);
|
|
|
|
- WebContentsViewDelegate* delegate =
|
|
- GetContentClient()->browser()->GetWebContentsViewDelegate(this);
|
|
+ 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);
|
|
|
|
#if defined(MOJO_SHELL_CLIENT)
|
|
- if (MojoShellConnection::Get() &&
|
|
- base::CommandLine::ForCurrentProcess()->HasSwitch(
|
|
- switches::kUseMusInRenderer)) {
|
|
- mus::Window* mus_window = aura::GetMusWindow(params.context);
|
|
- if (mus_window) {
|
|
- view_.reset(new WebContentsViewMus(mus_window, this, delegate,
|
|
- &render_view_host_delegate_view_));
|
|
+ if (MojoShellConnection::Get() &&
|
|
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
|
|
+ switches::kUseMusInRenderer)) {
|
|
+ mus::Window* mus_window = aura::GetMusWindow(params.context);
|
|
+ if (mus_window) {
|
|
+ view_.reset(new WebContentsViewMus(mus_window, this, delegate,
|
|
+ &render_view_host_delegate_view_));
|
|
+ }
|
|
}
|
|
- }
|
|
#endif
|
|
|
|
- if (!view_) {
|
|
- view_.reset(CreateWebContentsView(this, delegate,
|
|
- &render_view_host_delegate_view_));
|
|
- }
|
|
+ if (!view_) {
|
|
+ view_.reset(CreateWebContentsView(this, delegate,
|
|
+ &render_view_host_delegate_view_));
|
|
+ }
|
|
|
|
- if (browser_plugin_guest_ &&
|
|
- !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
|
|
- view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(),
|
|
- std::move(view_),
|
|
- &render_view_host_delegate_view_));
|
|
+ if (browser_plugin_guest_ &&
|
|
+ !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
|
|
+ view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(),
|
|
+ std::move(view_),
|
|
+ &render_view_host_delegate_view_));
|
|
+ }
|
|
}
|
|
+
|
|
CHECK(render_view_host_delegate_view_);
|
|
CHECK(view_.get());
|
|
|
|
@@ -1834,11 +1842,14 @@ void WebContentsImpl::CreateNewWindow(
|
|
static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace);
|
|
CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context));
|
|
|
|
+ content::WebContentsView* view = NULL;
|
|
+ content::RenderViewHostDelegateView* delegate_view = NULL;
|
|
+
|
|
if (delegate_ &&
|
|
!delegate_->ShouldCreateWebContents(
|
|
this, route_id, main_frame_route_id, main_frame_widget_route_id,
|
|
params.window_container_type, params.frame_name, params.target_url,
|
|
- partition_id, session_storage_namespace)) {
|
|
+ partition_id, session_storage_namespace, &view, &delegate_view)) {
|
|
if (route_id != MSG_ROUTING_NONE &&
|
|
!RenderViewHost::FromID(render_process_id, route_id)) {
|
|
// If the embedder didn't create a WebContents for this route, we need to
|
|
@@ -1859,6 +1870,8 @@ void WebContentsImpl::CreateNewWindow(
|
|
create_params.opener_render_process_id = render_process_id;
|
|
create_params.opener_render_frame_id = params.opener_render_frame_id;
|
|
create_params.opener_suppressed = params.opener_suppressed;
|
|
+ create_params.view = view;
|
|
+ create_params.delegate_view = delegate_view;
|
|
if (params.disposition == NEW_BACKGROUND_TAB)
|
|
create_params.initially_hidden = true;
|
|
create_params.renderer_initiated_creation =
|