Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 2165523004: Force MimeHandlerView to always use BrowserPlugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed typos Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 24 matching lines...) Expand all
35 #include "content/common/drag_messages.h" 35 #include "content/common/drag_messages.h"
36 #include "content/common/host_shared_bitmap_manager.h" 36 #include "content/common/host_shared_bitmap_manager.h"
37 #include "content/common/input_messages.h" 37 #include "content/common/input_messages.h"
38 #include "content/common/site_isolation_policy.h" 38 #include "content/common/site_isolation_policy.h"
39 #include "content/common/text_input_state.h" 39 #include "content/common/text_input_state.h"
40 #include "content/common/view_messages.h" 40 #include "content/common/view_messages.h"
41 #include "content/public/browser/browser_context.h" 41 #include "content/public/browser/browser_context.h"
42 #include "content/public/browser/browser_plugin_guest_manager.h" 42 #include "content/public/browser/browser_plugin_guest_manager.h"
43 #include "content/public/browser/content_browser_client.h" 43 #include "content/public/browser/content_browser_client.h"
44 #include "content/public/browser/guest_host.h" 44 #include "content/public/browser/guest_host.h"
45 #include "content/public/browser/guest_mode.h"
45 #include "content/public/browser/render_process_host.h" 46 #include "content/public/browser/render_process_host.h"
46 #include "content/public/browser/render_widget_host_view.h" 47 #include "content/public/browser/render_widget_host_view.h"
47 #include "content/public/browser/user_metrics.h" 48 #include "content/public/browser/user_metrics.h"
48 #include "content/public/browser/web_contents_observer.h" 49 #include "content/public/browser/web_contents_observer.h"
49 #include "content/public/common/browser_plugin_guest_mode.h" 50 #include "content/public/common/browser_plugin_guest_mode.h"
50 #include "content/public/common/drop_data.h" 51 #include "content/public/common/drop_data.h"
51 #include "ui/gfx/geometry/size_conversions.h" 52 #include "ui/gfx/geometry/size_conversions.h"
52 53
53 #if defined(OS_MACOSX) 54 #if defined(OS_MACOSX)
54 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" 55 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 is_full_page_plugin_(false), 99 is_full_page_plugin_(false),
99 has_render_view_(has_render_view), 100 has_render_view_(has_render_view),
100 is_in_destruction_(false), 101 is_in_destruction_(false),
101 initialized_(false), 102 initialized_(false),
102 guest_proxy_routing_id_(MSG_ROUTING_NONE), 103 guest_proxy_routing_id_(MSG_ROUTING_NONE),
103 last_drag_status_(blink::WebDragStatusUnknown), 104 last_drag_status_(blink::WebDragStatusUnknown),
104 seen_embedder_system_drag_ended_(false), 105 seen_embedder_system_drag_ended_(false),
105 seen_embedder_drag_source_ended_at_(false), 106 seen_embedder_drag_source_ended_at_(false),
106 ignore_dragged_url_(true), 107 ignore_dragged_url_(true),
107 delegate_(delegate), 108 delegate_(delegate),
109 can_use_cross_process_frames_(delegate->CanUseCrossProcessFrames()),
108 weak_ptr_factory_(this) { 110 weak_ptr_factory_(this) {
109 DCHECK(web_contents); 111 DCHECK(web_contents);
110 DCHECK(delegate); 112 DCHECK(delegate);
111 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create")); 113 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create"));
112 web_contents->SetBrowserPluginGuest(this); 114 web_contents->SetBrowserPluginGuest(this);
113 delegate->SetGuestHost(this); 115 delegate->SetGuestHost(this);
114 } 116 }
115 117
116 int BrowserPluginGuest::GetGuestProxyRoutingID() { 118 int BrowserPluginGuest::GetGuestProxyRoutingID() {
117 if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { 119 if (GuestMode::IsInnerWebContentsUsingCrossProcessFrames(GetWebContents())) {
118 // We don't use the proxy to send postMessage in --site-per-process, since 120 // We don't use the proxy to send postMessage in --site-per-process, since
119 // we use the contentWindow directly from the frame element instead. 121 // we use the contentWindow directly from the frame element instead.
120 return MSG_ROUTING_NONE; 122 return MSG_ROUTING_NONE;
121 } 123 }
122 124
123 if (guest_proxy_routing_id_ != MSG_ROUTING_NONE) 125 if (guest_proxy_routing_id_ != MSG_ROUTING_NONE)
124 return guest_proxy_routing_id_; 126 return guest_proxy_routing_id_;
125 127
126 // Create a RenderFrameProxyHost for the guest in the embedder renderer 128 // Create a RenderFrameProxyHost for the guest in the embedder renderer
127 // process, so that the embedder can access the guest's window object. 129 // process, so that the embedder can access the guest's window object.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 blink::WebFocusTypeNone); 285 blink::WebFocusTypeNone);
284 286
285 guest_visible_ = params.visible; 287 guest_visible_ = params.visible;
286 UpdateVisibility(); 288 UpdateVisibility();
287 289
288 is_full_page_plugin_ = params.is_full_page_plugin; 290 is_full_page_plugin_ = params.is_full_page_plugin;
289 guest_window_rect_ = params.view_rect; 291 guest_window_rect_ = params.view_rect;
290 292
291 if (owner_web_contents_ != owner_web_contents) { 293 if (owner_web_contents_ != owner_web_contents) {
292 WebContentsViewGuest* new_view = nullptr; 294 WebContentsViewGuest* new_view = nullptr;
293 if (!BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { 295 if (!GuestMode::IsInnerWebContentsUsingCrossProcessFrames(
296 GetWebContents())) {
294 new_view = 297 new_view =
295 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); 298 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
296 } 299 }
297 300
298 if (owner_web_contents_ && new_view) 301 if (owner_web_contents_ && new_view)
299 new_view->OnGuestDetached(owner_web_contents_->GetView()); 302 new_view->OnGuestDetached(owner_web_contents_->GetView());
300 303
301 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to 304 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to
302 // be attached. 305 // be attached.
303 owner_web_contents_ = owner_web_contents; 306 owner_web_contents_ = owner_web_contents;
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 673
671 bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) { 674 bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
672 bool handled = true; 675 bool handled = true;
673 // In --site-per-process, we do not need most of BrowserPluginGuest to drive 676 // In --site-per-process, we do not need most of BrowserPluginGuest to drive
674 // inner WebContents. 677 // inner WebContents.
675 // Right now InputHostMsg_ImeCompositionRangeChanged hits NOTREACHED() in 678 // Right now InputHostMsg_ImeCompositionRangeChanged hits NOTREACHED() in
676 // RWHVChildFrame, so we're disabling message handling entirely here. 679 // RWHVChildFrame, so we're disabling message handling entirely here.
677 // TODO(lazyboy): Fix this as part of http://crbug.com/330264. The required 680 // TODO(lazyboy): Fix this as part of http://crbug.com/330264. The required
678 // parts of code from this class should be extracted to a separate class for 681 // parts of code from this class should be extracted to a separate class for
679 // --site-per-process. 682 // --site-per-process.
680 if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { 683 if (GuestMode::IsInnerWebContentsUsingCrossProcessFrames(GetWebContents()))
681 return false; 684 return false;
682 }
683 685
684 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message) 686 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message)
685 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCancelComposition, 687 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCancelComposition,
686 OnImeCancelComposition) 688 OnImeCancelComposition)
687 #if defined(OS_MACOSX) || defined(USE_AURA) 689 #if defined(OS_MACOSX) || defined(USE_AURA)
688 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, 690 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged,
689 OnImeCompositionRangeChanged) 691 OnImeCompositionRangeChanged)
690 #endif 692 #endif
691 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, 693 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
692 OnHasTouchEventHandlers) 694 OnHasTouchEventHandlers)
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 void BrowserPluginGuest::OnSetEditCommandsForNextKeyEvent( 922 void BrowserPluginGuest::OnSetEditCommandsForNextKeyEvent(
921 int browser_plugin_instance_id, 923 int browser_plugin_instance_id,
922 const std::vector<EditCommand>& edit_commands) { 924 const std::vector<EditCommand>& edit_commands) {
923 Send(new InputMsg_SetEditCommandsForNextKeyEvent(routing_id(), 925 Send(new InputMsg_SetEditCommandsForNextKeyEvent(routing_id(),
924 edit_commands)); 926 edit_commands));
925 } 927 }
926 928
927 void BrowserPluginGuest::OnSetVisibility(int browser_plugin_instance_id, 929 void BrowserPluginGuest::OnSetVisibility(int browser_plugin_instance_id,
928 bool visible) { 930 bool visible) {
929 // For OOPIF-<webivew>, the remote frame will handle visibility state. 931 // For OOPIF-<webivew>, the remote frame will handle visibility state.
930 if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) 932 if (GuestMode::IsInnerWebContentsUsingCrossProcessFrames(GetWebContents()))
931 return; 933 return;
932 934
933 guest_visible_ = visible; 935 guest_visible_ = visible;
934 if (embedder_visible_ && guest_visible_) 936 if (embedder_visible_ && guest_visible_)
935 GetWebContents()->WasShown(); 937 GetWebContents()->WasShown();
936 else 938 else
937 GetWebContents()->WasHidden(); 939 GetWebContents()->WasHidden();
938 } 940 }
939 941
940 void BrowserPluginGuest::OnUnlockMouse() { 942 void BrowserPluginGuest::OnUnlockMouse() {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 range, character_bounds); 1019 range, character_bounds);
1018 } 1020 }
1019 #endif 1021 #endif
1020 1022
1021 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { 1023 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) {
1022 if (delegate_) 1024 if (delegate_)
1023 delegate_->SetContextMenuPosition(position); 1025 delegate_->SetContextMenuPosition(position);
1024 } 1026 }
1025 1027
1026 } // namespace content 1028 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698