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

Unified Diff: ui/keyboard/keyboard_ui.cc

Issue 1392713002: Extract content dependency from keyboard code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 2 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
« no previous file with comments | « ui/keyboard/keyboard_ui.h ('k') | ui/keyboard/keyboard_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_ui.cc
diff --git a/ui/keyboard/keyboard_ui.cc b/ui/keyboard/keyboard_ui.cc
new file mode 100644
index 0000000000000000000000000000000000000000..816933bf7e6afbb60488e9af8e7030645900125f
--- /dev/null
+++ b/ui/keyboard/keyboard_ui.cc
@@ -0,0 +1,47 @@
+// Copyright 2015 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.
+
+#include "ui/keyboard/keyboard_ui.h"
+
+#include "ui/aura/window.h"
+#include "ui/base/ime/input_method.h"
+#include "ui/base/ime/text_input_client.h"
+#include "ui/keyboard/keyboard_controller.h"
+
+namespace keyboard {
+
+KeyboardUI::KeyboardUI() : keyboard_controller_(nullptr) {}
+KeyboardUI::~KeyboardUI() {}
+
+void KeyboardUI::ShowKeyboardContainer(aura::Window* container) {
+ if (HasKeyboardWindow()) {
+ GetKeyboardWindow()->Show();
+ container->Show();
+ }
+}
+
+void KeyboardUI::HideKeyboardContainer(aura::Window* container) {
+ if (HasKeyboardWindow()) {
+ container->Hide();
+ GetKeyboardWindow()->Hide();
+ }
+}
+
+void KeyboardUI::EnsureCaretInWorkArea() {
+ if (GetInputMethod()->GetTextInputClient()) {
+ aura::Window* keyboard_window = GetKeyboardWindow();
+ aura::Window* root_window = keyboard_window->GetRootWindow();
+ gfx::Rect available_bounds = root_window->bounds();
+ gfx::Rect keyboard_bounds = keyboard_window->bounds();
+ available_bounds.set_height(available_bounds.height() -
+ keyboard_bounds.height());
+ GetInputMethod()->GetTextInputClient()->EnsureCaretInRect(available_bounds);
+ }
+}
+
+void KeyboardUI::SetController(KeyboardController* controller) {
+ keyboard_controller_ = controller;
+}
+
+} // namespace keyboard
« no previous file with comments | « ui/keyboard/keyboard_ui.h ('k') | ui/keyboard/keyboard_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698