| OLD | NEW |
| 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 #import "ui/views/cocoa/bridged_content_view.h" | 5 #import "ui/views/cocoa/bridged_content_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "ui/base/ime/text_input_client.h" | 10 #include "ui/base/ime/text_input_client.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 - (id)initWithView:(views::View*)viewToHost { | 72 - (id)initWithView:(views::View*)viewToHost { |
| 73 DCHECK(viewToHost); | 73 DCHECK(viewToHost); |
| 74 gfx::Rect bounds = viewToHost->bounds(); | 74 gfx::Rect bounds = viewToHost->bounds(); |
| 75 // To keep things simple, assume the origin is (0, 0) until there exists a use | 75 // To keep things simple, assume the origin is (0, 0) until there exists a use |
| 76 // case for something other than that. | 76 // case for something other than that. |
| 77 DCHECK(bounds.origin().IsOrigin()); | 77 DCHECK(bounds.origin().IsOrigin()); |
| 78 NSRect initialFrame = NSMakeRect(0, 0, bounds.width(), bounds.height()); | 78 NSRect initialFrame = NSMakeRect(0, 0, bounds.width(), bounds.height()); |
| 79 if ((self = [super initWithFrame:initialFrame])) { | 79 if ((self = [super initWithFrame:initialFrame])) { |
| 80 hostedView_ = viewToHost; | 80 hostedView_ = viewToHost; |
| 81 | 81 |
| 82 trackingArea_.reset( | 82 // Apple's documentation says that NSTrackingActiveAlways is incompatible |
| 83 [[CrTrackingArea alloc] initWithRect:NSZeroRect | 83 // with NSTrackingCursorUpdate, so use NSTrackingActiveInActiveApp. |
| 84 options:NSTrackingMouseMoved | | 84 trackingArea_.reset([[CrTrackingArea alloc] |
| 85 NSTrackingActiveAlways | | 85 initWithRect:NSZeroRect |
| 86 NSTrackingInVisibleRect | 86 options:NSTrackingMouseMoved | NSTrackingCursorUpdate | |
| 87 owner:self | 87 NSTrackingActiveInActiveApp | NSTrackingInVisibleRect |
| 88 userInfo:nil]); | 88 owner:self |
| 89 userInfo:nil]); |
| 89 [self addTrackingArea:trackingArea_.get()]; | 90 [self addTrackingArea:trackingArea_.get()]; |
| 90 } | 91 } |
| 91 return self; | 92 return self; |
| 92 } | 93 } |
| 93 | 94 |
| 94 - (void)clearView { | 95 - (void)clearView { |
| 95 hostedView_ = NULL; | 96 hostedView_ = NULL; |
| 96 [trackingArea_.get() clearOwner]; | 97 [trackingArea_.get() clearOwner]; |
| 97 [self removeTrackingArea:trackingArea_.get()]; | 98 [self removeTrackingArea:trackingArea_.get()]; |
| 98 } | 99 } |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 532 } |
| 532 | 533 |
| 533 return [super accessibilityAttributeValue:attribute]; | 534 return [super accessibilityAttributeValue:attribute]; |
| 534 } | 535 } |
| 535 | 536 |
| 536 - (id)accessibilityHitTest:(NSPoint)point { | 537 - (id)accessibilityHitTest:(NSPoint)point { |
| 537 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; | 538 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; |
| 538 } | 539 } |
| 539 | 540 |
| 540 @end | 541 @end |
| OLD | NEW |