Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: ui/keyboard/keyboard_controller.h

Issue 20526005: Implement virtual keyboard hiding. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase yet again Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | ui/keyboard/keyboard_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 24 matching lines...) Expand all
35 public aura::WindowObserver { 35 public aura::WindowObserver {
36 public: 36 public:
37 // Takes ownership of |proxy|. 37 // Takes ownership of |proxy|.
38 explicit KeyboardController(KeyboardControllerProxy* proxy); 38 explicit KeyboardController(KeyboardControllerProxy* proxy);
39 virtual ~KeyboardController(); 39 virtual ~KeyboardController();
40 40
41 // Returns the container for the keyboard, which is then owned by the caller. 41 // Returns the container for the keyboard, which is then owned by the caller.
42 // It is the responsibility of the caller to Show() the returned window. 42 // It is the responsibility of the caller to Show() the returned window.
43 aura::Window* GetContainerWindow(); 43 aura::Window* GetContainerWindow();
44 44
45 // Hides virtual keyboard and notifies observer bounds change.
46 // This function should be called with a delay to avoid layout flicker
47 // when the focus of input field quickly change.
48 void HideKeyboard();
49
45 // Management of the observer list. 50 // Management of the observer list.
46 virtual void AddObserver(KeyboardControllerObserver* observer); 51 virtual void AddObserver(KeyboardControllerObserver* observer);
47 virtual void RemoveObserver(KeyboardControllerObserver* observer); 52 virtual void RemoveObserver(KeyboardControllerObserver* observer);
48 53
49 private: 54 private:
50 // For access to Observer methods for simulation. 55 // For access to Observer methods for simulation.
51 friend class KeyboardControllerTest; 56 friend class KeyboardControllerTest;
52 57
53 // aura::WindowObserver overrides 58 // aura::WindowObserver overrides
54 virtual void OnWindowHierarchyChanged( 59 virtual void OnWindowHierarchyChanged(
55 const HierarchyChangeParams& params) OVERRIDE; 60 const HierarchyChangeParams& params) OVERRIDE;
56 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; 61 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
57 62
58 // InputMethodObserver overrides 63 // InputMethodObserver overrides
59 virtual void OnTextInputStateChanged( 64 virtual void OnTextInputStateChanged(
60 const ui::TextInputClient* client) OVERRIDE; 65 const ui::TextInputClient* client) OVERRIDE;
61 virtual void OnInputMethodDestroyed( 66 virtual void OnInputMethodDestroyed(
62 const ui::InputMethod* input_method) OVERRIDE; 67 const ui::InputMethod* input_method) OVERRIDE;
63 68
64 // Hides virtual keyboard and notifies observer bounds change.
65 // This functions should be called with a delay to avoid layout flicker
66 // when the focus of input field quickly change.
67 void HideKeyboard();
68
69 // Returns true if keyboard is scheduled to hide. 69 // Returns true if keyboard is scheduled to hide.
70 bool WillHideKeyboard() const; 70 bool WillHideKeyboard() const;
71 71
72 scoped_ptr<KeyboardControllerProxy> proxy_; 72 scoped_ptr<KeyboardControllerProxy> proxy_;
73 aura::Window* container_; 73 aura::Window* container_;
74 ui::InputMethod* input_method_; 74 ui::InputMethod* input_method_;
75 bool keyboard_visible_; 75 bool keyboard_visible_;
76 base::WeakPtrFactory<KeyboardController> weak_factory_; 76 base::WeakPtrFactory<KeyboardController> weak_factory_;
77 77
78 ObserverList<KeyboardControllerObserver> observer_list_; 78 ObserverList<KeyboardControllerObserver> observer_list_;
79 79
80 DISALLOW_COPY_AND_ASSIGN(KeyboardController); 80 DISALLOW_COPY_AND_ASSIGN(KeyboardController);
81 }; 81 };
82 82
83 } // namespace keyboard 83 } // namespace keyboard
84 84
85 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ 85 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_
OLDNEW
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | ui/keyboard/keyboard_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698