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

Side by Side Diff: content/browser/frame_host/cross_process_frame_connector.cc

Issue 972313002: Make <webview> use out-of-process iframe architecture. (Closed) Base URL: ssh://saopaulo.wat/mnt/dev/shared/src@testoopif2z-better-chrome
Patch Set: Address comments move destruction callback to GuestViewContainer Created 5 years, 6 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 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 "content/browser/frame_host/cross_process_frame_connector.h" 5 #include "content/browser/frame_host/cross_process_frame_connector.h"
6 6
7 #include "cc/surfaces/surface.h" 7 #include "cc/surfaces/surface.h"
8 #include "cc/surfaces/surface_manager.h" 8 #include "cc/surfaces/surface_manager.h"
9 #include "content/browser/compositor/surface_utils.h" 9 #include "content/browser/compositor/surface_utils.h"
10 #include "content/browser/frame_host/frame_tree_node.h"
11 #include "content/browser/frame_host/render_frame_host_manager.h"
10 #include "content/browser/frame_host/render_frame_proxy_host.h" 12 #include "content/browser/frame_host/render_frame_proxy_host.h"
11 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 13 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
12 #include "content/browser/renderer_host/render_view_host_impl.h" 14 #include "content/browser/renderer_host/render_view_host_impl.h"
13 #include "content/browser/renderer_host/render_widget_host_impl.h" 15 #include "content/browser/renderer_host/render_widget_host_impl.h"
14 #include "content/browser/renderer_host/render_widget_host_view_base.h" 16 #include "content/browser/renderer_host/render_widget_host_view_base.h"
15 #include "content/common/frame_messages.h" 17 #include "content/common/frame_messages.h"
16 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
17 #include "third_party/WebKit/public/web/WebInputEvent.h" 19 #include "third_party/WebKit/public/web/WebInputEvent.h"
18 20
19 namespace content { 21 namespace content {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 139
138 if (!frame_rect.size().IsEmpty()) 140 if (!frame_rect.size().IsEmpty())
139 SetSize(frame_rect); 141 SetSize(frame_rect);
140 } 142 }
141 143
142 gfx::Rect CrossProcessFrameConnector::ChildFrameRect() { 144 gfx::Rect CrossProcessFrameConnector::ChildFrameRect() {
143 return child_frame_rect_; 145 return child_frame_rect_;
144 } 146 }
145 147
146 void CrossProcessFrameConnector::GetScreenInfo(blink::WebScreenInfo* results) { 148 void CrossProcessFrameConnector::GetScreenInfo(blink::WebScreenInfo* results) {
149 // Inner WebContents's root FrameTreeNode does not have a parent(), so
150 // GetRenderWidgetHostView() call below will fail.
151 // TODO(lazyboy): Fix this.
152 if (frame_proxy_in_parent_renderer_->frame_tree_node()
153 ->render_manager()
154 ->ForInnerDelegate()) {
155 return;
156 }
157
147 RenderWidgetHostView* rwhv = 158 RenderWidgetHostView* rwhv =
148 frame_proxy_in_parent_renderer_->GetRenderWidgetHostView(); 159 frame_proxy_in_parent_renderer_->GetRenderWidgetHostView();
149 if (rwhv) 160 if (rwhv)
150 static_cast<RenderWidgetHostViewBase*>(rwhv)->GetScreenInfo(results); 161 static_cast<RenderWidgetHostViewBase*>(rwhv)->GetScreenInfo(results);
151 } 162 }
152 163
153 void CrossProcessFrameConnector::OnForwardInputEvent( 164 void CrossProcessFrameConnector::OnForwardInputEvent(
154 const blink::WebInputEvent* event) { 165 const blink::WebInputEvent* event) {
155 if (!view_) 166 if (!view_)
156 return; 167 return;
157 168
158 RenderWidgetHostImpl* child_widget = 169 RenderWidgetHostImpl* child_widget =
159 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); 170 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost());
171 RenderFrameHostManager* manager =
172 frame_proxy_in_parent_renderer_->frame_tree_node()->render_manager();
160 RenderWidgetHostImpl* parent_widget = 173 RenderWidgetHostImpl* parent_widget =
161 frame_proxy_in_parent_renderer_->GetRenderViewHost(); 174 manager->ForInnerDelegate()
175 ? manager->GetOuterRenderWidgetHostForKeyboardInput()
176 : frame_proxy_in_parent_renderer_->GetRenderViewHost();
162 177
163 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { 178 if (blink::WebInputEvent::isKeyboardEventType(event->type)) {
164 if (!parent_widget->GetLastKeyboardEvent()) 179 if (!parent_widget->GetLastKeyboardEvent())
165 return; 180 return;
166 NativeWebKeyboardEvent keyboard_event( 181 NativeWebKeyboardEvent keyboard_event(
167 *parent_widget->GetLastKeyboardEvent()); 182 *parent_widget->GetLastKeyboardEvent());
168 child_widget->ForwardKeyboardEvent(keyboard_event); 183 child_widget->ForwardKeyboardEvent(keyboard_event);
169 return; 184 return;
170 } 185 }
171 186
(...skipping 20 matching lines...) Expand all
192 } 207 }
193 } 208 }
194 209
195 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) { 210 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) {
196 child_frame_rect_ = frame_rect; 211 child_frame_rect_ = frame_rect;
197 if (view_) 212 if (view_)
198 view_->SetSize(frame_rect.size()); 213 view_->SetSize(frame_rect.size());
199 } 214 }
200 215
201 } // namespace content 216 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698