OLD | NEW |
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 <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
8 #import <objc/runtime.h> | 8 #import <objc/runtime.h> |
9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
10 #include <QuartzCore/QuartzCore.h> | 10 #include <QuartzCore/QuartzCore.h> |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 // Paint this view host with |background_color_| when there is no content | 464 // Paint this view host with |background_color_| when there is no content |
465 // ready to draw. | 465 // ready to draw. |
466 background_layer_.reset([[CALayer alloc] init]); | 466 background_layer_.reset([[CALayer alloc] init]); |
467 // Set the default color to be white. This is the wrong thing to do, but many | 467 // Set the default color to be white. This is the wrong thing to do, but many |
468 // UI components expect this view to be opaque. | 468 // UI components expect this view to be opaque. |
469 [background_layer_ setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; | 469 [background_layer_ setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; |
470 [cocoa_view_ setLayer:background_layer_]; | 470 [cocoa_view_ setLayer:background_layer_]; |
471 [cocoa_view_ setWantsLayer:YES]; | 471 [cocoa_view_ setWantsLayer:YES]; |
472 | 472 |
473 // GuestViews have two RenderWidgetHostViews and so we need to make sure | |
474 // we don't have FrameSinkId collisions. | |
475 // The FrameSinkId generated here must be unique with FrameSinkId allocated | |
476 // in ContextFactoryPrivate. | |
477 // TODO(crbug.com/685777): Centralize allocation in one place for easier | |
478 // maintenance. | |
479 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | |
480 cc::FrameSinkId frame_sink_id = | 473 cc::FrameSinkId frame_sink_id = |
481 is_guest_view_hack_ | 474 render_widget_host_->AllocateFrameSinkId(is_guest_view_hack_); |
482 ? factory->GetContextFactoryPrivate()->AllocateFrameSinkId() | |
483 : cc::FrameSinkId(base::checked_cast<uint32_t>( | |
484 render_widget_host_->GetProcess()->GetID()), | |
485 base::checked_cast<uint32_t>( | |
486 render_widget_host_->GetRoutingID())); | |
487 browser_compositor_.reset( | 475 browser_compositor_.reset( |
488 new BrowserCompositorMac(this, this, render_widget_host_->is_hidden(), | 476 new BrowserCompositorMac(this, this, render_widget_host_->is_hidden(), |
489 [cocoa_view_ window], frame_sink_id)); | 477 [cocoa_view_ window], frame_sink_id)); |
490 | 478 |
491 display::Screen::GetScreen()->AddObserver(this); | 479 display::Screen::GetScreen()->AddObserver(this); |
492 | 480 |
493 if (!is_guest_view_hack_) | 481 if (!is_guest_view_hack_) |
494 render_widget_host_->SetView(this); | 482 render_widget_host_->SetView(this); |
495 | 483 |
496 // Let the page-level input event router know about our surface ID | 484 // Let the page-level input event router know about our surface ID |
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3473 | 3461 |
3474 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3462 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3475 // regions that are not draggable. (See ControlRegionView in | 3463 // regions that are not draggable. (See ControlRegionView in |
3476 // native_app_window_cocoa.mm). This requires the render host view to be | 3464 // native_app_window_cocoa.mm). This requires the render host view to be |
3477 // draggable by default. | 3465 // draggable by default. |
3478 - (BOOL)mouseDownCanMoveWindow { | 3466 - (BOOL)mouseDownCanMoveWindow { |
3479 return YES; | 3467 return YES; |
3480 } | 3468 } |
3481 | 3469 |
3482 @end | 3470 @end |
OLD | NEW |