OLD | NEW |
(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 #ifndef UI_BASE_WIN_OSK_DISPLAY_MANAGER_H_ |
| 6 #define UI_BASE_WIN_OSK_DISPLAY_MANAGER_H_ |
| 7 |
| 8 #include "base/memory/singleton.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/observer_list.h" |
| 11 #include "base/strings/string16.h" |
| 12 #include "ui/base/ui_base_export.h" |
| 13 #include "ui/gfx/geometry/rect.h" |
| 14 |
| 15 namespace ui { |
| 16 |
| 17 // Implemented by classes who wish to get notified about the on screen keyboard |
| 18 // becoming visible/hidden. |
| 19 class UI_BASE_EXPORT OnScreenKeyboardObserver { |
| 20 public: |
| 21 virtual ~OnScreenKeyboardObserver() {} |
| 22 |
| 23 // The |keyboard_rect| parameter contains the bounds of the keyboard in DIPs. |
| 24 virtual void OnKeyboardVisible(const gfx::Rect& keyboard_rect_in_dips) {} |
| 25 virtual void OnKeyboardHidden(const gfx::Rect& keyboard_rect_in_dips) {} |
| 26 }; |
| 27 |
| 28 class OnScreenKeyboardDetector; |
| 29 class OnScreenKeyboardObserver; |
| 30 |
| 31 // This class provides functionality to display the on screen keyboard on |
| 32 // Windows 8+. It optionally notifies observers that the OSK is displayed, |
| 33 // hidden, etc. |
| 34 class UI_BASE_EXPORT OnScreenKeyboardDisplayManager { |
| 35 public: |
| 36 static OnScreenKeyboardDisplayManager* GetInstance(); |
| 37 |
| 38 ~OnScreenKeyboardDisplayManager(); |
| 39 |
| 40 // Functions to display and dismiss the keyboard. |
| 41 // The |observer| parameters allow the caller to optionally set up |
| 42 // notification observers for detecting when the keyboard is displayed |
| 43 // hidden etc. |
| 44 bool DisplayVirtualKeyboard(OnScreenKeyboardObserver* observer); |
| 45 bool DismissVirtualKeyboard(); |
| 46 |
| 47 private: |
| 48 OnScreenKeyboardDisplayManager(); |
| 49 |
| 50 friend struct base::DefaultSingletonTraits<OnScreenKeyboardDisplayManager>; |
| 51 |
| 52 std::unique_ptr<OnScreenKeyboardDetector> keyboard_detector_; |
| 53 |
| 54 // The location of TabTip.exe. |
| 55 base::string16 osk_path_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(OnScreenKeyboardDisplayManager); |
| 58 }; |
| 59 |
| 60 // Displays the on screen keyboard on Windows 8 and above. Returns true on |
| 61 // success. |
| 62 UI_BASE_EXPORT bool DisplayVirtualKeyboard(); |
| 63 |
| 64 // Dismisses the on screen keyboard if it is being displayed on Windows 8 and. |
| 65 // above. Returns true on success. |
| 66 UI_BASE_EXPORT bool DismissVirtualKeyboard(); |
| 67 |
| 68 } // namespace ui |
| 69 |
| 70 #endif // UI_BASE_WIN_OSK_DISPLAY_MANAGER_H_ |
OLD | NEW |