| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/app_list/cocoa/scroll_view_with_no_scrollbars.h" | 5 #include "ui/app_list/cocoa/scroll_view_with_no_scrollbars.h" |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 | 10 #include "base/mac/sdk_forward_declarations.h" |
| 11 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
| 12 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
| 13 | |
| 14 enum { | |
| 15 NSEventPhaseNone = 0, | |
| 16 NSEventPhaseBegan = 0x1 << 0, | |
| 17 NSEventPhaseStationary = 0x1 << 1, | |
| 18 NSEventPhaseChanged = 0x1 << 2, | |
| 19 NSEventPhaseEnded = 0x1 << 3, | |
| 20 NSEventPhaseCancelled = 0x1 << 4, | |
| 21 }; | |
| 22 typedef NSUInteger NSEventPhase; | |
| 23 | |
| 24 @interface NSEvent (LionAPI) | |
| 25 | |
| 26 - (NSEventPhase)momentumPhase; | |
| 27 - (NSEventPhase)phase; | |
| 28 | |
| 29 @end | |
| 30 | |
| 31 #endif // 10.7 | |
| 32 | 11 |
| 33 @interface InvisibleScroller : NSScroller; | 12 @interface InvisibleScroller : NSScroller; |
| 34 @end | 13 @end |
| 35 | 14 |
| 36 @implementation InvisibleScroller | 15 @implementation InvisibleScroller |
| 37 | 16 |
| 38 // Makes it non-interactive (and invisible) on Lion with both 10.6 and 10.7 | 17 // Makes it non-interactive (and invisible) on Lion with both 10.6 and 10.7 |
| 39 // SDKs. TODO(tapted): Find a way to make it non-interactive on Snow Leopard. | 18 // SDKs. TODO(tapted): Find a way to make it non-interactive on Snow Leopard. |
| 40 // TODO(tapted): Find a way to make it take up no space on Lion with a 10.6 SDK. | 19 // TODO(tapted): Find a way to make it take up no space on Lion with a 10.6 SDK. |
| 41 - (NSRect)rectForPart:(NSScrollerPart)aPart { | 20 - (NSRect)rectForPart:(NSScrollerPart)aPart { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return; | 69 return; |
| 91 | 70 |
| 92 BOOL scrollComplete = [event momentumPhase] == NSEventPhaseEnded || | 71 BOOL scrollComplete = [event momentumPhase] == NSEventPhaseEnded || |
| 93 ([event momentumPhase] == NSEventPhaseNone && | 72 ([event momentumPhase] == NSEventPhaseNone && |
| 94 [event phase] == NSEventPhaseEnded); | 73 [event phase] == NSEventPhaseEnded); |
| 95 | 74 |
| 96 [delegate_ userScrolling:!scrollComplete]; | 75 [delegate_ userScrolling:!scrollComplete]; |
| 97 } | 76 } |
| 98 | 77 |
| 99 @end | 78 @end |
| OLD | NEW |