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

Side by Side Diff: chrome/browser/ui/touch/keyboard/keyboard_manager.h

Issue 7302015: A keyboard widget that manages itself (the animation and all that). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_TOUCH_KEYBOARD_KEYBOARD_MANAGER_H_
6 #define CHROME_BROWSER_UI_TOUCH_KEYBOARD_KEYBOARD_MANAGER_H_
7 #pragma once
8
9 #include "base/memory/singleton.h"
10 #include "chrome/browser/extensions/extension_function_dispatcher.h"
11 #include "chrome/browser/tabs/tab_strip_model_observer.h"
12 #include "content/browser/tab_contents/tab_contents_observer.h"
13 #include "content/common/notification_observer.h"
14 #include "ui/base/animation/animation_delegate.h"
15 #include "views/widget/widget.h"
16
17 #if defined(OS_CHROMEOS)
18 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
19 #endif
20
21 namespace IPC {
22 class Message;
23 }
24
25 namespace ui {
26 class InterpolatedTransform;
27 class SlideAnimation;
28 }
29
30 namespace views {
31 class KeyEvent;
32 }
33
34 class DOMView;
35 class ExtensionHostMsg_Request_Params;
36
37 // A singleton object to manage the virtual keyboard.
38 class KeyboardManager
39 : public views::Widget,
40 public ui::AnimationDelegate,
41 public TabContentsObserver,
42 public TabStripModelObserver,
43 public ExtensionFunctionDispatcher::Delegate,
44 #if defined(OS_CHROMEOS)
45 public chromeos::input_method::InputMethodManager::VirtualKeyboardObserver ,
46 #endif
47 public NotificationObserver {
48 public:
49 // Returns the singleton object.
50 static KeyboardManager* GetInstance();
51
52 // Show the keyboard for the target widget. The events from the keyboard will
53 // be sent to |widget|.
54 // TODO(sad): Allow specifying the type of keyboard to show.
sadrul 2011/07/05 06:03:38 @bryeung: I have not added VirtualKeyboardType fro
55 void ShowKeyboardForWidget(views::Widget* widget);
56
57 // Overridden from views::Widget
58 void Hide() OVERRIDE;
59
60 private:
61 // Requirement for Singleton
62 friend struct DefaultSingletonTraits<KeyboardManager>;
63
64 KeyboardManager();
65 virtual ~KeyboardManager();
66
67 // Overridden from views::Widget.
68 virtual bool OnKeyEvent(const views::KeyEvent& event) OVERRIDE;
69
70 // Overridden from ui::AnimationDelegate:
71 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
72 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
73
74 // Overridden from TabContentsObserver
75 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
76 void OnRequest(const ExtensionHostMsg_Request_Params& params);
77
78 // Overridden from TabStripModelObserver.
79 virtual void ActiveTabChanged(TabContentsWrapper* old_contents,
80 TabContentsWrapper* new_contents,
81 int index,
82 bool user_gesture);
83
84 // ExtensionFunctionDispatcher::Delegate implementation
85 virtual Browser* GetBrowser() OVERRIDE;
86 virtual gfx::NativeView GetNativeViewOfHost() OVERRIDE;
87 virtual TabContents* GetAssociatedTabContents() const OVERRIDE;
88
89 #if defined(OS_CHROMEOS)
90 // input_method::InputMethodManager::VirtualKeyboardObserver implementation.
91 virtual void VirtualKeyboardChanged(
92 chromeos::input_method::InputMethodManager* manager,
93 const chromeos::input_method::VirtualKeyboard& virtual_keyboard,
94 const std::string& virtual_keyboard_layout);
95 #endif
96
97 // NotificationObserver implementation:
98 virtual void Observe(NotificationType type,
99 const NotificationSource& source,
100 const NotificationDetails& details) OVERRIDE;
101
102 // The animation.
103 scoped_ptr<ui::SlideAnimation> animation_;
104
105 // Interpolated transform used during animation.
106 scoped_ptr<ui::InterpolatedTransform> transform_;
107
108 // The DOM view to host the keyboard.
109 DOMView* dom_view_;
110
111 ExtensionFunctionDispatcher extension_dispatcher_;
112
113 // The widget the events from the keyboard should be directed to.
114 views::Widget* target_;
115
116 // Height of the keyboard.
117 int keyboard_height_;
118
119 NotificationRegistrar registrar_;
120
121 DISALLOW_COPY_AND_ASSIGN(KeyboardManager);
122 };
123
124 #endif // CHROME_BROWSER_UI_TOUCH_KEYBOARD_KEYBOARD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698