| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "chrome/common/chrome_constants.h" | 64 #include "chrome/common/chrome_constants.h" |
| 65 #include "chrome/common/chrome_switches.h" | 65 #include "chrome/common/chrome_switches.h" |
| 66 #include "chrome/common/content_restriction.h" | 66 #include "chrome/common/content_restriction.h" |
| 67 #include "chrome/common/pref_names.h" | 67 #include "chrome/common/pref_names.h" |
| 68 #include "chrome/common/render_messages.h" | 68 #include "chrome/common/render_messages.h" |
| 69 #include "chrome/common/url_constants.h" | 69 #include "chrome/common/url_constants.h" |
| 70 #include "chrome/grit/generated_resources.h" | 70 #include "chrome/grit/generated_resources.h" |
| 71 #include "components/autofill/core/common/password_generation_util.h" | 71 #include "components/autofill/core/common/password_generation_util.h" |
| 72 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" | 72 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
| 73 #include "components/google/core/browser/google_util.h" | 73 #include "components/google/core/browser/google_util.h" |
| 74 #include "components/guest_view/browser/guest_view_base.h" |
| 74 #include "components/metrics/proto/omnibox_input_type.pb.h" | 75 #include "components/metrics/proto/omnibox_input_type.pb.h" |
| 75 #include "components/omnibox/browser/autocomplete_classifier.h" | 76 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 76 #include "components/omnibox/browser/autocomplete_match.h" | 77 #include "components/omnibox/browser/autocomplete_match.h" |
| 77 #include "components/password_manager/core/common/experiments.h" | 78 #include "components/password_manager/core/common/experiments.h" |
| 78 #include "components/prefs/pref_member.h" | 79 #include "components/prefs/pref_member.h" |
| 79 #include "components/prefs/pref_service.h" | 80 #include "components/prefs/pref_service.h" |
| 80 #include "components/search_engines/template_url.h" | 81 #include "components/search_engines/template_url.h" |
| 81 #include "components/search_engines/template_url_service.h" | 82 #include "components/search_engines/template_url_service.h" |
| 82 #include "components/spellcheck/browser/pref_names.h" | 83 #include "components/spellcheck/browser/pref_names.h" |
| 83 #include "components/spellcheck/browser/spellcheck_host_metrics.h" | 84 #include "components/spellcheck/browser/spellcheck_host_metrics.h" |
| 84 #include "components/spellcheck/common/spellcheck_common.h" | 85 #include "components/spellcheck/common/spellcheck_common.h" |
| 85 #include "components/translate/core/browser/translate_download_manager.h" | 86 #include "components/translate/core/browser/translate_download_manager.h" |
| 86 #include "components/translate/core/browser/translate_manager.h" | 87 #include "components/translate/core/browser/translate_manager.h" |
| 87 #include "components/translate/core/browser/translate_prefs.h" | 88 #include "components/translate/core/browser/translate_prefs.h" |
| 88 #include "components/url_formatter/url_formatter.h" | 89 #include "components/url_formatter/url_formatter.h" |
| 89 #include "components/user_prefs/user_prefs.h" | 90 #include "components/user_prefs/user_prefs.h" |
| 90 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 91 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 91 #include "content/public/browser/child_process_security_policy.h" | 92 #include "content/public/browser/child_process_security_policy.h" |
| 92 #include "content/public/browser/download_manager.h" | 93 #include "content/public/browser/download_manager.h" |
| 93 #include "content/public/browser/download_save_info.h" | 94 #include "content/public/browser/download_save_info.h" |
| 94 #include "content/public/browser/download_url_parameters.h" | 95 #include "content/public/browser/download_url_parameters.h" |
| 96 #include "content/public/browser/guest_mode.h" |
| 95 #include "content/public/browser/navigation_details.h" | 97 #include "content/public/browser/navigation_details.h" |
| 96 #include "content/public/browser/navigation_entry.h" | 98 #include "content/public/browser/navigation_entry.h" |
| 97 #include "content/public/browser/notification_service.h" | 99 #include "content/public/browser/notification_service.h" |
| 98 #include "content/public/browser/render_frame_host.h" | 100 #include "content/public/browser/render_frame_host.h" |
| 99 #include "content/public/browser/render_process_host.h" | 101 #include "content/public/browser/render_process_host.h" |
| 100 #include "content/public/browser/render_view_host.h" | 102 #include "content/public/browser/render_view_host.h" |
| 101 #include "content/public/browser/render_widget_host_view.h" | 103 #include "content/public/browser/render_widget_host_view.h" |
| 102 #include "content/public/browser/ssl_status.h" | 104 #include "content/public/browser/ssl_status.h" |
| 103 #include "content/public/browser/storage_partition.h" | 105 #include "content/public/browser/storage_partition.h" |
| 104 #include "content/public/browser/user_metrics.h" | 106 #include "content/public/browser/user_metrics.h" |
| 105 #include "content/public/browser/web_contents.h" | 107 #include "content/public/browser/web_contents.h" |
| 106 #include "content/public/common/browser_plugin_guest_mode.h" | |
| 107 #include "content/public/common/menu_item.h" | 108 #include "content/public/common/menu_item.h" |
| 108 #include "content/public/common/url_utils.h" | 109 #include "content/public/common/url_utils.h" |
| 109 #include "extensions/browser/extension_host.h" | 110 #include "extensions/browser/extension_host.h" |
| 110 #include "extensions/browser/extension_system.h" | 111 #include "extensions/browser/extension_system.h" |
| 112 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t.h" |
| 111 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 113 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 112 #include "extensions/browser/view_type_utils.h" | 114 #include "extensions/browser/view_type_utils.h" |
| 113 #include "extensions/common/extension.h" | 115 #include "extensions/common/extension.h" |
| 114 #include "net/base/escape.h" | 116 #include "net/base/escape.h" |
| 115 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 117 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
| 116 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" | 118 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" |
| 117 #include "third_party/WebKit/public/web/WebPluginAction.h" | 119 #include "third_party/WebKit/public/web/WebPluginAction.h" |
| 118 #include "ui/base/clipboard/clipboard.h" | 120 #include "ui/base/clipboard/clipboard.h" |
| 119 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 121 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 120 #include "ui/base/l10n/l10n_util.h" | 122 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 497 |
| 496 } // namespace | 498 } // namespace |
| 497 | 499 |
| 498 // static | 500 // static |
| 499 gfx::Vector2d RenderViewContextMenu::GetOffset( | 501 gfx::Vector2d RenderViewContextMenu::GetOffset( |
| 500 RenderFrameHost* render_frame_host) { | 502 RenderFrameHost* render_frame_host) { |
| 501 gfx::Vector2d offset; | 503 gfx::Vector2d offset; |
| 502 #if defined(ENABLE_EXTENSIONS) | 504 #if defined(ENABLE_EXTENSIONS) |
| 503 // When --use-cross-process-frames-for-guests is enabled, the position is | 505 // When --use-cross-process-frames-for-guests is enabled, the position is |
| 504 // transformed in the browser process hittesting code. | 506 // transformed in the browser process hittesting code. |
| 505 if (!content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 507 WebContents* web_contents = |
| 506 WebContents* web_contents = | 508 WebContents::FromRenderFrameHost(render_frame_host); |
| 507 WebContents::FromRenderFrameHost(render_frame_host); | 509 // TODO(ekaramad): For now, MimeHandlerView is based on BrowserPlugin even |
| 510 // when guests use OOPIF. Remove the check below when MimeHandlerView is also |
| 511 // based on OOPIF (https://crbug.com/642826). |
| 512 if (!content::GuestMode::IsCrossProcessFrameGuest(web_contents)) { |
| 508 WebContents* top_level_web_contents = | 513 WebContents* top_level_web_contents = |
| 509 guest_view::GuestViewBase::GetTopLevelWebContents(web_contents); | 514 guest_view::GuestViewBase::GetTopLevelWebContents(web_contents); |
| 510 if (web_contents && top_level_web_contents && | 515 if (web_contents && top_level_web_contents && |
| 511 web_contents != top_level_web_contents) { | 516 web_contents != top_level_web_contents) { |
| 512 gfx::Rect bounds = web_contents->GetContainerBounds(); | 517 gfx::Rect bounds = web_contents->GetContainerBounds(); |
| 513 gfx::Rect top_level_bounds = top_level_web_contents->GetContainerBounds(); | 518 gfx::Rect top_level_bounds = top_level_web_contents->GetContainerBounds(); |
| 514 offset = bounds.origin() - top_level_bounds.origin(); | 519 offset = bounds.origin() - top_level_bounds.origin(); |
| 515 } | 520 } |
| 516 } | 521 } |
| 517 #endif // defined(ENABLE_EXTENSIONS) | 522 #endif // defined(ENABLE_EXTENSIONS) |
| (...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 void RenderViewContextMenu::PluginActionAt( | 2456 void RenderViewContextMenu::PluginActionAt( |
| 2452 const gfx::Point& location, | 2457 const gfx::Point& location, |
| 2453 const WebPluginAction& action) { | 2458 const WebPluginAction& action) { |
| 2454 source_web_contents_->GetRenderViewHost()-> | 2459 source_web_contents_->GetRenderViewHost()-> |
| 2455 ExecutePluginActionAtLocation(location, action); | 2460 ExecutePluginActionAtLocation(location, action); |
| 2456 } | 2461 } |
| 2457 | 2462 |
| 2458 Browser* RenderViewContextMenu::GetBrowser() const { | 2463 Browser* RenderViewContextMenu::GetBrowser() const { |
| 2459 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2464 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
| 2460 } | 2465 } |
| OLD | NEW |