OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SYSTEM_CHROMEOS_VIRTUAL_KEYBOARD_TRAY_KEYBOARD_LOCK_H | 5 #ifndef ASH_SYSTEM_CHROMEOS_VIRTUAL_KEYBOARD_TRAY_KEYBOARD_LOCK_H |
6 #define ASH_SYSTEM_CHROMEOS_VIRTUAL_KEYBOARD_TRAY_KEYBOARD_LOCK_H | 6 #define ASH_SYSTEM_CHROMEOS_VIRTUAL_KEYBOARD_TRAY_KEYBOARD_LOCK_H |
7 | 7 |
8 #include "ash/shell_observer.h" | 8 #include "ash/shell_observer.h" |
9 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" | 9 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" |
10 #include "ash/system/tray/system_tray_notifier.h" | 10 #include "ash/system/tray/system_tray_notifier.h" |
11 #include "ash/system/tray/tray_image_item.h" | 11 #include "ash/system/tray/tray_image_item.h" |
12 #include "ash/system/tray_accessibility.h" | 12 #include "ash/system/tray_accessibility.h" |
13 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 13 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
14 | 14 |
15 namespace ash { | 15 namespace ash { |
16 | 16 |
17 // TrayKeyboardLock is a provider of views for the SystemTray. Both a tray view | 17 // TrayKeyboardLock is a provider of the default view for the SystemTray. This |
18 // and a default view are provided. Each view indicates the current state of | 18 // view indicates the current state of the virtual keyboard when an external |
19 // the virtual keyboard when an external keyboard is plugged in. The default | 19 // keyboard is plugged in. The default view can be interacted with, it toggles |
20 // view can be interacted with, it toggles the state of the keyboard lock. | 20 // the state of the keyboard lock. |
21 class ASH_EXPORT TrayKeyboardLock : public TrayImageItem, | 21 class ASH_EXPORT TrayKeyboardLock : public SystemTrayItem, |
22 public VirtualKeyboardObserver, | 22 public VirtualKeyboardObserver { |
23 public AccessibilityObserver { | |
24 public: | 23 public: |
25 explicit TrayKeyboardLock(SystemTray* system_tray); | 24 explicit TrayKeyboardLock(SystemTray* system_tray); |
26 virtual ~TrayKeyboardLock(); | 25 virtual ~TrayKeyboardLock(); |
27 | 26 |
28 // VirtualKeyboardObserver | 27 // VirtualKeyboardObserver |
29 virtual void OnKeyboardSuppressionChanged(bool suppressed) override; | 28 virtual void OnKeyboardSuppressionChanged(bool suppressed) override; |
30 | 29 |
31 // SystemTrayItem: | 30 // SystemTrayItem: |
32 virtual views::View* CreateDefaultView(user::LoginStatus status) override; | 31 virtual views::View* CreateDefaultView(user::LoginStatus status) override; |
33 | 32 |
34 // AccessibilityObserver: | |
35 void OnAccessibilityModeChanged( | |
36 ui::AccessibilityNotificationVisibility notify) override; | |
37 | |
38 protected: | |
39 // TrayImageItem: | |
40 virtual bool GetInitialVisibility() override; | |
41 | |
42 private: | 33 private: |
43 friend class TrayKeyboardLockTest; | 34 friend class TrayKeyboardLockTest; |
44 | 35 |
45 // True if the virtual keyboard is suppressed by an external keyboard. | |
46 bool ShouldTrayBeVisible(); | |
47 | |
48 // True if the on-screen keyboard is suppressed. | 36 // True if the on-screen keyboard is suppressed. |
49 bool virtual_keyboard_suppressed_; | 37 bool virtual_keyboard_suppressed_; |
50 | 38 |
51 DISALLOW_COPY_AND_ASSIGN(TrayKeyboardLock); | 39 DISALLOW_COPY_AND_ASSIGN(TrayKeyboardLock); |
52 }; | 40 }; |
53 | 41 |
54 } // namespace ash | 42 } // namespace ash |
55 | 43 |
56 #endif // ASH_SYSTEM_CHROMEOS_VIRTUAL_KEYBOARD_TRAY_KEYBOARD_LOCK_H | 44 #endif // ASH_SYSTEM_CHROMEOS_VIRTUAL_KEYBOARD_TRAY_KEYBOARD_LOCK_H |
OLD | NEW |