1 // Copyright 2015 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.
5 #ifndef IOS_CHROME_BROWSER_UI_KEYBOARD_HARDWARE_KEYBOARD_WATCHER_H_
6 #define IOS_CHROME_BROWSER_UI_KEYBOARD_HARDWARE_KEYBOARD_WATCHER_H_
8 #import <UIKit/UIKit.h>
10 // Watches keyboard events to determine if the keyboard is software (provided by
11 // iOS, fully visible on screen when showing) or hardware (external keyboard,
12 // only showing a potential input accessory view).
13 // It reports the mode for each keyboard frame change via an UMA histogram
14 // (Omnibox.HardwareKeyboardModeEnabled).
15 @interface HardwareKeyboardWatcher
: NSObject
17 // Pass an accessory view to check for presence in the view hierarchy. Keyboard
18 // presentation/dismissal with no input accessory view have a different code
19 // path between hardware and software keyboard mode, thus unreliable for
20 // metrics comparisons.
21 // |accessoryView| must not be nil.
22 - (instancetype
)initWithAccessoryView
:(UIView
*)accessoryView
23 NS_DESIGNATED_INITIALIZER
;
25 // Detection of external keyboards only works when an input accessory view is
27 - (instancetype
)init NS_UNAVAILABLE
;
31 #endif // IOS_CHROME_BROWSER_UI_KEYBOARD_HARDWARE_KEYBOARD_WATCHER_H_