| 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 #ifndef ASH_MUS_KEYBOARD_UI_MUS_H_ | 5 #ifndef ASH_MUS_KEYBOARD_UI_MUS_H_ |
| 6 #define ASH_MUS_KEYBOARD_UI_MUS_H_ | 6 #define ASH_MUS_KEYBOARD_UI_MUS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "ash/common/keyboard/keyboard_ui.h" | 12 #include "ash/common/keyboard/keyboard_ui.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
| 15 #include "ui/keyboard/keyboard.mojom.h" | 15 #include "ui/keyboard/keyboard.mojom.h" |
| 16 | 16 |
| 17 namespace service_manager { | 17 namespace service_manager { |
| 18 class Connector; | 18 class Connector; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ash { | 21 namespace ash { |
| 22 | 22 |
| 23 class KeyboardUIMus : public KeyboardUI, | 23 class KeyboardUIMus : public KeyboardUI, |
| 24 public keyboard::mojom::KeyboardObserver { | 24 public keyboard::mojom::KeyboardObserver { |
| 25 public: | 25 public: |
| 26 // |connector| may be null in tests. |
| 26 explicit KeyboardUIMus(service_manager::Connector* connector); | 27 explicit KeyboardUIMus(service_manager::Connector* connector); |
| 27 ~KeyboardUIMus() override; | 28 ~KeyboardUIMus() override; |
| 28 | 29 |
| 29 static std::unique_ptr<KeyboardUI> Create( | 30 static std::unique_ptr<KeyboardUI> Create( |
| 30 service_manager::Connector* connector); | 31 service_manager::Connector* connector); |
| 31 | 32 |
| 32 // KeyboardUI: | 33 // KeyboardUI: |
| 33 void Hide() override; | 34 void Hide() override; |
| 34 void Show() override; | 35 void Show() override; |
| 35 void ShowInDisplay(const int64_t display_id) override; | 36 void ShowInDisplay(const int64_t display_id) override; |
| 36 bool IsEnabled() override; | 37 bool IsEnabled() override; |
| 37 | 38 |
| 38 // keyboard::mojom::KeyboardObserver: | 39 // keyboard::mojom::KeyboardObserver: |
| 39 void OnKeyboardStateChanged(bool is_enabled, | 40 void OnKeyboardStateChanged(bool is_enabled, |
| 40 bool is_visible, | 41 bool is_visible, |
| 41 uint64_t display_id, | 42 uint64_t display_id, |
| 42 const gfx::Rect& bounds) override; | 43 const gfx::Rect& bounds) override; |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 bool is_enabled_; | 46 bool is_enabled_; |
| 46 | 47 |
| 48 // May be null during tests. |
| 47 keyboard::mojom::KeyboardPtr keyboard_; | 49 keyboard::mojom::KeyboardPtr keyboard_; |
| 48 mojo::Binding<keyboard::mojom::KeyboardObserver> observer_binding_; | 50 mojo::Binding<keyboard::mojom::KeyboardObserver> observer_binding_; |
| 49 | 51 |
| 50 DISALLOW_COPY_AND_ASSIGN(KeyboardUIMus); | 52 DISALLOW_COPY_AND_ASSIGN(KeyboardUIMus); |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 } // namespace ash | 55 } // namespace ash |
| 54 | 56 |
| 55 #endif // ASH_MUS_KEYBOARD_UI_MUS_H_ | 57 #endif // ASH_MUS_KEYBOARD_UI_MUS_H_ |
| OLD | NEW |