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

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

Issue 645853013: Remove some platform specific stuff from views. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 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 b855ee058147238bed6038709699dd7613cdb5a7..0000000000000000000000000000000000000000
--- a/ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm
+++ /dev/null
@@ -1,78 +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/mac_util.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:base::mac::IsOSLionOrLater()];
- NSRect horizontalScrollerRect = [self bounds];
- horizontalScrollerRect.size.height = 0;
- base::scoped_nsobject<InvisibleScroller> horizontalScroller(
- [[InvisibleScroller alloc] initWithFrame:horizontalScrollerRect]);
- [self setHorizontalScroller:horizontalScroller];
- }
- return self;
-}
-
-- (void)endGestureWithEvent:(NSEvent*)event {
- [super endGestureWithEvent:event];
- if (!base::mac::IsOSLionOrLater())
- [delegate_ userScrolling:NO];
-}
-
-- (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
« no previous file with comments | « ui/app_list/cocoa/scroll_view_with_no_scrollbars.h ('k') | ui/app_list/cocoa/test/apps_grid_controller_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698