summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-04-15 16:38:36 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-15 21:55:08 +0200
commitd827b5d885355849c96c7c7d218d6e6b4eaec25b (patch)
tree30d56db68f45ac6e5ad710b238ce0159abf28e47 /src
parent57df94104a8c8fa524492811dc4a92db8cd1263a (diff)
Fix links not opening on Google+ and Gmail
We missed a very important overload of WebContentsDelegate used by window.open to navigate new pages. The logic is mostly taken from chromium/content/shell/browser/shell.cc. Change-Id: Ib359edb61c1ee6eab89e2ebdc2aad2d944fea712 Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/web_contents_delegate_qt.cpp24
-rw-r--r--src/core/web_contents_delegate_qt.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 8c5646ab5..6e19fd9ab 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -39,6 +39,10 @@
**
****************************************************************************/
+// Copyright 2013 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 "web_contents_delegate_qt.h"
#include "type_conversion.h"
@@ -72,6 +76,26 @@ WebContentsDelegateQt::WebContentsDelegateQt(content::WebContents *webContents,
Observe(webContents);
}
+content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents *source, const content::OpenURLParams &params)
+{
+ // We already carry the disposition to the application through AddNewContents.
+ Q_UNUSED(params.disposition);
+
+ content::NavigationController::LoadURLParams load_url_params(params.url);
+ load_url_params.referrer = params.referrer;
+ load_url_params.frame_tree_node_id = params.frame_tree_node_id;
+ load_url_params.transition_type = params.transition;
+ load_url_params.extra_headers = params.extra_headers;
+ load_url_params.should_replace_current_entry = params.should_replace_current_entry;
+ load_url_params.is_renderer_initiated = params.is_renderer_initiated;
+
+ if (params.transferred_global_request_id != content::GlobalRequestID())
+ load_url_params.transferred_global_request_id = params.transferred_global_request_id;
+
+ source->GetController().LoadURLWithParams(load_url_params);
+ return source;
+}
+
void WebContentsDelegateQt::NavigationStateChanged(const content::WebContents* source, unsigned changed_flags)
{
if (changed_flags & content::INVALIDATE_TYPE_URL)
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 1772190fd..fe36088eb 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -63,6 +63,7 @@ class WebContentsDelegateQt : public content::WebContentsDelegate
public:
WebContentsDelegateQt(content::WebContents*, WebContentsAdapterClient *adapterClient);
+ virtual content::WebContents *OpenURLFromTab(content::WebContents *source, const content::OpenURLParams &params) Q_DECL_OVERRIDE;
virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) Q_DECL_OVERRIDE;
virtual void AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) Q_DECL_OVERRIDE;
virtual void CloseContents(content::WebContents *source) Q_DECL_OVERRIDE;