| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/mus/keyboard_ui_mus.h" | 5 #include "ash/mus/keyboard_ui_mus.h" |
| 6 | 6 |
| 7 #include "ash/common/keyboard/keyboard_ui_observer.h" | 7 #include "ash/common/keyboard/keyboard_ui_observer.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "services/service_manager/public/cpp/connector.h" | 9 #include "services/service_manager/public/cpp/connector.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 std::unique_ptr<KeyboardUI> KeyboardUIMus::Create( | 22 std::unique_ptr<KeyboardUI> KeyboardUIMus::Create( |
| 23 service_manager::Connector* connector) { | 23 service_manager::Connector* connector) { |
| 24 return base::MakeUnique<KeyboardUIMus>(connector); | 24 return base::MakeUnique<KeyboardUIMus>(connector); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void KeyboardUIMus::Hide() { | 27 void KeyboardUIMus::Hide() { |
| 28 if (keyboard_) | 28 if (keyboard_) |
| 29 keyboard_->Hide(); | 29 keyboard_->Hide(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void KeyboardUIMus::Show() { | |
| 33 if (keyboard_) | |
| 34 keyboard_->Show(); | |
| 35 } | |
| 36 | |
| 37 void KeyboardUIMus::ShowInDisplay(const int64_t display_id) { | 32 void KeyboardUIMus::ShowInDisplay(const int64_t display_id) { |
| 38 // TODO(yhanada): Send display id after adding a display_id argument to | 33 // TODO(yhanada): Send display id after adding a display_id argument to |
| 39 // |Keyboard::Show()| in keyboard.mojom. See crbug.com/585253. | 34 // |Keyboard::Show()| in keyboard.mojom. See crbug.com/585253. |
| 40 if (keyboard_) | 35 if (keyboard_) |
| 41 keyboard_->Show(); | 36 keyboard_->Show(); |
| 42 } | 37 } |
| 43 | 38 |
| 44 bool KeyboardUIMus::IsEnabled() { | 39 bool KeyboardUIMus::IsEnabled() { |
| 45 return is_enabled_; | 40 return is_enabled_; |
| 46 } | 41 } |
| 47 | 42 |
| 48 void KeyboardUIMus::OnKeyboardStateChanged(bool is_enabled, | 43 void KeyboardUIMus::OnKeyboardStateChanged(bool is_enabled, |
| 49 bool is_visible, | 44 bool is_visible, |
| 50 uint64_t display_id, | 45 uint64_t display_id, |
| 51 const gfx::Rect& bounds) { | 46 const gfx::Rect& bounds) { |
| 52 if (is_enabled_ == is_enabled) | 47 if (is_enabled_ == is_enabled) |
| 53 return; | 48 return; |
| 54 | 49 |
| 55 is_enabled_ = is_enabled; | 50 is_enabled_ = is_enabled; |
| 56 for (auto& observer : *observers()) | 51 for (auto& observer : *observers()) |
| 57 observer.OnKeyboardEnabledStateChanged(is_enabled); | 52 observer.OnKeyboardEnabledStateChanged(is_enabled); |
| 58 } | 53 } |
| 59 | 54 |
| 60 } // namespace ash | 55 } // namespace ash |
| OLD | NEW |