OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #include "ash/keyboard/keyboard_ui_mus.h" |
| 6 |
| 7 #include "ash/keyboard/keyboard_ui_observer.h" |
| 8 #include "ash/mojo_shell.h" |
| 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" |
| 11 #include "mojo/shell/public/cpp/shell.h" |
| 12 |
| 13 namespace ash { |
| 14 |
| 15 KeyboardUIMus::KeyboardUIMus() : is_enabled_(false), observer_binding_(this) { |
| 16 GetMojoShell()->ConnectToService("mojo://keyboard", &keyboard_); |
| 17 keyboard_->AddObserver(observer_binding_.CreateInterfacePtrAndBind()); |
| 18 } |
| 19 |
| 20 KeyboardUIMus::~KeyboardUIMus() {} |
| 21 |
| 22 void KeyboardUIMus::Hide() { |
| 23 keyboard_->Hide(); |
| 24 } |
| 25 |
| 26 void KeyboardUIMus::Show() { |
| 27 keyboard_->Show(); |
| 28 } |
| 29 |
| 30 bool KeyboardUIMus::IsEnabled() { |
| 31 return is_enabled_; |
| 32 } |
| 33 |
| 34 void KeyboardUIMus::OnKeyboardStateChanged(bool is_enabled, |
| 35 bool is_visible, |
| 36 uint64_t display_id, |
| 37 mojo::RectPtr bounds) { |
| 38 if (is_enabled_ == is_enabled) |
| 39 return; |
| 40 |
| 41 is_enabled_ = is_enabled; |
| 42 FOR_EACH_OBSERVER(KeyboardUIObserver, *observers(), |
| 43 OnKeyboardEnabledStateChanged(is_enabled)); |
| 44 } |
| 45 |
| 46 } // namespace ash |
OLD | NEW |