Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ | 5 #ifndef UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ |
| 6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ | 6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/event_types.h" | 9 #include "base/event_types.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
| 13 #include "ui/base/ime/input_method_observer.h" | 13 #include "ui/base/ime/input_method_observer.h" |
| 14 #include "ui/keyboard/keyboard_export.h" | 14 #include "ui/keyboard/keyboard_export.h" |
| 15 | 15 |
| 16 class CommandLine; | |
| 17 | |
| 16 namespace aura { | 18 namespace aura { |
| 17 class Window; | 19 class Window; |
| 18 } | 20 } |
| 19 namespace gfx { | 21 namespace gfx { |
| 20 class Rect; | 22 class Rect; |
| 21 } | 23 } |
| 22 namespace ui { | 24 namespace ui { |
| 23 class InputMethod; | 25 class InputMethod; |
| 24 class TextInputClient; | 26 class TextInputClient; |
| 25 } | 27 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 40 // System initiated. | 42 // System initiated. |
| 41 HIDE_REASON_AUTOMATIC, | 43 HIDE_REASON_AUTOMATIC, |
| 42 // User initiated. | 44 // User initiated. |
| 43 HIDE_REASON_MANUAL, | 45 HIDE_REASON_MANUAL, |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 // Takes ownership of |proxy|. | 48 // Takes ownership of |proxy|. |
| 47 explicit KeyboardController(KeyboardControllerProxy* proxy); | 49 explicit KeyboardController(KeyboardControllerProxy* proxy); |
| 48 virtual ~KeyboardController(); | 50 virtual ~KeyboardController(); |
| 49 | 51 |
| 52 void set_command_line_for_testing(CommandLine* command_line) { | |
| 53 command_line_for_testing_ = command_line; | |
| 54 } | |
| 55 | |
| 50 // Returns the container for the keyboard, which is owned by | 56 // Returns the container for the keyboard, which is owned by |
| 51 // KeyboardController. | 57 // KeyboardController. |
| 52 aura::Window* GetContainerWindow(); | 58 aura::Window* GetContainerWindow(); |
| 53 | 59 |
| 54 // Hides virtual keyboard and notifies observer bounds change. | 60 // Hides virtual keyboard and notifies observer bounds change. |
| 55 // This function should be called with a delay to avoid layout flicker | 61 // This function should be called with a delay to avoid layout flicker |
| 56 // when the focus of input field quickly change. |automatic| is true when the | 62 // when the focus of input field quickly change. |automatic| is true when the |
| 57 // call is made by the system rather than initiated by the user. | 63 // call is made by the system rather than initiated by the user. |
| 58 void HideKeyboard(HideReason reason); | 64 void HideKeyboard(HideReason reason); |
| 59 | 65 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 85 const ui::InputMethod* input_method) OVERRIDE; | 91 const ui::InputMethod* input_method) OVERRIDE; |
| 86 | 92 |
| 87 // Returns true if keyboard is scheduled to hide. | 93 // Returns true if keyboard is scheduled to hide. |
| 88 bool WillHideKeyboard() const; | 94 bool WillHideKeyboard() const; |
| 89 | 95 |
| 90 scoped_ptr<KeyboardControllerProxy> proxy_; | 96 scoped_ptr<KeyboardControllerProxy> proxy_; |
| 91 scoped_ptr<aura::Window> container_; | 97 scoped_ptr<aura::Window> container_; |
| 92 ui::InputMethod* input_method_; | 98 ui::InputMethod* input_method_; |
| 93 bool keyboard_visible_; | 99 bool keyboard_visible_; |
| 94 | 100 |
| 101 // If non-NULL, used in place of the real command line. | |
| 102 CommandLine* command_line_for_testing_; | |
| 103 | |
|
sadrul
2013/10/24 01:21:01
You shouldn't need this. See comment in test.
bshe
2013/10/24 03:35:36
Done.
| |
| 95 ObserverList<KeyboardControllerObserver> observer_list_; | 104 ObserverList<KeyboardControllerObserver> observer_list_; |
| 96 | 105 |
| 97 base::WeakPtrFactory<KeyboardController> weak_factory_; | 106 base::WeakPtrFactory<KeyboardController> weak_factory_; |
| 98 | 107 |
| 99 DISALLOW_COPY_AND_ASSIGN(KeyboardController); | 108 DISALLOW_COPY_AND_ASSIGN(KeyboardController); |
| 100 }; | 109 }; |
| 101 | 110 |
| 102 } // namespace keyboard | 111 } // namespace keyboard |
| 103 | 112 |
| 104 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ | 113 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ |
| OLD | NEW |