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

Unified 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: Use the keyboard widget in the login screen too Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/touch/keyboard/keyboard_manager.h
diff --git a/chrome/browser/ui/touch/keyboard/keyboard_manager.h b/chrome/browser/ui/touch/keyboard/keyboard_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b8eeca0aea53f9f53a460e94722177051701ac7
--- /dev/null
+++ b/chrome/browser/ui/touch/keyboard/keyboard_manager.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_TOUCH_KEYBOARD_KEYBOARD_MANAGER_H_
+#define CHROME_BROWSER_UI_TOUCH_KEYBOARD_KEYBOARD_MANAGER_H_
+#pragma once
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/extensions/extension_function_dispatcher.h"
+#include "content/browser/tab_contents/tab_contents_observer.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "views/widget/widget.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ui {
+class InterpolatedTransform;
+class SlideAnimation;
+}
+
+namespace views {
+class KeyEvent;
+}
+
+class DOMView;
+class ExtensionHostMsg_Request_Params;
+
+// A singleton object to manage the virtual keyboard.
+class KeyboardManager : public views::Widget,
+ public ui::AnimationDelegate,
+ public TabContentsObserver,
+ public ExtensionFunctionDispatcher::Delegate {
+ public:
+ // Returns the singleton object.
+ static KeyboardManager* GetInstance();
+
+ // Show the keyboard for the target widget. The events from the keyboard will
+ // be sent to |widget|.
+ void ShowKeyboardForWidget(views::Widget* widget);
+
+ // Overridden from views::Widget
+ void Hide() OVERRIDE;
+
+ private:
+ // Requirement for Singleton
+ friend struct DefaultSingletonTraits<KeyboardManager>;
+
+ KeyboardManager();
+ virtual ~KeyboardManager();
+
+ // Overridden from views::Widget.
+ virtual bool OnKeyEvent(const views::KeyEvent& event) OVERRIDE;
+
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+ virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
+
+ // Overridden from TabContentsObserver
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ void OnRequest(const ExtensionHostMsg_Request_Params& params);
+
+ // ExtensionFunctionDispatcher::Delegate implementation
+ virtual Browser* GetBrowser() OVERRIDE;
+ virtual gfx::NativeView GetNativeViewOfHost() OVERRIDE;
+ virtual TabContents* GetAssociatedTabContents() const OVERRIDE;
+
+ // The animation.
+ scoped_ptr<ui::SlideAnimation> animation_;
+
+ // Interpolated transform used during animation.
+ scoped_ptr<ui::InterpolatedTransform> transform_;
+
+ DOMView* dom_view_;
+ ExtensionFunctionDispatcher extension_dispatcher_;
+
+ // The widget the events from the keyboard should be directed to.
+ views::Widget* target_;
+
+ DISALLOW_COPY_AND_ASSIGN(KeyboardManager);
+};
+
+#endif // CHROME_BROWSER_UI_TOUCH_KEYBOARD_KEYBOARD_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698