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

Unified Diff: ash/keyboard/keyboard_ui_mus.cc

Issue 1684823004: Refactors keyboard related code so mash can use a keyboard (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: always compile mojo_shell Created 4 years, 10 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: ash/keyboard/keyboard_ui_mus.cc
diff --git a/ash/keyboard/keyboard_ui_mus.cc b/ash/keyboard/keyboard_ui_mus.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a9d22fe6e1c9d0a98d994456fb871c8bea2175d2
--- /dev/null
+++ b/ash/keyboard/keyboard_ui_mus.cc
@@ -0,0 +1,46 @@
+// Copyright 2016 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 "ash/keyboard/keyboard_ui_mus.h"
+
+#include "ash/keyboard/keyboard_ui_observer.h"
+#include "ash/mojo_shell.h"
+#include "ash/shell.h"
+#include "ash/shell_delegate.h"
+#include "mojo/shell/public/cpp/shell.h"
+
+namespace ash {
+
+KeyboardUIMus::KeyboardUIMus() : is_enabled_(false), observer_binding_(this) {
+ GetMojoShell()->ConnectToService("mojo://keyboard", &keyboard_);
+ keyboard_->AddObserver(observer_binding_.CreateInterfacePtrAndBind());
+}
+
+KeyboardUIMus::~KeyboardUIMus() {}
+
+void KeyboardUIMus::Hide() {
+ keyboard_->Hide();
+}
+
+void KeyboardUIMus::Show() {
+ keyboard_->Show();
+}
+
+bool KeyboardUIMus::IsEnabled() {
+ return is_enabled_;
+}
+
+void KeyboardUIMus::OnKeyboardStateChanged(bool is_enabled,
+ bool is_visible,
+ uint64_t display_id,
+ mojo::RectPtr bounds) {
+ if (is_enabled_ == is_enabled)
+ return;
+
+ is_enabled_ = is_enabled;
+ FOR_EACH_OBSERVER(KeyboardUIObserver, *observers(),
+ OnKeyboardEnabledStateChanged(is_enabled));
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698