summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_delegate_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r--src/core/web_contents_delegate_qt.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 2de8fd64a..fe1f6fee0 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -44,6 +44,7 @@
#include "web_contents_delegate_qt.h"
#include "browser_context_adapter.h"
+#include "browser_context_qt.h"
#include "color_chooser_qt.h"
#include "color_chooser_controller.h"
#include "favicon_manager.h"
@@ -115,19 +116,25 @@ WebContentsDelegateQt::~WebContentsDelegateQt()
content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents *source, const content::OpenURLParams &params)
{
content::WebContents *target = source;
+ content::SiteInstance *target_site_instance = params.source_site_instance.get();
+ content::Referrer referrer = params.referrer;
if (params.disposition != WindowOpenDisposition::CURRENT_TAB) {
QSharedPointer<WebContentsAdapter> targetAdapter = createWindow(0, params.disposition, gfx::Rect(), params.user_gesture);
if (targetAdapter) {
+ if (targetAdapter->browserContext() != source->GetBrowserContext()) {
+ target_site_instance = nullptr;
+ referrer = content::Referrer();
+ }
if (!targetAdapter->isInitialized())
- targetAdapter->initialize(params.source_site_instance.get());
+ targetAdapter->initialize(target_site_instance);
target = targetAdapter->webContents();
}
}
Q_ASSERT(target);
content::NavigationController::LoadURLParams load_url_params(params.url);
- load_url_params.source_site_instance = params.source_site_instance;
- load_url_params.referrer = params.referrer;
+ load_url_params.source_site_instance = target_site_instance;
+ load_url_params.referrer = referrer;
load_url_params.frame_tree_node_id = params.frame_tree_node_id;
load_url_params.redirect_chain = params.redirect_chain;
load_url_params.transition_type = params.transition;
@@ -519,6 +526,17 @@ void WebContentsDelegateQt::ActivateContents(content::WebContents* contents)
contents->Focus();
}
+void WebContentsDelegateQt::RenderViewHostChanged(content::RenderViewHost *old_host, content::RenderViewHost *new_host)
+{
+ Q_ASSERT(new_host);
+
+ // The old RVH can be nullptr if it was shut down.
+ if (!old_host)
+ return;
+
+ new_host->UpdateWebkitPreferences(old_host->GetWebkitPreferences());
+}
+
void WebContentsDelegateQt::RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target)
{
Q_UNUSED(user_gesture);