| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_KEYBOARD_ACCESSORY_VIEW_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_KEYBOARD_ACCESSORY_VIEW_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_TOOLBAR_KEYBOARD_ACCESSORY_VIEW_H_ | 6 #define IOS_CHROME_BROWSER_UI_TOOLBAR_KEYBOARD_ACCESSORY_VIEW_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKIt.h> | 8 #import <UIKit/UIKIt.h> |
| 9 | 9 |
| 10 // Delegate protocol for the KeyboardAccessoryView. | 10 #import "ios/chrome/browser/ui/toolbar/keyboard_accessory_view_protocol.h" |
| 11 @protocol KeyboardAccessoryViewDelegate | |
| 12 | |
| 13 // Notifies the delegate that the Voice Search button was pressed. | |
| 14 - (void)keyboardAccessoryVoiceSearchTouchDown; | |
| 15 | |
| 16 // Notifies the delegate that a touch up occured in the the Voice Search button. | |
| 17 - (void)keyboardAccessoryVoiceSearchTouchUpInside; | |
| 18 | |
| 19 // Notifies the delegate that a key with the title |title| was pressed. | |
| 20 - (void)keyPressed:(NSString*)title; | |
| 21 | |
| 22 @end | |
| 23 | |
| 24 typedef NS_ENUM(NSInteger, KeyboardAccessoryViewMode) { | |
| 25 VOICE_SEARCH = 0, | |
| 26 KEY_SHORTCUTS | |
| 27 }; | |
| 28 | 11 |
| 29 // Accessory View above the keyboard. | 12 // Accessory View above the keyboard. |
| 30 // Supports two modes: one where a Voice Search button is shown, and one where | 13 // Supports two modes: one where a Voice Search button is shown, and one where |
| 31 // a list of buttons based on |buttonTitles| is shown. | 14 // a list of buttons based on |buttonTitles| is shown. |
| 32 // The default mode is the Voice Search mode. | 15 // The default mode is the Voice Search mode. |
| 33 @interface KeyboardAccessoryView : UIInputView<UIInputViewAudioFeedback> | 16 @interface KeyboardAccessoryView |
| 17 : UIInputView<KeyboardAccessoryViewProtocol, UIInputViewAudioFeedback> |
| 34 | 18 |
| 35 // Designated initializer. |buttonTitles| lists the titles of the buttons shown | 19 // Designated initializer. |buttonTitles| lists the titles of the buttons shown |
| 36 // in the KEY_SHORTCUTS mode. Can be nil or empty. |delegate| receives the | 20 // in the KEY_SHORTCUTS mode. Can be nil or empty. |delegate| receives the |
| 37 // various events triggered in the view. Not retained, and can be nil. | 21 // various events triggered in the view. Not retained, and can be nil. |
| 38 - (instancetype)initWithButtons:(NSArray<NSString*>*)buttonTitles | 22 - (instancetype)initWithButtons:(NSArray<NSString*>*)buttonTitles |
| 39 delegate:(id<KeyboardAccessoryViewDelegate>)delegate | 23 delegate:(id<KeyboardAccessoryViewDelegate>)delegate |
| 40 NS_DESIGNATED_INITIALIZER; | 24 NS_DESIGNATED_INITIALIZER; |
| 41 | 25 |
| 42 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; | 26 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| 43 | 27 |
| 44 - (instancetype)initWithFrame:(CGRect)frame | 28 - (instancetype)initWithFrame:(CGRect)frame |
| 45 inputViewStyle:(UIInputViewStyle)inputViewStyle NS_UNAVAILABLE; | 29 inputViewStyle:(UIInputViewStyle)inputViewStyle NS_UNAVAILABLE; |
| 46 | 30 |
| 47 // The mode in which the KeyboardAccessoryView is in. | |
| 48 @property(nonatomic) KeyboardAccessoryViewMode mode; | |
| 49 | |
| 50 @end | 31 @end |
| 51 | 32 |
| 52 #endif // IOS_CHROME_BROWSER_UI_TOOLBAR_KEYBOARD_ACCESSORY_VIEW_H_ | 33 #endif // IOS_CHROME_BROWSER_UI_TOOLBAR_KEYBOARD_ACCESSORY_VIEW_H_ |
| OLD | NEW |