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 "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 Loading... |
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 if (frame_proxy_in_parent_renderer_->frame_tree_node() |
| 150 ->render_manager() |
| 151 ->ForInnerDelegate()) { |
| 152 return; |
| 153 } |
| 154 |
147 RenderWidgetHostView* rwhv = | 155 RenderWidgetHostView* rwhv = |
148 frame_proxy_in_parent_renderer_->GetRenderWidgetHostView(); | 156 frame_proxy_in_parent_renderer_->GetRenderWidgetHostView(); |
149 if (rwhv) | 157 if (rwhv) |
150 static_cast<RenderWidgetHostViewBase*>(rwhv)->GetScreenInfo(results); | 158 static_cast<RenderWidgetHostViewBase*>(rwhv)->GetScreenInfo(results); |
151 } | 159 } |
152 | 160 |
153 void CrossProcessFrameConnector::OnForwardInputEvent( | 161 void CrossProcessFrameConnector::OnForwardInputEvent( |
154 const blink::WebInputEvent* event) { | 162 const blink::WebInputEvent* event) { |
155 if (!view_) | 163 if (!view_) |
156 return; | 164 return; |
157 | 165 |
158 RenderWidgetHostImpl* child_widget = | 166 RenderWidgetHostImpl* child_widget = |
159 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); | 167 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); |
| 168 RenderFrameHostManager* manager = |
| 169 frame_proxy_in_parent_renderer_->frame_tree_node()->render_manager(); |
160 RenderWidgetHostImpl* parent_widget = | 170 RenderWidgetHostImpl* parent_widget = |
161 frame_proxy_in_parent_renderer_->GetRenderViewHost(); | 171 manager->ForInnerDelegate() |
| 172 ? manager->GetOuterRenderWidgetHostForKeyboardInput() |
| 173 : frame_proxy_in_parent_renderer_->GetRenderViewHost(); |
162 | 174 |
163 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { | 175 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { |
164 if (!parent_widget->GetLastKeyboardEvent()) | 176 if (!parent_widget->GetLastKeyboardEvent()) |
165 return; | 177 return; |
166 NativeWebKeyboardEvent keyboard_event( | 178 NativeWebKeyboardEvent keyboard_event( |
167 *parent_widget->GetLastKeyboardEvent()); | 179 *parent_widget->GetLastKeyboardEvent()); |
168 child_widget->ForwardKeyboardEvent(keyboard_event); | 180 child_widget->ForwardKeyboardEvent(keyboard_event); |
169 return; | 181 return; |
170 } | 182 } |
171 | 183 |
(...skipping 20 matching lines...) Expand all Loading... |
192 } | 204 } |
193 } | 205 } |
194 | 206 |
195 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) { | 207 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) { |
196 child_frame_rect_ = frame_rect; | 208 child_frame_rect_ = frame_rect; |
197 if (view_) | 209 if (view_) |
198 view_->SetSize(frame_rect.size()); | 210 view_->SetSize(frame_rect.size()); |
199 } | 211 } |
200 | 212 |
201 } // namespace content | 213 } // namespace content |
OLD | NEW |