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

Side by Side Diff: ui/views/cocoa/bridged_content_view.mm

Issue 891003004: MacViews: Implement SetCursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150129-MacViews-Bringup5
Patch Set: cl format Created 5 years, 10 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 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 - (id)initWithView:(views::View*)viewToHost { 75 - (id)initWithView:(views::View*)viewToHost {
76 DCHECK(viewToHost); 76 DCHECK(viewToHost);
77 gfx::Rect bounds = viewToHost->bounds(); 77 gfx::Rect bounds = viewToHost->bounds();
78 // To keep things simple, assume the origin is (0, 0) until there exists a use 78 // To keep things simple, assume the origin is (0, 0) until there exists a use
79 // case for something other than that. 79 // case for something other than that.
80 DCHECK(bounds.origin().IsOrigin()); 80 DCHECK(bounds.origin().IsOrigin());
81 NSRect initialFrame = NSMakeRect(0, 0, bounds.width(), bounds.height()); 81 NSRect initialFrame = NSMakeRect(0, 0, bounds.width(), bounds.height());
82 if ((self = [super initWithFrame:initialFrame])) { 82 if ((self = [super initWithFrame:initialFrame])) {
83 hostedView_ = viewToHost; 83 hostedView_ = viewToHost;
84 84
85 trackingArea_.reset( 85 // Apple's documentation says that NSTrackingActiveAlways is incompatible
86 [[CrTrackingArea alloc] initWithRect:NSZeroRect 86 // with NSTrackingCursorUpdate, so use NSTrackingActiveInActiveApp.
87 options:NSTrackingMouseMoved | 87 trackingArea_.reset([[CrTrackingArea alloc]
88 NSTrackingActiveAlways | 88 initWithRect:NSZeroRect
89 NSTrackingInVisibleRect 89 options:NSTrackingMouseMoved | NSTrackingCursorUpdate |
90 owner:self 90 NSTrackingActiveInActiveApp | NSTrackingInVisibleRect
91 userInfo:nil]); 91 owner:self
92 userInfo:nil]);
92 [self addTrackingArea:trackingArea_.get()]; 93 [self addTrackingArea:trackingArea_.get()];
93 } 94 }
94 return self; 95 return self;
95 } 96 }
96 97
97 - (void)clearView { 98 - (void)clearView {
98 hostedView_ = NULL; 99 hostedView_ = NULL;
99 [trackingArea_.get() clearOwner]; 100 [trackingArea_.get() clearOwner];
100 [self removeTrackingArea:trackingArea_.get()]; 101 [self removeTrackingArea:trackingArea_.get()];
101 } 102 }
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 573 }
573 574
574 return [super accessibilityAttributeValue:attribute]; 575 return [super accessibilityAttributeValue:attribute];
575 } 576 }
576 577
577 - (id)accessibilityHitTest:(NSPoint)point { 578 - (id)accessibilityHitTest:(NSPoint)point {
578 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; 579 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point];
579 } 580 }
580 581
581 @end 582 @end
OLDNEW
« no previous file with comments | « no previous file | ui/views/cocoa/bridged_native_widget.h » ('j') | ui/views/cocoa/views_nswindow_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698