summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc31
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.h2
-rw-r--r--content/renderer/render_view.cc10
4 files changed, 30 insertions, 14 deletions
diff --git a/AUTHORS b/AUTHORS
index d64f236..1ea1518 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -101,3 +101,4 @@ Dillon Sellars <dill.sellars@gmail.com>
Seshadri Mahalingam <seshadri.mahalingam@gmail.com>
Clement Scheelfeldt Skau <clementskau@gmail.com>
David Futcher <bobbo@ubuntu.com>
+Ramkumar Gokarnesan <ramgo@yahoo-inc.com>
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index dcf613e..757d513 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -58,13 +58,14 @@
#include "net/url_request/url_request.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/favicon_size.h"
#include "webkit/glue/webmenuitem.h"
using WebKit::WebContextMenuData;
using WebKit::WebMediaPlayerAction;
+using WebKit::WebURL;
+using WebKit::WebString;
namespace {
@@ -1197,19 +1198,24 @@ void RenderViewContextMenu::ExecuteCommand(int id) {
switch (id) {
case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB:
- OpenURL(params_.link_url,
- source_tab_contents_->delegate() &&
+ OpenURL(
+ params_.link_url,
+ params_.frame_url.is_empty() ? params_.page_url : params_.frame_url,
+ source_tab_contents_->delegate() &&
source_tab_contents_->delegate()->IsApplication() ?
NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB,
- PageTransition::LINK);
+ PageTransition::LINK);
break;
case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW:
- OpenURL(params_.link_url, NEW_WINDOW, PageTransition::LINK);
+ OpenURL(
+ params_.link_url,
+ params_.frame_url.is_empty() ? params_.page_url : params_.frame_url,
+ NEW_WINDOW, PageTransition::LINK);
break;
case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD:
- OpenURL(params_.link_url, OFF_THE_RECORD, PageTransition::LINK);
+ OpenURL(params_.link_url, GURL(), OFF_THE_RECORD, PageTransition::LINK);
break;
case IDC_CONTENT_CONTEXT_SAVEAVAS:
@@ -1243,7 +1249,10 @@ void RenderViewContextMenu::ExecuteCommand(int id) {
case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB:
case IDC_CONTENT_CONTEXT_OPENAVNEWTAB:
- OpenURL(params_.src_url, NEW_BACKGROUND_TAB, PageTransition::LINK);
+ OpenURL(
+ params_.src_url,
+ params_.frame_url.is_empty() ? params_.page_url : params_.frame_url,
+ NEW_BACKGROUND_TAB, PageTransition::LINK);
break;
case IDC_CONTENT_CONTEXT_PLAYPAUSE: {
@@ -1433,7 +1442,7 @@ void RenderViewContextMenu::ExecuteCommand(int id) {
case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
case IDC_CONTENT_CONTEXT_GOTOURL: {
- OpenURL(selection_navigation_url_, NEW_FOREGROUND_TAB,
+ OpenURL(selection_navigation_url_, GURL(), NEW_FOREGROUND_TAB,
PageTransition::LINK);
break;
}
@@ -1464,7 +1473,7 @@ void RenderViewContextMenu::ExecuteCommand(int id) {
case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: {
std::string url = std::string(chrome::kChromeUISettingsURL) +
chrome::kLanguageOptionsSubPage;
- OpenURL(GURL(url), NEW_FOREGROUND_TAB, PageTransition::LINK);
+ OpenURL(GURL(url), GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK);
break;
}
@@ -1546,10 +1555,10 @@ string16 RenderViewContextMenu::PrintableSelectionText() {
// Controller functions --------------------------------------------------------
void RenderViewContextMenu::OpenURL(
- const GURL& url,
+ const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition,
PageTransition::Type transition) {
- source_tab_contents_->OpenURL(url, GURL(), disposition, transition);
+ source_tab_contents_->OpenURL(url, referrer, disposition, transition);
}
void RenderViewContextMenu::CopyImageAt(int x, int y) {
diff --git a/chrome/browser/tab_contents/render_view_context_menu.h b/chrome/browser/tab_contents/render_view_context_menu.h
index 91f35f9..af04631 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.h
+++ b/chrome/browser/tab_contents/render_view_context_menu.h
@@ -113,7 +113,7 @@ class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate {
// Opens the specified URL string in a new tab. If |in_current_window| is
// false, a new window is created to hold the new tab.
- void OpenURL(const GURL& url,
+ void OpenURL(const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition,
PageTransition::Type transition);
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 58d417d..caa2d4b 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -100,6 +100,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSearchableFormData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h"
@@ -200,6 +201,7 @@ using WebKit::WebRect;
using WebKit::WebScriptSource;
using WebKit::WebSearchableFormData;
using WebKit::WebSecurityOrigin;
+using WebKit::WebSecurityPolicy;
using WebKit::WebSettings;
using WebKit::WebSharedWorker;
using WebKit::WebSize;
@@ -792,8 +794,12 @@ void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) {
request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad);
if (params.referrer.is_valid()) {
- request.setHTTPHeaderField(WebString::fromUTF8("Referer"),
- WebString::fromUTF8(params.referrer.spec()));
+ if (!WebSecurityPolicy::shouldHideReferrer(
+ params.url,
+ WebString::fromUTF8(params.referrer.spec()))) {
+ request.setHTTPHeaderField(WebString::fromUTF8("Referer"),
+ WebString::fromUTF8(params.referrer.spec()));
+ }
}
if (!params.extra_headers.empty()) {