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

Side by Side Diff: ui/views/cocoa/views_scrollbar_bridge.mm

Issue 1671313002: MacViews: Overlay Scrollbars with Show/Hide Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 10 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
« no previous file with comments | « ui/views/cocoa/views_scrollbar_bridge.h ('k') | ui/views/controls/scroll_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "ui/views/cocoa/views_scrollbar_bridge.h"
6
7 #include "base/mac/mac_util.h"
8 #import "base/mac/sdk_forward_declarations.h"
9
10 @interface ViewsScrollbarBridge ()
11
12 // Called when we receive a NSPreferredScrollerStyleDidChangeNotification.
13 - (void)onScrollerStyleChanged:(NSNotification*)notification;
14
15 @end
16
17 @implementation ViewsScrollbarBridge
18
19 - (id)initWithDelegate:(ViewsScrollbarBridgeDelegate*)delegate {
20 if ((self = [super init])) {
21 delegate_ = delegate;
22 [[NSNotificationCenter defaultCenter]
23 addObserver:self
24 selector:@selector(onScrollerStyleChanged:)
25 name:NSPreferredScrollerStyleDidChangeNotification
26 object:nil];
27 }
28 return self;
29 }
30
31 - (void)dealloc {
32 DCHECK(!delegate_);
33 [super dealloc];
34 }
35
36 - (void)clearDelegate {
37 delegate_ = nullptr;
38 [[NSNotificationCenter defaultCenter] removeObserver:self];
39 }
40
41 - (void)onScrollerStyleChanged:(NSNotification*)notification {
42 if (delegate_)
43 delegate_->OnScrollerStyleChanged();
44 }
45
46 + (NSScrollerStyle)getPreferredScrollerStyle {
47 if (![NSScroller respondsToSelector:@selector(preferredScrollerStyle)]) {
48 DCHECK(base::mac::IsOSSnowLeopard());
49 return NSScrollerStyleLegacy;
50 }
51 return [NSScroller preferredScrollerStyle];
52 }
53
54 @end
OLDNEW
« no previous file with comments | « ui/views/cocoa/views_scrollbar_bridge.h ('k') | ui/views/controls/scroll_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698