| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 } | 1988 } |
| 1989 | 1989 |
| 1990 base::string16 RenderViewContextMenu::PrintableSelectionText() { | 1990 base::string16 RenderViewContextMenu::PrintableSelectionText() { |
| 1991 return gfx::TruncateString(params_.selection_text, | 1991 return gfx::TruncateString(params_.selection_text, |
| 1992 kMaxSelectionTextLength); | 1992 kMaxSelectionTextLength); |
| 1993 } | 1993 } |
| 1994 | 1994 |
| 1995 // Controller functions -------------------------------------------------------- | 1995 // Controller functions -------------------------------------------------------- |
| 1996 | 1996 |
| 1997 void RenderViewContextMenu::OpenURL( | 1997 void RenderViewContextMenu::OpenURL( |
| 1998 const GURL& url, const GURL& referrer, int64 frame_id, | 1998 const GURL& url, const GURL& referring_url, int64 frame_id, |
| 1999 WindowOpenDisposition disposition, | 1999 WindowOpenDisposition disposition, |
| 2000 content::PageTransition transition) { | 2000 content::PageTransition transition) { |
| 2001 // Ensure that URL fragment, username and password fields are not sent | 2001 content::Referrer referrer(referring_url.GetAsReferrer(), |
| 2002 // in the referrer. | 2002 params_.referrer_policy); |
| 2003 GURL sanitized_referrer(referrer); | |
| 2004 if (sanitized_referrer.is_valid() && (sanitized_referrer.has_ref() || | |
| 2005 sanitized_referrer.has_username() || sanitized_referrer.has_password())) { | |
| 2006 GURL::Replacements referrer_mods; | |
| 2007 referrer_mods.ClearRef(); | |
| 2008 referrer_mods.ClearUsername(); | |
| 2009 referrer_mods.ClearPassword(); | |
| 2010 sanitized_referrer = sanitized_referrer.ReplaceComponents(referrer_mods); | |
| 2011 } | |
| 2012 | 2003 |
| 2013 WebContents* new_contents = source_web_contents_->OpenURL(OpenURLParams( | 2004 WebContents* new_contents = source_web_contents_->OpenURL(OpenURLParams( |
| 2014 url, content::Referrer(sanitized_referrer, params_.referrer_policy), | 2005 url, referrer, disposition, transition, false)); |
| 2015 disposition, transition, false)); | |
| 2016 if (!new_contents) | 2006 if (!new_contents) |
| 2017 return; | 2007 return; |
| 2018 | 2008 |
| 2019 RetargetingDetails details; | 2009 RetargetingDetails details; |
| 2020 details.source_web_contents = source_web_contents_; | 2010 details.source_web_contents = source_web_contents_; |
| 2021 details.source_frame_id = frame_id; | 2011 details.source_frame_id = frame_id; |
| 2022 details.target_url = url; | 2012 details.target_url = url; |
| 2023 details.target_web_contents = new_contents; | 2013 details.target_web_contents = new_contents; |
| 2024 details.not_yet_in_tabstrip = false; | 2014 details.not_yet_in_tabstrip = false; |
| 2025 content::NotificationService::current()->Notify( | 2015 content::NotificationService::current()->Notify( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2067 source_web_contents_->GetRenderViewHost()-> | 2057 source_web_contents_->GetRenderViewHost()-> |
| 2068 ExecuteMediaPlayerActionAtLocation(location, action); | 2058 ExecuteMediaPlayerActionAtLocation(location, action); |
| 2069 } | 2059 } |
| 2070 | 2060 |
| 2071 void RenderViewContextMenu::PluginActionAt( | 2061 void RenderViewContextMenu::PluginActionAt( |
| 2072 const gfx::Point& location, | 2062 const gfx::Point& location, |
| 2073 const WebPluginAction& action) { | 2063 const WebPluginAction& action) { |
| 2074 source_web_contents_->GetRenderViewHost()-> | 2064 source_web_contents_->GetRenderViewHost()-> |
| 2075 ExecutePluginActionAtLocation(location, action); | 2065 ExecutePluginActionAtLocation(location, action); |
| 2076 } | 2066 } |
| OLD | NEW |