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

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

Issue 1255483004: Implement surface-based browser process hit testing for Mac and Aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing test file Created 5 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 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/render_widget_host_view_child_frame.h" 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
6 6
7 #include "cc/surfaces/surface.h" 7 #include "cc/surfaces/surface.h"
8 #include "cc/surfaces/surface_factory.h" 8 #include "cc/surfaces/surface_factory.h"
9 #include "cc/surfaces/surface_manager.h" 9 #include "cc/surfaces/surface_manager.h"
10 #include "cc/surfaces/surface_sequence.h" 10 #include "cc/surfaces/surface_sequence.h"
11 #include "content/browser/accessibility/browser_accessibility_manager.h" 11 #include "content/browser/accessibility/browser_accessibility_manager.h"
12 #include "content/browser/browser_plugin/browser_plugin_guest.h" 12 #include "content/browser/browser_plugin/browser_plugin_guest.h"
13 #include "content/browser/compositor/surface_utils.h" 13 #include "content/browser/compositor/surface_utils.h"
14 #include "content/browser/frame_host/cross_process_frame_connector.h" 14 #include "content/browser/frame_host/cross_process_frame_connector.h"
15 #include "content/browser/gpu/compositor_util.h" 15 #include "content/browser/gpu/compositor_util.h"
16 #include "content/browser/renderer_host/render_view_host_impl.h" 16 #include "content/browser/renderer_host/render_view_host_impl.h"
17 #include "content/browser/renderer_host/render_widget_host_delegate.h"
17 #include "content/browser/renderer_host/render_widget_host_impl.h" 18 #include "content/browser/renderer_host/render_widget_host_impl.h"
19 #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
18 #include "content/common/gpu/gpu_messages.h" 20 #include "content/common/gpu/gpu_messages.h"
19 #include "content/common/view_messages.h" 21 #include "content/common/view_messages.h"
20 #include "content/public/browser/render_process_host.h" 22 #include "content/public/browser/render_process_host.h"
21 #include "content/public/common/browser_plugin_guest_mode.h" 23 #include "content/public/common/browser_plugin_guest_mode.h"
22 24
23 namespace content { 25 namespace content {
24 26
25 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( 27 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
26 RenderWidgetHost* widget_host) 28 RenderWidgetHost* widget_host)
27 : host_(RenderWidgetHostImpl::From(widget_host)), 29 : host_(RenderWidgetHostImpl::From(widget_host)),
28 use_surfaces_(UseSurfacesEnabled()), 30 use_surfaces_(UseSurfacesEnabled()),
29 next_surface_sequence_(1u), 31 next_surface_sequence_(1u),
30 last_output_surface_id_(0), 32 last_output_surface_id_(0),
31 current_surface_scale_factor_(1.f), 33 current_surface_scale_factor_(1.f),
32 ack_pending_count_(0), 34 ack_pending_count_(0),
33 frame_connector_(nullptr), 35 frame_connector_(nullptr),
34 weak_factory_(this) { 36 weak_factory_(this) {
35 if (use_surfaces_) 37 if (use_surfaces_) {
36 id_allocator_ = CreateSurfaceIdAllocator(); 38 id_allocator_ = CreateSurfaceIdAllocator();
39 if (host_->delegate()->GetInputEventRouter()) {
40 host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner(
41 GetSurfaceIdNamespace(), this);
42 }
43 }
37 44
38 host_->SetView(this); 45 host_->SetView(this);
39 } 46 }
40 47
41 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { 48 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
42 if (!surface_id_.is_null()) 49 if (!surface_id_.is_null())
43 surface_factory_->Destroy(surface_id_); 50 surface_factory_->Destroy(surface_id_);
44 } 51 }
45 52
46 void RenderWidgetHostViewChildFrame::InitAsChild( 53 void RenderWidgetHostViewChildFrame::InitAsChild(
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 frame_connector_->RenderProcessGone(); 187 frame_connector_->RenderProcessGone();
181 Destroy(); 188 Destroy();
182 } 189 }
183 190
184 void RenderWidgetHostViewChildFrame::Destroy() { 191 void RenderWidgetHostViewChildFrame::Destroy() {
185 if (frame_connector_) { 192 if (frame_connector_) {
186 frame_connector_->set_view(NULL); 193 frame_connector_->set_view(NULL);
187 frame_connector_ = NULL; 194 frame_connector_ = NULL;
188 } 195 }
189 196
197 if (use_surfaces_ && host_->delegate()->GetInputEventRouter()) {
198 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner(
199 GetSurfaceIdNamespace());
200 }
201
190 host_->SetView(NULL); 202 host_->SetView(NULL);
191 host_ = NULL; 203 host_ = NULL;
192 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 204 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
193 } 205 }
194 206
195 void RenderWidgetHostViewChildFrame::SetTooltipText( 207 void RenderWidgetHostViewChildFrame::SetTooltipText(
196 const base::string16& tooltip_text) { 208 const base::string16& tooltip_text) {
197 } 209 }
198 210
199 void RenderWidgetHostViewChildFrame::SelectionChanged( 211 void RenderWidgetHostViewChildFrame::SelectionChanged(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 void RenderWidgetHostViewChildFrame::UnlockMouse() { 343 void RenderWidgetHostViewChildFrame::UnlockMouse() {
332 } 344 }
333 345
334 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() { 346 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() {
335 if (!use_surfaces_) 347 if (!use_surfaces_)
336 return 0; 348 return 0;
337 349
338 return id_allocator_->id_namespace(); 350 return id_allocator_->id_namespace();
339 } 351 }
340 352
353 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent(
354 const NativeWebKeyboardEvent& event) {
355 host_->ForwardKeyboardEvent(event);
356 }
357
358 void RenderWidgetHostViewChildFrame::ProcessMouseEvent(
359 const blink::WebMouseEvent& event) {
360 host_->ForwardMouseEvent(event);
361 }
362
363 void RenderWidgetHostViewChildFrame::ProcessMouseWheelEvent(
364 const blink::WebMouseWheelEvent& event) {
365 if (event.deltaX != 0 || event.deltaY != 0)
366 host_->ForwardWheelEvent(event);
367 }
368
341 #if defined(OS_MACOSX) 369 #if defined(OS_MACOSX)
342 void RenderWidgetHostViewChildFrame::SetActive(bool active) { 370 void RenderWidgetHostViewChildFrame::SetActive(bool active) {
343 } 371 }
344 372
345 void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) { 373 void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) {
346 } 374 }
347 375
348 void RenderWidgetHostViewChildFrame::WindowFrameChanged() { 376 void RenderWidgetHostViewChildFrame::WindowFrameChanged() {
349 } 377 }
350 378
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 BrowserAccessibilityManager::GetEmptyDocument(), delegate); 465 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
438 } 466 }
439 467
440 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { 468 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() {
441 if (surface_factory_ && !surface_id_.is_null()) 469 if (surface_factory_ && !surface_id_.is_null())
442 surface_factory_->Destroy(surface_id_); 470 surface_factory_->Destroy(surface_id_);
443 surface_id_ = cc::SurfaceId(); 471 surface_id_ = cc::SurfaceId();
444 } 472 }
445 473
446 } // namespace content 474 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698