#include "ui/aura/window_observer.h"
#include "ui/base/ime/input_method_observer.h"
#include "ui/base/ime/text_input_type.h"
+#include "ui/gfx/rect.h"
#include "ui/keyboard/keyboard_export.h"
#include "url/gurl.h"
namespace aura {
class Window;
}
-namespace gfx {
-class Rect;
-}
namespace ui {
class InputMethod;
class TextInputClient;
return container_.get() != NULL;
}
- // Reloads the content of the keyboard.
+ // Reloads the content of the keyboard. No-op if the keyboard content is not
+ // loaded yet.
void Reload();
// Hides virtual keyboard and notifies observer bounds change.
void set_lock_keyboard(bool lock) { lock_keyboard_ = lock; }
- // Force the keyboard to show up if not showing and lock the keyboard.
- void ShowAndLockKeyboard();
+ // Force the keyboard to show up if not showing and lock the keyboard if
+ // |lock| is true.
+ void ShowKeyboard(bool lock);
+
+ // Sets the active keyboard controller. KeyboardController takes ownership of
+ // the instance. Calling ResetIntance with a new instance destroys the
+ // previous one. May be called with NULL to clear the instance.
+ static void ResetInstance(KeyboardController* controller);
+
+ // Retrieve the active keyboard controller.
+ static KeyboardController* GetInstance();
+
+ // Returns true if keyboard is currently visible.
+ bool keyboard_visible() { return keyboard_visible_; }
+
+ // Returns the current keyboard bounds. When the keyboard is not shown,
+ // an empty rectangle will get returned.
+ const gfx::Rect& current_keyboard_bounds() {
+ return current_keyboard_bounds_;
+ }
private:
// For access to Observer methods for simulation.
virtual void OnShowImeIfNeeded() OVERRIDE;
// Show virtual keyboard immediately with animation.
- void ShowKeyboard();
+ void ShowKeyboardInternal();
+
+ // Clears any insets on web content windows.
+ void ResetWindowInsets();
// Returns true if keyboard is scheduled to hide.
bool WillHideKeyboard() const;
base::WeakPtrFactory<KeyboardController> weak_factory_;
+ // The currently used keyboard position.
+ gfx::Rect current_keyboard_bounds_;
+
+ static KeyboardController* instance_;
+
DISALLOW_COPY_AND_ASSIGN(KeyboardController);
};