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/common/keyboard/keyboard_ui.h" | 5 #include "ash/common/keyboard/keyboard_ui.h" |
6 | 6 |
7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
8 #include "ash/common/keyboard/keyboard_ui_observer.h" | 8 #include "ash/common/keyboard/keyboard_ui_observer.h" |
9 #include "ash/common/system/accessibility_observer.h" | 9 #include "ash/common/system/accessibility_observer.h" |
10 #include "ash/common/system/tray/system_tray_notifier.h" | 10 #include "ash/common/system/tray/system_tray_notifier.h" |
11 #include "ash/common/system/tray_accessibility.h" | 11 #include "ash/common/system/tray_accessibility.h" |
12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "ui/keyboard/keyboard_controller.h" | 15 #include "ui/keyboard/keyboard_controller.h" |
16 | 16 |
17 namespace ash { | 17 namespace ash { |
18 | 18 |
19 class KeyboardUIImpl : public KeyboardUI, public AccessibilityObserver { | 19 class KeyboardUIImpl : public KeyboardUI, public AccessibilityObserver { |
20 public: | 20 public: |
21 KeyboardUIImpl() : enabled_(false) { | 21 KeyboardUIImpl() : enabled_(false) { |
22 WmShell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); | 22 WmShell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); |
23 } | 23 } |
24 | 24 |
25 ~KeyboardUIImpl() override { | 25 ~KeyboardUIImpl() override { |
26 if (WmShell::HasInstance() && WmShell::Get()->system_tray_notifier()) | 26 if (WmShell::HasInstance() && WmShell::Get()->system_tray_notifier()) |
27 WmShell::Get()->system_tray_notifier()->RemoveAccessibilityObserver(this); | 27 WmShell::Get()->system_tray_notifier()->RemoveAccessibilityObserver(this); |
28 } | 28 } |
29 | 29 |
30 // KeyboardUI: | |
31 void Show() override { | |
32 keyboard::KeyboardController::GetInstance()->ShowKeyboard(true); | |
33 } | |
34 void ShowInDisplay(const int64_t display_id) override { | 30 void ShowInDisplay(const int64_t display_id) override { |
35 keyboard::KeyboardController::GetInstance()->ShowKeyboardInDisplay( | 31 keyboard::KeyboardController::GetInstance()->ShowKeyboardInDisplay( |
36 display_id); | 32 display_id); |
37 } | 33 } |
38 void Hide() override { | 34 void Hide() override { |
39 // Do nothing as this is called from ash::Shell, which also calls through | 35 // Do nothing as this is called from ash::Shell, which also calls through |
40 // to the appropriate keyboard functions. | 36 // to the appropriate keyboard functions. |
41 } | 37 } |
42 bool IsEnabled() override { | 38 bool IsEnabled() override { |
43 return Shell::GetInstance() | 39 return Shell::GetInstance() |
(...skipping 30 matching lines...) Expand all Loading... |
74 observers_.AddObserver(observer); | 70 observers_.AddObserver(observer); |
75 } | 71 } |
76 | 72 |
77 void KeyboardUI::RemoveObserver(KeyboardUIObserver* observer) { | 73 void KeyboardUI::RemoveObserver(KeyboardUIObserver* observer) { |
78 observers_.RemoveObserver(observer); | 74 observers_.RemoveObserver(observer); |
79 } | 75 } |
80 | 76 |
81 KeyboardUI::KeyboardUI() {} | 77 KeyboardUI::KeyboardUI() {} |
82 | 78 |
83 } // namespace ash | 79 } // namespace ash |
OLD | NEW |