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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "chrome/app/chrome_command_ids.h" | 18 #include "chrome/app/chrome_command_ids.h" |
19 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 19 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
20 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 20 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
21 #include "chrome/browser/autocomplete/autocomplete_match.h" | 21 #include "chrome/browser/autocomplete/autocomplete_match.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/debugger/devtools_window.h" | 23 #include "chrome/browser/debugger/devtools_window.h" |
24 #include "chrome/browser/download/download_service.h" | 24 #include "chrome/browser/download/download_service.h" |
25 #include "chrome/browser/download/download_service_factory.h" | 25 #include "chrome/browser/download/download_service_factory.h" |
26 #include "chrome/browser/download/download_util.h" | 26 #include "chrome/browser/download/download_util.h" |
27 #include "chrome/browser/extensions/extension_service.h" | 27 #include "chrome/browser/extensions/extension_service.h" |
28 #include "chrome/browser/extensions/extension_system.h" | 28 #include "chrome/browser/extensions/extension_system.h" |
29 #include "chrome/browser/google/google_util.h" | 29 #include "chrome/browser/google/google_util.h" |
30 #include "chrome/browser/net/browser_url_util.h" | |
31 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 30 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
32 #include "chrome/browser/prefs/pref_member.h" | 31 #include "chrome/browser/prefs/pref_member.h" |
33 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
34 #include "chrome/browser/printing/print_preview_context_menu_observer.h" | 33 #include "chrome/browser/printing/print_preview_context_menu_observer.h" |
35 #include "chrome/browser/printing/print_preview_tab_controller.h" | 34 #include "chrome/browser/printing/print_preview_tab_controller.h" |
36 #include "chrome/browser/printing/print_view_manager.h" | 35 #include "chrome/browser/printing/print_view_manager.h" |
37 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
38 #include "chrome/browser/profiles/profile_io_data.h" | 37 #include "chrome/browser/profiles/profile_io_data.h" |
39 #include "chrome/browser/search_engines/template_url.h" | 38 #include "chrome/browser/search_engines/template_url.h" |
40 #include "chrome/browser/search_engines/template_url_service.h" | 39 #include "chrome/browser/search_engines/template_url_service.h" |
41 #include "chrome/browser/search_engines/template_url_service_factory.h" | 40 #include "chrome/browser/search_engines/template_url_service_factory.h" |
42 #include "chrome/browser/spellchecker/spellcheck_host.h" | 41 #include "chrome/browser/spellchecker/spellcheck_host.h" |
43 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 42 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
44 #include "chrome/browser/tab_contents/retargeting_details.h" | 43 #include "chrome/browser/tab_contents/retargeting_details.h" |
45 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" | 44 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" |
46 #include "chrome/browser/tab_contents/spelling_menu_observer.h" | 45 #include "chrome/browser/tab_contents/spelling_menu_observer.h" |
47 #include "chrome/browser/translate/translate_manager.h" | 46 #include "chrome/browser/translate/translate_manager.h" |
48 #include "chrome/browser/translate/translate_prefs.h" | 47 #include "chrome/browser/translate/translate_prefs.h" |
49 #include "chrome/browser/translate/translate_tab_helper.h" | 48 #include "chrome/browser/translate/translate_tab_helper.h" |
50 #include "chrome/browser/ui/browser.h" | 49 #include "chrome/browser/ui/browser.h" |
51 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 50 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
52 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 51 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
53 #include "chrome/common/chrome_constants.h" | 52 #include "chrome/common/chrome_constants.h" |
54 #include "chrome/common/chrome_notification_types.h" | 53 #include "chrome/common/chrome_notification_types.h" |
55 #include "chrome/common/chrome_switches.h" | 54 #include "chrome/common/chrome_switches.h" |
56 #include "chrome/common/chrome_view_type.h" | 55 #include "chrome/common/chrome_view_type.h" |
57 #include "chrome/common/extensions/extension.h" | 56 #include "chrome/common/extensions/extension.h" |
| 57 #include "chrome/common/net/url_util.h" |
58 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
59 #include "chrome/common/print_messages.h" | 59 #include "chrome/common/print_messages.h" |
60 #include "chrome/common/spellcheck_messages.h" | 60 #include "chrome/common/spellcheck_messages.h" |
61 #include "chrome/common/url_constants.h" | 61 #include "chrome/common/url_constants.h" |
62 #include "content/public/browser/child_process_security_policy.h" | 62 #include "content/public/browser/child_process_security_policy.h" |
63 #include "content/public/browser/download_manager.h" | 63 #include "content/public/browser/download_manager.h" |
64 #include "content/public/browser/download_save_info.h" | 64 #include "content/public/browser/download_save_info.h" |
65 #include "content/public/browser/download_url_parameters.h" | 65 #include "content/public/browser/download_url_parameters.h" |
66 #include "content/public/browser/navigation_details.h" | 66 #include "content/public/browser/navigation_details.h" |
67 #include "content/public/browser/navigation_entry.h" | 67 #include "content/public/browser/navigation_entry.h" |
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 source_web_contents_->GetRenderViewHost()->CopyImageAt(x, y); | 1959 source_web_contents_->GetRenderViewHost()->CopyImageAt(x, y); |
1960 } | 1960 } |
1961 | 1961 |
1962 void RenderViewContextMenu::Inspect(int x, int y) { | 1962 void RenderViewContextMenu::Inspect(int x, int y) { |
1963 content::RecordAction(UserMetricsAction("DevTools_InspectElement")); | 1963 content::RecordAction(UserMetricsAction("DevTools_InspectElement")); |
1964 DevToolsWindow::InspectElement( | 1964 DevToolsWindow::InspectElement( |
1965 source_web_contents_->GetRenderViewHost(), x, y); | 1965 source_web_contents_->GetRenderViewHost(), x, y); |
1966 } | 1966 } |
1967 | 1967 |
1968 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { | 1968 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { |
1969 chrome_browser_net::WriteURLToClipboard( | 1969 chrome_common_net::WriteURLToClipboard( |
1970 url, | 1970 url, |
1971 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 1971 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
1972 g_browser_process->clipboard()); | 1972 g_browser_process->clipboard()); |
1973 } | 1973 } |
1974 | 1974 |
1975 void RenderViewContextMenu::MediaPlayerActionAt( | 1975 void RenderViewContextMenu::MediaPlayerActionAt( |
1976 const gfx::Point& location, | 1976 const gfx::Point& location, |
1977 const WebMediaPlayerAction& action) { | 1977 const WebMediaPlayerAction& action) { |
1978 source_web_contents_->GetRenderViewHost()-> | 1978 source_web_contents_->GetRenderViewHost()-> |
1979 ExecuteMediaPlayerActionAtLocation(location, action); | 1979 ExecuteMediaPlayerActionAtLocation(location, action); |
1980 } | 1980 } |
1981 | 1981 |
1982 void RenderViewContextMenu::PluginActionAt( | 1982 void RenderViewContextMenu::PluginActionAt( |
1983 const gfx::Point& location, | 1983 const gfx::Point& location, |
1984 const WebPluginAction& action) { | 1984 const WebPluginAction& action) { |
1985 source_web_contents_->GetRenderViewHost()-> | 1985 source_web_contents_->GetRenderViewHost()-> |
1986 ExecutePluginActionAtLocation(location, action); | 1986 ExecutePluginActionAtLocation(location, action); |
1987 } | 1987 } |
OLD | NEW |