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

Unified Diff: ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm

Issue 2131463002: Purge the App Launcher code from Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Zap mac-specific icon assets Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm
diff --git a/ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm b/ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm
deleted file mode 100644
index d4cff30a462a47bfd98b5e282f382cb42a2d5f97..0000000000000000000000000000000000000000
--- a/ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/app_list/cocoa/scroll_view_with_no_scrollbars.h"
-
-#include "base/mac/scoped_cftyperef.h"
-#include "base/mac/scoped_nsobject.h"
-#include "base/mac/sdk_forward_declarations.h"
-
-@interface InvisibleScroller : NSScroller;
-@end
-
-@implementation InvisibleScroller
-
-// Makes it non-interactive (and invisible) on Lion with both 10.6 and 10.7
-// SDKs. TODO(tapted): Find a way to make it non-interactive on Snow Leopard.
-// TODO(tapted): Find a way to make it take up no space on Lion with a 10.6 SDK.
-- (NSRect)rectForPart:(NSScrollerPart)aPart {
- return NSZeroRect;
-}
-
-@end
-
-@implementation ScrollViewWithNoScrollbars
-
-@synthesize delegate = delegate_;
-
-- (id)initWithFrame:(NSRect)frame {
- if ((self = [super initWithFrame:frame])) {
- [self setHasHorizontalScroller:YES];
- NSRect horizontalScrollerRect = [self bounds];
- horizontalScrollerRect.size.height = 0;
- base::scoped_nsobject<InvisibleScroller> horizontalScroller(
- [[InvisibleScroller alloc] initWithFrame:horizontalScrollerRect]);
- [self setHorizontalScroller:horizontalScroller];
- }
- return self;
-}
-
-- (void)scrollWheel:(NSEvent*)event {
- if ([event subtype] == NSMouseEventSubtype) {
- // Since the scroll view has no vertical scroller, regular up and down mouse
- // wheel events would be ignored. This maps mouse wheel events to a
- // horizontal scroll event of one line, to turn pages.
- BOOL downOrRight;
- if ([event deltaX] != 0)
- downOrRight = [event deltaX] > 0;
- else if ([event deltaY] != 0)
- downOrRight = [event deltaY] > 0;
- else
- return;
-
- base::ScopedCFTypeRef<CGEventRef> cgEvent(CGEventCreateScrollWheelEvent(
- NULL, kCGScrollEventUnitLine, 2, 0, downOrRight ? 1 : -1));
- [super scrollWheel:[NSEvent eventWithCGEvent:cgEvent]];
- return;
- }
-
- [super scrollWheel:event];
- if (![event respondsToSelector:@selector(momentumPhase)])
- return;
-
- BOOL scrollComplete = [event momentumPhase] == NSEventPhaseEnded ||
- ([event momentumPhase] == NSEventPhaseNone &&
- [event phase] == NSEventPhaseEnded);
-
- [delegate_ userScrolling:!scrollComplete];
-}
-
-@end

Powered by Google App Engine
This is Rietveld 408576698