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

Side by Side Diff: ui/base/cocoa/hover_button.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/base/cocoa/hover_button.h" 5 #import "ui/base/cocoa/hover_button.h"
6 6
7 @implementation HoverButton 7 @implementation HoverButton
8 8
9 @synthesize hoverState = hoverState_; 9 @synthesize hoverState = hoverState_;
10 10
(...skipping 26 matching lines...) Expand all
37 if (trackingArea_.get()) 37 if (trackingArea_.get())
38 self.hoverState = kHoverStateNone; 38 self.hoverState = kHoverStateNone;
39 } 39 }
40 40
41 - (void)mouseDown:(NSEvent*)theEvent { 41 - (void)mouseDown:(NSEvent*)theEvent {
42 self.hoverState = kHoverStateMouseDown; 42 self.hoverState = kHoverStateMouseDown;
43 // The hover button needs to hold onto itself here for a bit. Otherwise, 43 // The hover button needs to hold onto itself here for a bit. Otherwise,
44 // it can be freed while |super mouseDown:| is in its loop, and the 44 // it can be freed while |super mouseDown:| is in its loop, and the
45 // |checkImageState| call will crash. 45 // |checkImageState| call will crash.
46 // http://crbug.com/28220 46 // http://crbug.com/28220
47 scoped_nsobject<HoverButton> myself([self retain]); 47 base::scoped_nsobject<HoverButton> myself([self retain]);
48 48
49 [super mouseDown:theEvent]; 49 [super mouseDown:theEvent];
50 // We need to check the image state after the mouseDown event loop finishes. 50 // We need to check the image state after the mouseDown event loop finishes.
51 // It's possible that we won't get a mouseExited event if the button was 51 // It's possible that we won't get a mouseExited event if the button was
52 // moved under the mouse during tab resize, instead of the mouse moving over 52 // moved under the mouse during tab resize, instead of the mouse moving over
53 // the button. 53 // the button.
54 // http://crbug.com/31279 54 // http://crbug.com/31279
55 [self checkImageState]; 55 [self checkImageState];
56 } 56 }
57 57
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 self.hoverState = NSPointInRect(mouseLoc, [self bounds]) ? 99 self.hoverState = NSPointInRect(mouseLoc, [self bounds]) ?
100 kHoverStateMouseOver : kHoverStateNone; 100 kHoverStateMouseOver : kHoverStateNone;
101 } 101 }
102 102
103 - (void)setHoverState:(HoverState)state { 103 - (void)setHoverState:(HoverState)state {
104 hoverState_ = state; 104 hoverState_ = state;
105 [self setNeedsDisplay:YES]; 105 [self setNeedsDisplay:YES];
106 } 106 }
107 107
108 @end 108 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698