Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 6681030: Requesting Review for BugFix Chromium:1935 (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/render_view_context_menu.cc
===================================================================
--- chrome/browser/tab_contents/render_view_context_menu.cc (revision 75533)
+++ chrome/browser/tab_contents/render_view_context_menu.cc (working copy)
@@ -52,13 +52,16 @@
#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 "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.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::WebSecurityPolicy;
+using WebKit::WebURL;
+using WebKit::WebString;
namespace {
@@ -1174,7 +1177,7 @@
switch (id) {
case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB:
- OpenURL(params_.link_url,
+ OpenURL(params_.link_url, params_.page_url,
source_tab_contents_->delegate() &&
source_tab_contents_->delegate()->IsApplication() ?
NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB,
@@ -1182,11 +1185,13 @@
break;
case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW:
- OpenURL(params_.link_url, NEW_WINDOW, PageTransition::LINK);
+ OpenURL(params_.link_url, params_.page_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:
@@ -1218,7 +1223,8 @@
case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB:
case IDC_CONTENT_CONTEXT_OPENAVNEWTAB:
- OpenURL(params_.src_url, NEW_BACKGROUND_TAB, PageTransition::LINK);
+ OpenURL(params_.src_url, params_.page_url,
+ NEW_BACKGROUND_TAB, PageTransition::LINK);
break;
case IDC_CONTENT_CONTEXT_PLAYPAUSE: {
@@ -1339,7 +1345,8 @@
case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE:
OpenURL(GURL(chrome::kViewSourceScheme + std::string(":") +
- params_.frame_url.spec()), NEW_FOREGROUND_TAB, PageTransition::LINK);
+ params_.frame_url.spec()), GURL(),
+ NEW_FOREGROUND_TAB, PageTransition::LINK);
break;
case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: {
@@ -1392,7 +1399,7 @@
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;
}
@@ -1509,10 +1516,16 @@
// 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);
+// Check security policy to prevent referrer being sent
brettw 2011/03/14 19:51:37 Should be indented 2 spaces.
+// in https to http transition.
+ bool hideReferrer = WebSecurityPolicy::shouldHideReferrer(
brettw 2011/03/14 19:51:37 Should be "hide_referrer"
+ WebURL::WebURL(url),
+ WebString::fromUTF8(WebURL::WebURL(referrer).spec()));
+ source_tab_contents_->OpenURL(url, hideReferrer ? GURL() : referrer,
+ disposition, transition);
}
void RenderViewContextMenu::CopyImageAt(int x, int y) {
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698