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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2382873002: Replace usage of SurfaceId's client_id with FrameSinkId (Closed)
Patch Set: Rebased Created 4 years, 2 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/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <OpenGL/gl.h> 8 #include <OpenGL/gl.h>
9 #include <QuartzCore/QuartzCore.h> 9 #include <QuartzCore/QuartzCore.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 display::Screen::GetScreen()->AddObserver(this); 478 display::Screen::GetScreen()->AddObserver(this);
479 479
480 if (!is_guest_view_hack_) 480 if (!is_guest_view_hack_)
481 render_widget_host_->SetView(this); 481 render_widget_host_->SetView(this);
482 482
483 // Let the page-level input event router know about our surface ID 483 // Let the page-level input event router know about our surface ID
484 // namespace for surface-based hit testing. 484 // namespace for surface-based hit testing.
485 if (render_widget_host_->delegate() && 485 if (render_widget_host_->delegate() &&
486 render_widget_host_->delegate()->GetInputEventRouter()) { 486 render_widget_host_->delegate()->GetInputEventRouter()) {
487 render_widget_host_->delegate() 487 render_widget_host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner(
488 ->GetInputEventRouter() 488 GetFrameSinkId(), this);
489 ->AddSurfaceClientIdOwner(GetSurfaceClientId(), this);
490 } 489 }
491 490
492 RenderViewHost* rvh = RenderViewHost::From(render_widget_host_); 491 RenderViewHost* rvh = RenderViewHost::From(render_widget_host_);
493 if (rvh) { 492 if (rvh) {
494 // TODO(mostynb): actually use prefs. Landing this as a separate CL 493 // TODO(mostynb): actually use prefs. Landing this as a separate CL
495 // first to rebaseline some unreliable layout tests. 494 // first to rebaseline some unreliable layout tests.
496 ignore_result(rvh->GetWebkitPreferences()); 495 ignore_result(rvh->GetWebkitPreferences());
497 } 496 }
498 497
499 if (GetTextInputManager()) 498 if (GetTextInputManager())
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 selection_range_ = selection->range; 1006 selection_range_ = selection->range;
1008 selection_text_offset_ = selection->offset; 1007 selection_text_offset_ = selection->offset;
1009 } 1008 }
1010 1009
1011 void RenderWidgetHostViewMac::RenderProcessGone(base::TerminationStatus status, 1010 void RenderWidgetHostViewMac::RenderProcessGone(base::TerminationStatus status,
1012 int error_code) { 1011 int error_code) {
1013 Destroy(); 1012 Destroy();
1014 } 1013 }
1015 1014
1016 void RenderWidgetHostViewMac::Destroy() { 1015 void RenderWidgetHostViewMac::Destroy() {
1017 // SurfaceClientIds registered with RenderWidgetHostInputEventRouter 1016 // FrameSinkIds registered with RenderWidgetHostInputEventRouter
1018 // have already been cleared when RenderWidgetHostViewBase notified its 1017 // have already been cleared when RenderWidgetHostViewBase notified its
1019 // observers of our impending destruction. 1018 // observers of our impending destruction.
1020 [[NSNotificationCenter defaultCenter] 1019 [[NSNotificationCenter defaultCenter]
1021 removeObserver:cocoa_view_ 1020 removeObserver:cocoa_view_
1022 name:NSWindowWillCloseNotification 1021 name:NSWindowWillCloseNotification
1023 object:popup_window_]; 1022 object:popup_window_];
1024 1023
1025 // We've been told to destroy. 1024 // We've been told to destroy.
1026 [cocoa_view_ retain]; 1025 [cocoa_view_ retain];
1027 [cocoa_view_ removeFromSuperview]; 1026 [cocoa_view_ removeFromSuperview];
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 } 1478 }
1480 1479
1481 std::unique_ptr<SyntheticGestureTarget> 1480 std::unique_ptr<SyntheticGestureTarget>
1482 RenderWidgetHostViewMac::CreateSyntheticGestureTarget() { 1481 RenderWidgetHostViewMac::CreateSyntheticGestureTarget() {
1483 RenderWidgetHostImpl* host = 1482 RenderWidgetHostImpl* host =
1484 RenderWidgetHostImpl::From(GetRenderWidgetHost()); 1483 RenderWidgetHostImpl::From(GetRenderWidgetHost());
1485 return std::unique_ptr<SyntheticGestureTarget>( 1484 return std::unique_ptr<SyntheticGestureTarget>(
1486 new SyntheticGestureTargetMac(host, cocoa_view_)); 1485 new SyntheticGestureTargetMac(host, cocoa_view_));
1487 } 1486 }
1488 1487
1489 uint32_t RenderWidgetHostViewMac::GetSurfaceClientId() { 1488 cc::FrameSinkId RenderWidgetHostViewMac::GetFrameSinkId() {
1490 return browser_compositor_->GetDelegatedFrameHost()->GetSurfaceClientId(); 1489 return browser_compositor_->GetDelegatedFrameHost()->GetFrameSinkId();
1491 } 1490 }
1492 1491
1493 uint32_t RenderWidgetHostViewMac::SurfaceClientIdAtPoint( 1492 cc::FrameSinkId RenderWidgetHostViewMac::FrameSinkIdAtPoint(
1494 cc::SurfaceHittestDelegate* delegate, 1493 cc::SurfaceHittestDelegate* delegate,
1495 const gfx::Point& point, 1494 const gfx::Point& point,
1496 gfx::Point* transformed_point) { 1495 gfx::Point* transformed_point) {
1497 // The surface hittest happens in device pixels, so we need to convert the 1496 // The surface hittest happens in device pixels, so we need to convert the
1498 // |point| from DIPs to pixels before hittesting. 1497 // |point| from DIPs to pixels before hittesting.
1499 float scale_factor = display::Screen::GetScreen() 1498 float scale_factor = display::Screen::GetScreen()
1500 ->GetDisplayNearestWindow(cocoa_view_) 1499 ->GetDisplayNearestWindow(cocoa_view_)
1501 .device_scale_factor(); 1500 .device_scale_factor();
1502 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); 1501 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point);
1503 cc::SurfaceId id = 1502 cc::SurfaceId id =
1504 browser_compositor_->GetDelegatedFrameHost()->SurfaceIdAtPoint( 1503 browser_compositor_->GetDelegatedFrameHost()->SurfaceIdAtPoint(
1505 delegate, point_in_pixels, transformed_point); 1504 delegate, point_in_pixels, transformed_point);
1506 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point); 1505 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point);
1507 1506
1508 // It is possible that the renderer has not yet produced a surface, in which 1507 // It is possible that the renderer has not yet produced a surface, in which
1509 // case we return our current namespace. 1508 // case we return our current namespace.
1510 if (id.is_null()) 1509 if (id.is_null())
1511 return GetSurfaceClientId(); 1510 return GetFrameSinkId();
1512 return id.client_id(); 1511 return id.frame_sink_id();
1513 } 1512 }
1514 1513
1515 bool RenderWidgetHostViewMac::ShouldRouteEvent( 1514 bool RenderWidgetHostViewMac::ShouldRouteEvent(
1516 const WebInputEvent& event) const { 1515 const WebInputEvent& event) const {
1517 // See also RenderWidgetHostViewAura::ShouldRouteEvent. 1516 // See also RenderWidgetHostViewAura::ShouldRouteEvent.
1518 // TODO(wjmaclean): Update this function if RenderWidgetHostViewMac implements 1517 // TODO(wjmaclean): Update this function if RenderWidgetHostViewMac implements
1519 // OnTouchEvent(), to match what we are doing in RenderWidgetHostViewAura. 1518 // OnTouchEvent(), to match what we are doing in RenderWidgetHostViewAura.
1520 DCHECK(WebInputEvent::isMouseEventType(event.type) || 1519 DCHECK(WebInputEvent::isMouseEventType(event.type) ||
1521 event.type == WebInputEvent::MouseWheel); 1520 event.type == WebInputEvent::MouseWheel);
1522 return render_widget_host_->delegate() && 1521 return render_widget_host_->delegate() &&
(...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after
3389 3388
3390 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3389 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3391 // regions that are not draggable. (See ControlRegionView in 3390 // regions that are not draggable. (See ControlRegionView in
3392 // native_app_window_cocoa.mm). This requires the render host view to be 3391 // native_app_window_cocoa.mm). This requires the render host view to be
3393 // draggable by default. 3392 // draggable by default.
3394 - (BOOL)mouseDownCanMoveWindow { 3393 - (BOOL)mouseDownCanMoveWindow {
3395 return YES; 3394 return YES;
3396 } 3395 }
3397 3396
3398 @end 3397 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698