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 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 } | 1972 } |
1973 | 1973 |
1974 base::string16 RenderViewContextMenu::PrintableSelectionText() { | 1974 base::string16 RenderViewContextMenu::PrintableSelectionText() { |
1975 return gfx::TruncateString(params_.selection_text, | 1975 return gfx::TruncateString(params_.selection_text, |
1976 kMaxSelectionTextLength); | 1976 kMaxSelectionTextLength); |
1977 } | 1977 } |
1978 | 1978 |
1979 // Controller functions -------------------------------------------------------- | 1979 // Controller functions -------------------------------------------------------- |
1980 | 1980 |
1981 void RenderViewContextMenu::OpenURL( | 1981 void RenderViewContextMenu::OpenURL( |
1982 const GURL& url, const GURL& referrer, int64 frame_id, | 1982 const GURL& url, const GURL& referring_url, int64 frame_id, |
1983 WindowOpenDisposition disposition, | 1983 WindowOpenDisposition disposition, |
1984 content::PageTransition transition) { | 1984 content::PageTransition transition) { |
1985 // Ensure that URL fragment, username and password fields are not sent | 1985 content::Referrer referrer(referring_url.GetAsReferrer(), |
1986 // in the referrer. | 1986 params_.referrer_policy); |
1987 GURL sanitized_referrer(referrer); | |
1988 if (sanitized_referrer.is_valid() && (sanitized_referrer.has_ref() || | |
1989 sanitized_referrer.has_username() || sanitized_referrer.has_password())) { | |
1990 GURL::Replacements referrer_mods; | |
1991 referrer_mods.ClearRef(); | |
1992 referrer_mods.ClearUsername(); | |
1993 referrer_mods.ClearPassword(); | |
1994 sanitized_referrer = sanitized_referrer.ReplaceComponents(referrer_mods); | |
1995 } | |
1996 | 1987 |
1997 WebContents* new_contents = source_web_contents_->OpenURL(OpenURLParams( | 1988 WebContents* new_contents = source_web_contents_->OpenURL(OpenURLParams( |
1998 url, content::Referrer(sanitized_referrer, params_.referrer_policy), | 1989 url, referrer, disposition, transition, false)); |
1999 disposition, transition, false)); | |
2000 if (!new_contents) | 1990 if (!new_contents) |
2001 return; | 1991 return; |
2002 | 1992 |
2003 RetargetingDetails details; | 1993 RetargetingDetails details; |
2004 details.source_web_contents = source_web_contents_; | 1994 details.source_web_contents = source_web_contents_; |
2005 details.source_frame_id = frame_id; | 1995 details.source_frame_id = frame_id; |
2006 details.target_url = url; | 1996 details.target_url = url; |
2007 details.target_web_contents = new_contents; | 1997 details.target_web_contents = new_contents; |
2008 details.not_yet_in_tabstrip = false; | 1998 details.not_yet_in_tabstrip = false; |
2009 content::NotificationService::current()->Notify( | 1999 content::NotificationService::current()->Notify( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 source_web_contents_->GetRenderViewHost()-> | 2035 source_web_contents_->GetRenderViewHost()-> |
2046 ExecuteMediaPlayerActionAtLocation(location, action); | 2036 ExecuteMediaPlayerActionAtLocation(location, action); |
2047 } | 2037 } |
2048 | 2038 |
2049 void RenderViewContextMenu::PluginActionAt( | 2039 void RenderViewContextMenu::PluginActionAt( |
2050 const gfx::Point& location, | 2040 const gfx::Point& location, |
2051 const WebPluginAction& action) { | 2041 const WebPluginAction& action) { |
2052 source_web_contents_->GetRenderViewHost()-> | 2042 source_web_contents_->GetRenderViewHost()-> |
2053 ExecutePluginActionAtLocation(location, action); | 2043 ExecutePluginActionAtLocation(location, action); |
2054 } | 2044 } |
OLD | NEW |