| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/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 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 return ui::TruncateString(params_.selection_text, | 1933 return ui::TruncateString(params_.selection_text, |
| 1934 kMaxSelectionTextLength); | 1934 kMaxSelectionTextLength); |
| 1935 } | 1935 } |
| 1936 | 1936 |
| 1937 // Controller functions -------------------------------------------------------- | 1937 // Controller functions -------------------------------------------------------- |
| 1938 | 1938 |
| 1939 void RenderViewContextMenu::OpenURL( | 1939 void RenderViewContextMenu::OpenURL( |
| 1940 const GURL& url, const GURL& referrer, int64 frame_id, | 1940 const GURL& url, const GURL& referrer, int64 frame_id, |
| 1941 WindowOpenDisposition disposition, | 1941 WindowOpenDisposition disposition, |
| 1942 content::PageTransition transition) { | 1942 content::PageTransition transition) { |
| 1943 // Ensure that URL fragment, username and password fields are not sent |
| 1944 // in the referrer. |
| 1945 GURL sanitized_referrer(referrer); |
| 1946 if (sanitized_referrer.is_valid() && (sanitized_referrer.has_ref() || |
| 1947 sanitized_referrer.has_username() || sanitized_referrer.has_password())) { |
| 1948 GURL::Replacements referrer_mods; |
| 1949 referrer_mods.ClearRef(); |
| 1950 referrer_mods.ClearUsername(); |
| 1951 referrer_mods.ClearPassword(); |
| 1952 sanitized_referrer = sanitized_referrer.ReplaceComponents(referrer_mods); |
| 1953 } |
| 1954 |
| 1943 WebContents* new_contents = source_web_contents_->OpenURL(OpenURLParams( | 1955 WebContents* new_contents = source_web_contents_->OpenURL(OpenURLParams( |
| 1944 url, content::Referrer(referrer, params_.referrer_policy), disposition, | 1956 url, content::Referrer(sanitized_referrer, params_.referrer_policy), |
| 1945 transition, false)); | 1957 disposition, transition, false)); |
| 1946 if (!new_contents) | 1958 if (!new_contents) |
| 1947 return; | 1959 return; |
| 1948 | 1960 |
| 1949 RetargetingDetails details; | 1961 RetargetingDetails details; |
| 1950 details.source_web_contents = source_web_contents_; | 1962 details.source_web_contents = source_web_contents_; |
| 1951 details.source_frame_id = frame_id; | 1963 details.source_frame_id = frame_id; |
| 1952 details.target_url = url; | 1964 details.target_url = url; |
| 1953 details.target_web_contents = new_contents; | 1965 details.target_web_contents = new_contents; |
| 1954 details.not_yet_in_tabstrip = false; | 1966 details.not_yet_in_tabstrip = false; |
| 1955 content::NotificationService::current()->Notify( | 1967 content::NotificationService::current()->Notify( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1983 source_web_contents_->GetRenderViewHost()-> | 1995 source_web_contents_->GetRenderViewHost()-> |
| 1984 ExecuteMediaPlayerActionAtLocation(location, action); | 1996 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1985 } | 1997 } |
| 1986 | 1998 |
| 1987 void RenderViewContextMenu::PluginActionAt( | 1999 void RenderViewContextMenu::PluginActionAt( |
| 1988 const gfx::Point& location, | 2000 const gfx::Point& location, |
| 1989 const WebPluginAction& action) { | 2001 const WebPluginAction& action) { |
| 1990 source_web_contents_->GetRenderViewHost()-> | 2002 source_web_contents_->GetRenderViewHost()-> |
| 1991 ExecutePluginActionAtLocation(location, action); | 2003 ExecutePluginActionAtLocation(location, action); |
| 1992 } | 2004 } |
| OLD | NEW |