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

Side by Side Diff: ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm

Issue 1917973002: mac: Remove IsOSLion(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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 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 #include "base/mac/sdk_forward_declarations.h" 10 #include "base/mac/sdk_forward_declarations.h"
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 @end 24 @end
25 25
26 @implementation ScrollViewWithNoScrollbars 26 @implementation ScrollViewWithNoScrollbars
27 27
28 @synthesize delegate = delegate_; 28 @synthesize delegate = delegate_;
29 29
30 - (id)initWithFrame:(NSRect)frame { 30 - (id)initWithFrame:(NSRect)frame {
31 if ((self = [super initWithFrame:frame])) { 31 if ((self = [super initWithFrame:frame])) {
32 [self setHasHorizontalScroller:base::mac::IsOSLionOrLater()]; 32 [self setHasHorizontalScroller:YES];
33 NSRect horizontalScrollerRect = [self bounds]; 33 NSRect horizontalScrollerRect = [self bounds];
34 horizontalScrollerRect.size.height = 0; 34 horizontalScrollerRect.size.height = 0;
35 base::scoped_nsobject<InvisibleScroller> horizontalScroller( 35 base::scoped_nsobject<InvisibleScroller> horizontalScroller(
36 [[InvisibleScroller alloc] initWithFrame:horizontalScrollerRect]); 36 [[InvisibleScroller alloc] initWithFrame:horizontalScrollerRect]);
37 [self setHorizontalScroller:horizontalScroller]; 37 [self setHorizontalScroller:horizontalScroller];
38 } 38 }
39 return self; 39 return self;
40 } 40 }
41 41
42 - (void)endGestureWithEvent:(NSEvent*)event {
43 [super endGestureWithEvent:event];
44 if (!base::mac::IsOSLionOrLater())
45 [delegate_ userScrolling:NO];
46 }
47
48 - (void)scrollWheel:(NSEvent*)event { 42 - (void)scrollWheel:(NSEvent*)event {
49 if ([event subtype] == NSMouseEventSubtype) { 43 if ([event subtype] == NSMouseEventSubtype) {
50 // Since the scroll view has no vertical scroller, regular up and down mouse 44 // Since the scroll view has no vertical scroller, regular up and down mouse
51 // wheel events would be ignored. This maps mouse wheel events to a 45 // wheel events would be ignored. This maps mouse wheel events to a
52 // horizontal scroll event of one line, to turn pages. 46 // horizontal scroll event of one line, to turn pages.
53 BOOL downOrRight; 47 BOOL downOrRight;
54 if ([event deltaX] != 0) 48 if ([event deltaX] != 0)
55 downOrRight = [event deltaX] > 0; 49 downOrRight = [event deltaX] > 0;
56 else if ([event deltaY] != 0) 50 else if ([event deltaY] != 0)
57 downOrRight = [event deltaY] > 0; 51 downOrRight = [event deltaY] > 0;
(...skipping 11 matching lines...) Expand all
69 return; 63 return;
70 64
71 BOOL scrollComplete = [event momentumPhase] == NSEventPhaseEnded || 65 BOOL scrollComplete = [event momentumPhase] == NSEventPhaseEnded ||
72 ([event momentumPhase] == NSEventPhaseNone && 66 ([event momentumPhase] == NSEventPhaseNone &&
73 [event phase] == NSEventPhaseEnded); 67 [event phase] == NSEventPhaseEnded);
74 68
75 [delegate_ userScrolling:!scrollComplete]; 69 [delegate_ userScrolling:!scrollComplete];
76 } 70 }
77 71
78 @end 72 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698