OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "ios/chrome/browser/ui/tab_switcher/tab_switcher_button.h" | 5 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_button.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | |
8 #import "ios/third_party/material_components_ios/src/components/Ink/src/Material
Ink.h" | 7 #import "ios/third_party/material_components_ios/src/components/Ink/src/Material
Ink.h" |
9 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
10 @interface TabSwitcherButton () { | 13 @interface TabSwitcherButton () { |
11 base::scoped_nsobject<MDCInkTouchController> _inkTouchController; | 14 MDCInkTouchController* _inkTouchController; |
12 } | 15 } |
13 @end | 16 @end |
14 | 17 |
15 @implementation TabSwitcherButton | 18 @implementation TabSwitcherButton |
16 | 19 |
17 - (instancetype)initWithFrame:(CGRect)frame { | 20 - (instancetype)initWithFrame:(CGRect)frame { |
18 self = [super initWithFrame:frame]; | 21 self = [super initWithFrame:frame]; |
19 if (self) { | 22 if (self) { |
20 _inkTouchController.reset( | 23 _inkTouchController = [[MDCInkTouchController alloc] initWithView:self]; |
21 [[MDCInkTouchController alloc] initWithView:self]); | |
22 [_inkTouchController addInkView]; | 24 [_inkTouchController addInkView]; |
23 // TODO(crbug.com/606807): Adjust the desired ink color. | 25 // TODO(crbug.com/606807): Adjust the desired ink color. |
24 [_inkTouchController defaultInkView].inkColor = | 26 [_inkTouchController defaultInkView].inkColor = |
25 [[UIColor whiteColor] colorWithAlphaComponent:0.4]; | 27 [[UIColor whiteColor] colorWithAlphaComponent:0.4]; |
26 } | 28 } |
27 return self; | 29 return self; |
28 } | 30 } |
29 | 31 |
30 - (void)resetState { | 32 - (void)resetState { |
31 [_inkTouchController cancelInkTouchProcessing]; | 33 [_inkTouchController cancelInkTouchProcessing]; |
32 } | 34 } |
33 | 35 |
34 @end | 36 @end |
OLD | NEW |