| 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/prefs/public/pref_member.h" | 14 #include "base/prefs/public/pref_member.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "chrome/app/chrome_command_ids.h" | 19 #include "chrome/app/chrome_command_ids.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 20 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 21 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 21 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 22 #include "chrome/browser/autocomplete/autocomplete_match.h" | 22 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 24 #include "chrome/browser/debugger/devtools_window.h" | 25 #include "chrome/browser/debugger/devtools_window.h" |
| 25 #include "chrome/browser/download/download_service.h" | 26 #include "chrome/browser/download/download_service.h" |
| 26 #include "chrome/browser/download/download_service_factory.h" | 27 #include "chrome/browser/download/download_service_factory.h" |
| 27 #include "chrome/browser/download/download_util.h" | 28 #include "chrome/browser/download/download_util.h" |
| 28 #include "chrome/browser/extensions/extension_host.h" | 29 #include "chrome/browser/extensions/extension_host.h" |
| 29 #include "chrome/browser/extensions/extension_service.h" | 30 #include "chrome/browser/extensions/extension_service.h" |
| 30 #include "chrome/browser/extensions/extension_system.h" | 31 #include "chrome/browser/extensions/extension_system.h" |
| 31 #include "chrome/browser/google/google_util.h" | 32 #include "chrome/browser/google/google_util.h" |
| 32 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 33 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 33 #include "chrome/browser/prefs/pref_service.h" | 34 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 63 #include "chrome/common/print_messages.h" | 64 #include "chrome/common/print_messages.h" |
| 64 #include "chrome/common/spellcheck_messages.h" | 65 #include "chrome/common/spellcheck_messages.h" |
| 65 #include "chrome/common/url_constants.h" | 66 #include "chrome/common/url_constants.h" |
| 66 #include "content/public/browser/child_process_security_policy.h" | 67 #include "content/public/browser/child_process_security_policy.h" |
| 67 #include "content/public/browser/download_manager.h" | 68 #include "content/public/browser/download_manager.h" |
| 68 #include "content/public/browser/download_save_info.h" | 69 #include "content/public/browser/download_save_info.h" |
| 69 #include "content/public/browser/download_url_parameters.h" | 70 #include "content/public/browser/download_url_parameters.h" |
| 70 #include "content/public/browser/navigation_details.h" | 71 #include "content/public/browser/navigation_details.h" |
| 71 #include "content/public/browser/navigation_entry.h" | 72 #include "content/public/browser/navigation_entry.h" |
| 72 #include "content/public/browser/notification_service.h" | 73 #include "content/public/browser/notification_service.h" |
| 74 #include "content/public/browser/render_process_host.h" |
| 73 #include "content/public/browser/render_view_host.h" | 75 #include "content/public/browser/render_view_host.h" |
| 74 #include "content/public/browser/render_widget_host_view.h" | 76 #include "content/public/browser/render_widget_host_view.h" |
| 75 #include "content/public/browser/user_metrics.h" | 77 #include "content/public/browser/user_metrics.h" |
| 76 #include "content/public/browser/web_contents.h" | 78 #include "content/public/browser/web_contents.h" |
| 77 #include "content/public/common/content_restriction.h" | 79 #include "content/public/common/content_restriction.h" |
| 78 #include "content/public/common/ssl_status.h" | 80 #include "content/public/common/ssl_status.h" |
| 79 #include "grit/generated_resources.h" | 81 #include "grit/generated_resources.h" |
| 80 #include "net/base/escape.h" | 82 #include "net/base/escape.h" |
| 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 83 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
| 82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" | 84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 if (observer->IsCommandIdSupported(id)) | 1311 if (observer->IsCommandIdSupported(id)) |
| 1310 return observer->ExecuteCommand(id); | 1312 return observer->ExecuteCommand(id); |
| 1311 } | 1313 } |
| 1312 | 1314 |
| 1313 RenderViewHost* rvh = source_web_contents_->GetRenderViewHost(); | 1315 RenderViewHost* rvh = source_web_contents_->GetRenderViewHost(); |
| 1314 | 1316 |
| 1315 // Process custom actions range. | 1317 // Process custom actions range. |
| 1316 if (id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST && | 1318 if (id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST && |
| 1317 id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) { | 1319 id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) { |
| 1318 unsigned action = id - IDC_CONTENT_CONTEXT_CUSTOM_FIRST; | 1320 unsigned action = id - IDC_CONTENT_CONTEXT_CUSTOM_FIRST; |
| 1319 rvh->ExecuteCustomContextMenuCommand(action, params_.custom_context); | 1321 const content::CustomContextMenuContext& context = params_.custom_context; |
| 1322 #if defined(ENABLE_PLUGINS) |
| 1323 if (context.request_id && !context.is_pepper_menu) { |
| 1324 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( |
| 1325 rvh->GetProcess()->GetID()); |
| 1326 } |
| 1327 #endif |
| 1328 rvh->ExecuteCustomContextMenuCommand(action, context); |
| 1320 return; | 1329 return; |
| 1321 } | 1330 } |
| 1322 | 1331 |
| 1323 // Process extension menu items. | 1332 // Process extension menu items. |
| 1324 if (id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && | 1333 if (id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && |
| 1325 id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { | 1334 id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) { |
| 1326 extension_items_.ExecuteCommand(id, source_web_contents_, params_); | 1335 extension_items_.ExecuteCommand(id, source_web_contents_, params_); |
| 1327 return; | 1336 return; |
| 1328 } | 1337 } |
| 1329 | 1338 |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 source_web_contents_->GetRenderViewHost()-> | 1864 source_web_contents_->GetRenderViewHost()-> |
| 1856 ExecuteMediaPlayerActionAtLocation(location, action); | 1865 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1857 } | 1866 } |
| 1858 | 1867 |
| 1859 void RenderViewContextMenu::PluginActionAt( | 1868 void RenderViewContextMenu::PluginActionAt( |
| 1860 const gfx::Point& location, | 1869 const gfx::Point& location, |
| 1861 const WebPluginAction& action) { | 1870 const WebPluginAction& action) { |
| 1862 source_web_contents_->GetRenderViewHost()-> | 1871 source_web_contents_->GetRenderViewHost()-> |
| 1863 ExecutePluginActionAtLocation(location, action); | 1872 ExecutePluginActionAtLocation(location, action); |
| 1864 } | 1873 } |
| OLD | NEW |