| 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 <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 | 10 |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 software_frame_weak_ptr_factory_.GetWeakPtr())); | 468 software_frame_weak_ptr_factory_.GetWeakPtr())); |
| 469 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| | 469 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| |
| 470 // goes away. Since we autorelease it, our caller must put | 470 // goes away. Since we autorelease it, our caller must put |
| 471 // |GetNativeView()| into the view hierarchy right after calling us. | 471 // |GetNativeView()| into the view hierarchy right after calling us. |
| 472 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] | 472 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] |
| 473 initWithRenderWidgetHostViewMac:this] autorelease]; | 473 initWithRenderWidgetHostViewMac:this] autorelease]; |
| 474 | 474 |
| 475 background_layer_.reset([[CALayer alloc] init]); | 475 background_layer_.reset([[CALayer alloc] init]); |
| 476 [background_layer_ | 476 [background_layer_ |
| 477 setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; | 477 setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; |
| 478 [background_layer_ | |
| 479 setAutoresizingMask:kCALayerWidthSizable|kCALayerHeightSizable]; | |
| 480 [background_layer_ setGeometryFlipped:YES]; | 478 [background_layer_ setGeometryFlipped:YES]; |
| 481 [background_layer_ setContentsGravity:kCAGravityTopLeft]; | 479 [background_layer_ setContentsGravity:kCAGravityTopLeft]; |
| 482 [cocoa_view_ setLayer:background_layer_]; | 480 [cocoa_view_ setLayer:background_layer_]; |
| 483 [cocoa_view_ setWantsLayer:YES]; | 481 [cocoa_view_ setWantsLayer:YES]; |
| 484 | 482 |
| 485 render_widget_host_->SetView(this); | 483 render_widget_host_->SetView(this); |
| 486 } | 484 } |
| 487 | 485 |
| 488 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { | 486 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { |
| 489 // This is being called from |cocoa_view_|'s destructor, so invalidate the | 487 // This is being called from |cocoa_view_|'s destructor, so invalidate the |
| (...skipping 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3969 | 3967 |
| 3970 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3968 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3971 // regions that are not draggable. (See ControlRegionView in | 3969 // regions that are not draggable. (See ControlRegionView in |
| 3972 // native_app_window_cocoa.mm). This requires the render host view to be | 3970 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3973 // draggable by default. | 3971 // draggable by default. |
| 3974 - (BOOL)mouseDownCanMoveWindow { | 3972 - (BOOL)mouseDownCanMoveWindow { |
| 3975 return YES; | 3973 return YES; |
| 3976 } | 3974 } |
| 3977 | 3975 |
| 3978 @end | 3976 @end |
| OLD | NEW |