OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "app/theme_provider.h" | 7 #include "app/theme_provider.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/scoped_nsobject.h" | 9 #include "base/scoped_nsobject.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 @end | 46 @end |
47 | 47 |
48 | 48 |
49 // NSCell that is pre-provided with a desired size that becomes the | 49 // NSCell that is pre-provided with a desired size that becomes the |
50 // return value for -(NSSize)cellSize:. | 50 // return value for -(NSSize)cellSize:. |
51 @interface CellWithDesiredSize : NSCell { | 51 @interface CellWithDesiredSize : NSCell { |
52 @private | 52 @private |
53 NSSize cellSize_; | 53 NSSize cellSize_; |
54 } | 54 } |
55 @property(readonly) NSSize cellSize; | 55 @property (nonatomic, readonly) NSSize cellSize; |
56 @end | 56 @end |
57 | 57 |
58 @implementation CellWithDesiredSize | 58 @implementation CellWithDesiredSize |
59 | 59 |
60 @synthesize cellSize = cellSize_; | 60 @synthesize cellSize = cellSize_; |
61 | 61 |
62 - (id)initTextCell:(NSString*)string desiredSize:(NSSize)size { | 62 - (id)initTextCell:(NSString*)string desiredSize:(NSSize)size { |
63 if ((self = [super initTextCell:string])) { | 63 if ((self = [super initTextCell:string])) { |
64 cellSize_ = size; | 64 cellSize_ = size; |
65 } | 65 } |
66 return self; | 66 return self; |
67 } | 67 } |
68 | 68 |
69 @end | 69 @end |
70 | 70 |
71 // Remember the number of times we've gotten a frameDidChange notification. | 71 // Remember the number of times we've gotten a frameDidChange notification. |
72 @interface BookmarkBarControllerTogglePong : BookmarkBarControllerNoOpen { | 72 @interface BookmarkBarControllerTogglePong : BookmarkBarControllerNoOpen { |
73 @private | 73 @private |
74 int toggles_; | 74 int toggles_; |
75 } | 75 } |
76 @property (readonly) int toggles; | 76 @property (nonatomic, readonly) int toggles; |
77 @end | 77 @end |
78 | 78 |
79 @implementation BookmarkBarControllerTogglePong | 79 @implementation BookmarkBarControllerTogglePong |
80 | 80 |
81 @synthesize toggles = toggles_; | 81 @synthesize toggles = toggles_; |
82 | 82 |
83 - (void)frameDidChange { | 83 - (void)frameDidChange { |
84 toggles_++; | 84 toggles_++; |
85 } | 85 } |
86 | 86 |
87 @end | 87 @end |
88 | 88 |
89 // Remembers if a notification callback was called. | 89 // Remembers if a notification callback was called. |
90 @interface BookmarkBarControllerNotificationPong : BookmarkBarControllerNoOpen { | 90 @interface BookmarkBarControllerNotificationPong : BookmarkBarControllerNoOpen { |
91 BOOL windowWillCloseReceived_; | 91 BOOL windowWillCloseReceived_; |
92 BOOL windowDidResignKeyReceived_; | 92 BOOL windowDidResignKeyReceived_; |
93 } | 93 } |
94 @property(readonly) BOOL windowWillCloseReceived; | 94 @property (nonatomic, readonly) BOOL windowWillCloseReceived; |
95 @property(readonly) BOOL windowDidResignKeyReceived; | 95 @property (nonatomic, readonly) BOOL windowDidResignKeyReceived; |
96 @end | 96 @end |
97 | 97 |
98 @implementation BookmarkBarControllerNotificationPong | 98 @implementation BookmarkBarControllerNotificationPong |
99 @synthesize windowWillCloseReceived = windowWillCloseReceived_; | 99 @synthesize windowWillCloseReceived = windowWillCloseReceived_; |
100 @synthesize windowDidResignKeyReceived = windowDidResignKeyReceived_; | 100 @synthesize windowDidResignKeyReceived = windowDidResignKeyReceived_; |
101 | 101 |
102 // Override NSNotificationCenter callback. | 102 // Override NSNotificationCenter callback. |
103 - (void)parentWindowWillClose:(NSNotification*)notification { | 103 - (void)parentWindowWillClose:(NSNotification*)notification { |
104 windowWillCloseReceived_ = YES; | 104 windowWillCloseReceived_ = YES; |
105 } | 105 } |
106 | 106 |
107 // NSNotificationCenter callback. | 107 // NSNotificationCenter callback. |
108 - (void)parentWindowDidResignKey:(NSNotification*)notification { | 108 - (void)parentWindowDidResignKey:(NSNotification*)notification { |
109 windowDidResignKeyReceived_ = YES; | 109 windowDidResignKeyReceived_ = YES; |
110 } | 110 } |
111 @end | 111 @end |
112 | 112 |
113 // Remembers if and what kind of openAll was performed. | 113 // Remembers if and what kind of openAll was performed. |
114 @interface BookmarkBarControllerOpenAllPong : BookmarkBarControllerNoOpen { | 114 @interface BookmarkBarControllerOpenAllPong : BookmarkBarControllerNoOpen { |
115 WindowOpenDisposition dispositionDetected_; | 115 WindowOpenDisposition dispositionDetected_; |
116 } | 116 } |
117 @property WindowOpenDisposition dispositionDetected; | 117 @property (nonatomic) WindowOpenDisposition dispositionDetected; |
118 @end | 118 @end |
119 | 119 |
120 @implementation BookmarkBarControllerOpenAllPong | 120 @implementation BookmarkBarControllerOpenAllPong |
121 @synthesize dispositionDetected = dispositionDetected_; | 121 @synthesize dispositionDetected = dispositionDetected_; |
122 | 122 |
123 // Intercede for the openAll:disposition: method. | 123 // Intercede for the openAll:disposition: method. |
124 - (void)openAll:(const BookmarkNode*)node | 124 - (void)openAll:(const BookmarkNode*)node |
125 disposition:(WindowOpenDisposition)disposition { | 125 disposition:(WindowOpenDisposition)disposition { |
126 [self setDispositionDetected:disposition]; | 126 [self setDispositionDetected:disposition]; |
127 } | 127 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 return nil; | 194 return nil; |
195 } | 195 } |
196 }; | 196 }; |
197 | 197 |
198 | 198 |
199 @interface FakeDragInfo : NSObject { | 199 @interface FakeDragInfo : NSObject { |
200 @public | 200 @public |
201 NSPoint dropLocation_; | 201 NSPoint dropLocation_; |
202 NSDragOperation sourceMask_; | 202 NSDragOperation sourceMask_; |
203 } | 203 } |
204 @property (assign) NSPoint dropLocation; | 204 @property (nonatomic, assign) NSPoint dropLocation; |
205 - (void)setDraggingSourceOperationMask:(NSDragOperation)mask; | 205 - (void)setDraggingSourceOperationMask:(NSDragOperation)mask; |
206 @end | 206 @end |
207 | 207 |
208 @implementation FakeDragInfo | 208 @implementation FakeDragInfo |
209 | 209 |
210 @synthesize dropLocation = dropLocation_; | 210 @synthesize dropLocation = dropLocation_; |
211 | 211 |
212 - (id)init { | 212 - (id)init { |
213 if ((self = [super init])) { | 213 if ((self = [super init])) { |
214 dropLocation_ = NSZeroPoint; | 214 dropLocation_ = NSZeroPoint; |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1975 EXPECT_CGFLOAT_EQ(expected, actual); | 1975 EXPECT_CGFLOAT_EQ(expected, actual); |
1976 targetButton = [bar_ buttonWithTitleEqualTo:@"4b"]; | 1976 targetButton = [bar_ buttonWithTitleEqualTo:@"4b"]; |
1977 targetPoint = [targetButton right]; | 1977 targetPoint = [targetButton right]; |
1978 targetPoint.x += 100; // Somewhere off to the right. | 1978 targetPoint.x += 100; // Somewhere off to the right. |
1979 expected = NSMaxX([targetButton frame]) + xDelta; | 1979 expected = NSMaxX([targetButton frame]) + xDelta; |
1980 actual = [bar_ indicatorPosForDragToPoint:targetPoint]; | 1980 actual = [bar_ indicatorPosForDragToPoint:targetPoint]; |
1981 EXPECT_CGFLOAT_EQ(expected, actual); | 1981 EXPECT_CGFLOAT_EQ(expected, actual); |
1982 } | 1982 } |
1983 | 1983 |
1984 } // namespace | 1984 } // namespace |
OLD | NEW |