Update .DEPS.git
[chromium-blink-merge.git] / ui / keyboard / keyboard_controller.h
blob6022339c38072319d4dbf48a976b3d6904df8c3e
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
3 // found in the LICENSE file.
5 #ifndef UI_KEYBOARD_KEYBOARD_CONTROLLER_H_
6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/observer_list.h"
11 #include "ui/aura/window_observer.h"
12 #include "ui/base/ime/input_method_observer.h"
13 #include "ui/keyboard/keyboard_export.h"
15 namespace aura {
16 class Window;
18 namespace gfx {
19 class Rect;
21 namespace ui {
22 class InputMethod;
23 class TextInputClient;
26 namespace keyboard {
28 class KeyboardControllerObserver;
29 class KeyboardControllerProxy;
30 class KeyboardLayoutManager;
32 // Provides control of the virtual keyboard, including providing a container
33 // and controlling visibility.
34 class KEYBOARD_EXPORT KeyboardController : public ui::InputMethodObserver,
35 public aura::WindowObserver {
36 public:
37 // Takes ownership of |proxy|.
38 explicit KeyboardController(KeyboardControllerProxy* proxy);
39 virtual ~KeyboardController();
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.
43 aura::Window* GetContainerWindow();
45 // Management of the observer list.
46 virtual void AddObserver(KeyboardControllerObserver* observer);
47 virtual void RemoveObserver(KeyboardControllerObserver* observer);
49 private:
50 // For access to Observer methods for simulation.
51 friend class KeyboardControllerTest;
53 // aura::WindowObserver overrides
54 virtual void OnWindowHierarchyChanged(
55 const HierarchyChangeParams& params) OVERRIDE;
56 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
58 // InputMethodObserver overrides
59 virtual void OnTextInputStateChanged(
60 const ui::TextInputClient* client) OVERRIDE;
61 virtual void OnInputMethodDestroyed(
62 const ui::InputMethod* input_method) OVERRIDE;
64 scoped_ptr<KeyboardControllerProxy> proxy_;
65 aura::Window* container_;
66 ui::InputMethod* input_method_;
68 ObserverList<KeyboardControllerObserver> observer_list_;
70 DISALLOW_COPY_AND_ASSIGN(KeyboardController);
73 } // namespace keyboard
75 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_