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 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 } // namespace content | 1696 } // namespace content |
1697 | 1697 |
1698 // RenderWidgetHostViewCocoa --------------------------------------------------- | 1698 // RenderWidgetHostViewCocoa --------------------------------------------------- |
1699 | 1699 |
1700 @implementation RenderWidgetHostViewCocoa | 1700 @implementation RenderWidgetHostViewCocoa |
1701 @synthesize selectedRange = selectedRange_; | 1701 @synthesize selectedRange = selectedRange_; |
1702 @synthesize suppressNextEscapeKeyUp = suppressNextEscapeKeyUp_; | 1702 @synthesize suppressNextEscapeKeyUp = suppressNextEscapeKeyUp_; |
1703 @synthesize markedRange = markedRange_; | 1703 @synthesize markedRange = markedRange_; |
1704 | 1704 |
1705 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r { | 1705 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r { |
1706 self = [super initWithFrame:NSZeroRect]; | 1706 self = [super initWithFrame:NSZeroRect wantsReliableMouseEvents:YES]; |
1707 if (self) { | 1707 if (self) { |
1708 self.acceptsTouchEvents = YES; | 1708 self.acceptsTouchEvents = YES; |
1709 editCommand_helper_.reset(new RenderWidgetHostViewMacEditCommandHelper); | 1709 editCommand_helper_.reset(new RenderWidgetHostViewMacEditCommandHelper); |
1710 editCommand_helper_->AddEditingSelectorsToClass([self class]); | 1710 editCommand_helper_->AddEditingSelectorsToClass([self class]); |
1711 | 1711 |
1712 renderWidgetHostView_.reset(r); | 1712 renderWidgetHostView_.reset(r); |
1713 canBeKeyView_ = YES; | 1713 canBeKeyView_ = YES; |
1714 opaque_ = YES; | 1714 opaque_ = YES; |
1715 focusedPluginIdentifier_ = -1; | 1715 focusedPluginIdentifier_ = -1; |
1716 | 1716 |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3156 | 3156 |
3157 // Inserting text will delete all marked text automatically. | 3157 // Inserting text will delete all marked text automatically. |
3158 hasMarkedText_ = NO; | 3158 hasMarkedText_ = NO; |
3159 } | 3159 } |
3160 | 3160 |
3161 - (void)insertText:(id)string { | 3161 - (void)insertText:(id)string { |
3162 [self insertText:string replacementRange:NSMakeRange(NSNotFound, 0)]; | 3162 [self insertText:string replacementRange:NSMakeRange(NSNotFound, 0)]; |
3163 } | 3163 } |
3164 | 3164 |
3165 - (void)viewDidMoveToWindow { | 3165 - (void)viewDidMoveToWindow { |
| 3166 [super viewDidMoveToWindow]; |
| 3167 |
3166 if ([self window]) { | 3168 if ([self window]) { |
3167 [self updateScreenProperties]; | 3169 [self updateScreenProperties]; |
3168 } else { | 3170 } else { |
3169 // If the RenderWidgetHostViewCocoa is being removed from its window, tear | 3171 // If the RenderWidgetHostViewCocoa is being removed from its window, tear |
3170 // down its browser compositor resources, if needed. | 3172 // down its browser compositor resources, if needed. |
3171 renderWidgetHostView_->DestroySuspendedBrowserCompositorViewIfNeeded(); | 3173 renderWidgetHostView_->DestroySuspendedBrowserCompositorViewIfNeeded(); |
3172 } | 3174 } |
3173 | 3175 |
3174 if (canBeKeyView_) { | 3176 if (canBeKeyView_) { |
3175 NSWindow* newWindow = [self window]; | 3177 NSWindow* newWindow = [self window]; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3423 | 3425 |
3424 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3426 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3425 // regions that are not draggable. (See ControlRegionView in | 3427 // regions that are not draggable. (See ControlRegionView in |
3426 // native_app_window_cocoa.mm). This requires the render host view to be | 3428 // native_app_window_cocoa.mm). This requires the render host view to be |
3427 // draggable by default. | 3429 // draggable by default. |
3428 - (BOOL)mouseDownCanMoveWindow { | 3430 - (BOOL)mouseDownCanMoveWindow { |
3429 return YES; | 3431 return YES; |
3430 } | 3432 } |
3431 | 3433 |
3432 @end | 3434 @end |
OLD | NEW |