| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #ifndef UI_KEYBOARD_KEYBOARD_UI_H_ |
| 6 #define UI_KEYBOARD_KEYBOARD_UI_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "ui/base/ime/text_input_type.h" |
| 10 #include "ui/keyboard/keyboard_export.h" |
| 11 |
| 12 namespace aura { |
| 13 class Window; |
| 14 } |
| 15 namespace gfx { |
| 16 class Rect; |
| 17 } |
| 18 namespace ui { |
| 19 class InputMethod; |
| 20 } |
| 21 |
| 22 namespace keyboard { |
| 23 |
| 24 class KeyboardController; |
| 25 |
| 26 // An interface implemented by an object that implements a keyboard UI. |
| 27 class KEYBOARD_EXPORT KeyboardUI { |
| 28 public: |
| 29 KeyboardUI(); |
| 30 virtual ~KeyboardUI(); |
| 31 |
| 32 // Gets the virtual keyboard window. May return null if the window has not yet |
| 33 // been created. |
| 34 virtual aura::Window* GetKeyboardWindow() = 0; |
| 35 |
| 36 // Whether the keyboard window has been created. |
| 37 virtual bool HasKeyboardWindow() const = 0; |
| 38 |
| 39 // Gets the InputMethod that will provide notifications about changes in the |
| 40 // text input context. |
| 41 virtual ui::InputMethod* GetInputMethod() = 0; |
| 42 |
| 43 // Shows the container window of the keyboard. The default implementation |
| 44 // simply shows the container. An overridden implementation can set up |
| 45 // necessary animation, or delay the visibility change as it desires. |
| 46 virtual void ShowKeyboardContainer(aura::Window* container); |
| 47 |
| 48 // Hides the container window of the keyboard. The default implementation |
| 49 // simply hides the container. An overridden implementation can set up |
| 50 // necesasry animation, or delay the visibility change as it desires. |
| 51 virtual void HideKeyboardContainer(aura::Window* container); |
| 52 |
| 53 // Updates the type of the focused text input box. |
| 54 virtual void SetUpdateInputType(ui::TextInputType type) = 0; |
| 55 |
| 56 // Ensures caret in current work area (not occluded by virtual keyboard |
| 57 // window). |
| 58 virtual void EnsureCaretInWorkArea(); |
| 59 |
| 60 // KeyboardController owns the KeyboardUI instance so KeyboardUI subclasses |
| 61 // should not take ownership of the |controller|. |controller| can be null |
| 62 // when KeyboardController is destroying. |
| 63 virtual void SetController(KeyboardController* controller); |
| 64 |
| 65 // Reloads virtual keyboard URL if the current keyboard's web content URL is |
| 66 // different. The URL can be different if user switch from password field to |
| 67 // any other type input field. |
| 68 // At password field, the system virtual keyboard is forced to load even if |
| 69 // the current IME provides a customized virtual keyboard. This is needed to |
| 70 // prevent IME virtual keyboard logging user's password. Once user switch to |
| 71 // other input fields, the virtual keyboard should switch back to the IME |
| 72 // provided keyboard, or keep using the system virtual keyboard if IME doesn't |
| 73 // provide one. |
| 74 virtual void ReloadKeyboardIfNeeded() = 0; |
| 75 |
| 76 // When the embedder changes the keyboard bounds, asks the keyboard to adjust |
| 77 // insets for windows affected by this. |
| 78 virtual void InitInsets(const gfx::Rect& keyboard_bounds) = 0; |
| 79 |
| 80 // Resets insets for affected windows. |
| 81 virtual void ResetInsets() = 0; |
| 82 |
| 83 protected: |
| 84 KeyboardController* keyboard_controller() { return keyboard_controller_; } |
| 85 |
| 86 private: |
| 87 keyboard::KeyboardController* keyboard_controller_; |
| 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(KeyboardUI); |
| 90 }; |
| 91 |
| 92 } // namespace keyboard |
| 93 |
| 94 #endif // UI_KEYBOARD_KEYBOARD_UI_H_ |
| OLD | NEW |