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,8 @@ |
switch (id) { |
case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB: |
- OpenURL(params_.link_url, |
+ OpenURL(params_.link_url, |
brettw
2011/03/18 16:20:55
You accidentally added some extra space before thi
|
+ params_.frame_url.is_empty() ? params_.page_url : params_.frame_url, |
brettw
2011/03/18 16:20:55
The indentation rule is align all arguments to aft
|
source_tab_contents_->delegate() && |
source_tab_contents_->delegate()->IsApplication() ? |
NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB, |
@@ -1182,11 +1186,14 @@ |
break; |
case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW: |
- OpenURL(params_.link_url, NEW_WINDOW, PageTransition::LINK); |
+ OpenURL(params_.link_url, |
brettw
2011/03/18 16:20:55
The indentation here should match above.
|
+ 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(), |
brettw
2011/03/18 16:20:55
I think this still fits on one line.
|
+ OFF_THE_RECORD, PageTransition::LINK); |
break; |
case IDC_CONTENT_CONTEXT_SAVEAVAS: |
@@ -1218,7 +1225,9 @@ |
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, |
brettw
2011/03/18 16:20:55
Same as above.
|
+ NEW_BACKGROUND_TAB, PageTransition::LINK); |
break; |
case IDC_CONTENT_CONTEXT_PLAYPAUSE: { |
@@ -1339,7 +1348,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 +1402,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 +1519,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 |
+ // in https to http transition. |
+ bool hide_referrer = WebSecurityPolicy::shouldHideReferrer( |
+ WebURL::WebURL(url), |
+ WebString::fromUTF8(WebURL::WebURL(referrer).spec())); |
+ source_tab_contents_->OpenURL(url, hide_referrer ? GURL() : referrer, |
+ disposition, transition); |
} |
void RenderViewContextMenu::CopyImageAt(int x, int y) { |