2016-07-14 03:35:07 +02:00
|
|
|
diff --git chrome/browser/extensions/api/tab_capture/offscreen_tab.cc chrome/browser/extensions/api/tab_capture/offscreen_tab.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
index d7e2677..71436d2 100644
|
2016-07-14 03:35:07 +02:00
|
|
|
--- chrome/browser/extensions/api/tab_capture/offscreen_tab.cc
|
|
|
|
+++ chrome/browser/extensions/api/tab_capture/offscreen_tab.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -204,7 +204,9 @@ bool OffscreenTab::ShouldCreateWebContents(
|
2016-07-14 03:35:07 +02:00
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- content::SessionStorageNamespace* session_storage_namespace) {
|
|
|
|
+ content::SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) {
|
|
|
|
DCHECK_EQ(offscreen_tab_web_contents_.get(), contents);
|
|
|
|
// Disallow creating separate WebContentses. The WebContents implementation
|
|
|
|
// uses this to spawn new windows/tabs, which is also not allowed for
|
|
|
|
diff --git chrome/browser/extensions/api/tab_capture/offscreen_tab.h chrome/browser/extensions/api/tab_capture/offscreen_tab.h
|
|
|
|
index 712c117..4dc59be 100644
|
|
|
|
--- chrome/browser/extensions/api/tab_capture/offscreen_tab.h
|
|
|
|
+++ chrome/browser/extensions/api/tab_capture/offscreen_tab.h
|
|
|
|
@@ -149,7 +149,9 @@ class OffscreenTab : protected content::WebContentsDelegate,
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- content::SessionStorageNamespace* session_storage_namespace) final;
|
|
|
|
+ content::SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) final;
|
|
|
|
bool EmbedsFullscreenWidget() const final;
|
|
|
|
void EnterFullscreenModeForTab(content::WebContents* contents,
|
|
|
|
const GURL& origin) final;
|
|
|
|
diff --git chrome/browser/prerender/prerender_contents.cc chrome/browser/prerender/prerender_contents.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
index ff3f72d..6647f76 100644
|
2016-07-14 03:35:07 +02:00
|
|
|
--- chrome/browser/prerender/prerender_contents.cc
|
|
|
|
+++ chrome/browser/prerender/prerender_contents.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -131,7 +131,9 @@ class PrerenderContents::WebContentsDelegateImpl
|
2016-07-14 03:35:07 +02:00
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- SessionStorageNamespace* session_storage_namespace) override {
|
|
|
|
+ SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) override {
|
|
|
|
// Since we don't want to permit child windows that would have a
|
|
|
|
// window.opener property, terminate prerendering.
|
|
|
|
prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW);
|
|
|
|
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
index 93b36dc..b25c512 100644
|
2016-07-14 03:35:07 +02:00
|
|
|
--- chrome/browser/ui/browser.cc
|
|
|
|
+++ chrome/browser/ui/browser.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -1616,7 +1616,9 @@ bool Browser::ShouldCreateWebContents(
|
2016-07-14 03:35:07 +02:00
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- content::SessionStorageNamespace* session_storage_namespace) {
|
|
|
|
+ content::SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) {
|
|
|
|
if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
|
|
|
|
// If a BackgroundContents is created, suppress the normal WebContents.
|
|
|
|
return !MaybeCreateBackgroundContents(
|
|
|
|
diff --git chrome/browser/ui/browser.h chrome/browser/ui/browser.h
|
|
|
|
index 693e84d..be1f1dd 100644
|
|
|
|
--- chrome/browser/ui/browser.h
|
|
|
|
+++ chrome/browser/ui/browser.h
|
|
|
|
@@ -617,7 +617,9 @@ class Browser : public TabStripModelObserver,
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- content::SessionStorageNamespace* session_storage_namespace) override;
|
|
|
|
+ content::SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) override;
|
|
|
|
void WebContentsCreated(content::WebContents* source_contents,
|
|
|
|
int opener_render_frame_id,
|
|
|
|
const std::string& frame_name,
|
|
|
|
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
index 51f3bba..dead593 100644
|
2016-07-14 03:35:07 +02:00
|
|
|
--- content/browser/web_contents/web_contents_impl.cc
|
|
|
|
+++ content/browser/web_contents/web_contents_impl.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -1543,6 +1543,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
2016-07-14 03:35:07 +02:00
|
|
|
std::string unique_name = params.main_frame_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);
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -1575,6 +1581,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
2016-07-14 03:35:07 +02:00
|
|
|
std::move(view_),
|
|
|
|
&render_view_host_delegate_view_));
|
|
|
|
}
|
|
|
|
+ }
|
|
|
|
CHECK(render_view_host_delegate_view_);
|
|
|
|
CHECK(view_.get());
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -2028,11 +2035,14 @@ void WebContentsImpl::CreateNewWindow(
|
2016-07-14 03:35:07 +02:00
|
|
|
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
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -2056,6 +2066,8 @@ void WebContentsImpl::CreateNewWindow(
|
2016-07-14 03:35:07 +02:00
|
|
|
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 =
|
|
|
|
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
|
2016-08-31 13:25:56 +02:00
|
|
|
index efa8ae5..8ea0055 100644
|
2016-07-14 03:35:07 +02:00
|
|
|
--- content/public/browser/web_contents.h
|
|
|
|
+++ content/public/browser/web_contents.h
|
|
|
|
@@ -55,8 +55,10 @@ class PageState;
|
|
|
|
class RenderFrameHost;
|
|
|
|
class RenderProcessHost;
|
|
|
|
class RenderViewHost;
|
|
|
|
+class RenderViewHostDelegateView;
|
|
|
|
class RenderWidgetHostView;
|
|
|
|
class WebContentsDelegate;
|
|
|
|
+class WebContentsView;
|
|
|
|
struct CustomContextMenuContext;
|
|
|
|
struct DropData;
|
|
|
|
struct Manifest;
|
|
|
|
@@ -157,6 +159,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.cc content/public/browser/web_contents_delegate.cc
|
|
|
|
index df97348..8e2168e 100644
|
|
|
|
--- content/public/browser/web_contents_delegate.cc
|
|
|
|
+++ content/public/browser/web_contents_delegate.cc
|
|
|
|
@@ -144,7 +144,9 @@ bool WebContentsDelegate::ShouldCreateWebContents(
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- SessionStorageNamespace* session_storage_namespace) {
|
|
|
|
+ SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h
|
|
|
|
index 2816c4d..387821f 100644
|
|
|
|
--- content/public/browser/web_contents_delegate.h
|
|
|
|
+++ content/public/browser/web_contents_delegate.h
|
|
|
|
@@ -42,9 +42,11 @@ class JavaScriptDialogManager;
|
|
|
|
class PageState;
|
|
|
|
class RenderFrameHost;
|
|
|
|
class RenderViewHost;
|
|
|
|
+class RenderViewHostDelegateView;
|
|
|
|
class SessionStorageNamespace;
|
|
|
|
class WebContents;
|
|
|
|
class WebContentsImpl;
|
|
|
|
+class WebContentsView;
|
|
|
|
struct ColorSuggestion;
|
|
|
|
struct ContextMenuParams;
|
|
|
|
struct DropData;
|
|
|
|
@@ -307,7 +309,9 @@ class CONTENT_EXPORT WebContentsDelegate {
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- SessionStorageNamespace* session_storage_namespace);
|
|
|
|
+ SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view);
|
|
|
|
|
|
|
|
// Notifies the delegate about the creation of a new WebContents. This
|
|
|
|
// typically happens when popups are created.
|
|
|
|
diff --git extensions/browser/guest_view/extension_options/extension_options_guest.cc extensions/browser/guest_view/extension_options/extension_options_guest.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
index 6c9ff47..75b91bf 100644
|
2016-07-14 03:35:07 +02:00
|
|
|
--- extensions/browser/guest_view/extension_options/extension_options_guest.cc
|
|
|
|
+++ extensions/browser/guest_view/extension_options/extension_options_guest.cc
|
|
|
|
@@ -203,7 +203,9 @@ bool ExtensionOptionsGuest::ShouldCreateWebContents(
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- content::SessionStorageNamespace* session_storage_namespace) {
|
|
|
|
+ content::SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) {
|
|
|
|
// This method handles opening links from within the guest. Since this guest
|
|
|
|
// view is used for displaying embedded extension options, we want any
|
|
|
|
// external links to be opened in a new tab, not in a new guest view.
|
|
|
|
diff --git extensions/browser/guest_view/extension_options/extension_options_guest.h extensions/browser/guest_view/extension_options/extension_options_guest.h
|
|
|
|
index e0309f7..f6a3878 100644
|
|
|
|
--- extensions/browser/guest_view/extension_options/extension_options_guest.h
|
|
|
|
+++ extensions/browser/guest_view/extension_options/extension_options_guest.h
|
|
|
|
@@ -56,7 +56,9 @@ class ExtensionOptionsGuest
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- content::SessionStorageNamespace* session_storage_namespace) final;
|
|
|
|
+ content::SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) final;
|
|
|
|
|
|
|
|
// content::WebContentsObserver implementation.
|
|
|
|
void DidNavigateMainFrame(const content::LoadCommittedDetails& details,
|
|
|
|
diff --git ui/keyboard/content/keyboard_ui_content.cc ui/keyboard/content/keyboard_ui_content.cc
|
|
|
|
index cd6a2ab..ef2c820 100644
|
|
|
|
--- ui/keyboard/content/keyboard_ui_content.cc
|
|
|
|
+++ ui/keyboard/content/keyboard_ui_content.cc
|
|
|
|
@@ -64,7 +64,9 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate,
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- content::SessionStorageNamespace* session_storage_namespace) override {
|
|
|
|
+ content::SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) override {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git ui/views/controls/webview/web_dialog_view.cc ui/views/controls/webview/web_dialog_view.cc
|
|
|
|
index d8afe6e..59259b7 100644
|
|
|
|
--- ui/views/controls/webview/web_dialog_view.cc
|
|
|
|
+++ ui/views/controls/webview/web_dialog_view.cc
|
|
|
|
@@ -341,7 +341,9 @@ bool WebDialogView::ShouldCreateWebContents(
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- content::SessionStorageNamespace* session_storage_namespace) {
|
|
|
|
+ content::SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) {
|
|
|
|
if (delegate_)
|
|
|
|
return delegate_->HandleShouldCreateWebContents();
|
|
|
|
return true;
|
|
|
|
diff --git ui/views/controls/webview/web_dialog_view.h ui/views/controls/webview/web_dialog_view.h
|
|
|
|
index 65be6d54..7802d6d 100644
|
|
|
|
--- ui/views/controls/webview/web_dialog_view.h
|
|
|
|
+++ ui/views/controls/webview/web_dialog_view.h
|
|
|
|
@@ -123,7 +123,9 @@ class WEBVIEW_EXPORT WebDialogView : public views::ClientView,
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
const std::string& partition_id,
|
|
|
|
- content::SessionStorageNamespace* session_storage_namespace) override;
|
|
|
|
+ content::SessionStorageNamespace* session_storage_namespace,
|
|
|
|
+ content::WebContentsView** view,
|
|
|
|
+ content::RenderViewHostDelegateView** delegate_view) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
FRIEND_TEST_ALL_PREFIXES(WebDialogBrowserTest, WebContentRendered);
|