| OLD | NEW |
| (Empty) |
| 1 // Copyright 2012 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 #ifndef ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ | |
| 6 #define ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include "ash/common/system/accessibility_observer.h" | |
| 11 #include "ash/common/system/tray/system_tray_delegate.h" | |
| 12 #include "ash/common/system/tray/system_tray_item.h" | |
| 13 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" | |
| 14 #include "ash/system/ime/ime_observer.h" | |
| 15 #include "base/macros.h" | |
| 16 | |
| 17 namespace views { | |
| 18 class Label; | |
| 19 } | |
| 20 | |
| 21 namespace ash { | |
| 22 struct IMEInfo; | |
| 23 | |
| 24 namespace tray { | |
| 25 class IMEDefaultView; | |
| 26 class IMEDetailedView; | |
| 27 class IMENotificationView; | |
| 28 } | |
| 29 | |
| 30 class TrayItemView; | |
| 31 | |
| 32 class ASH_EXPORT TrayIME : public SystemTrayItem, | |
| 33 public IMEObserver, | |
| 34 public AccessibilityObserver, | |
| 35 public VirtualKeyboardObserver { | |
| 36 public: | |
| 37 explicit TrayIME(SystemTray* system_tray); | |
| 38 ~TrayIME() override; | |
| 39 | |
| 40 // Overridden from VirtualKeyboardObserver. | |
| 41 void OnKeyboardSuppressionChanged(bool suppressed) override; | |
| 42 | |
| 43 // Overridden from AccessibilityObserver: | |
| 44 void OnAccessibilityModeChanged( | |
| 45 AccessibilityNotificationVisibility notify) override; | |
| 46 | |
| 47 private: | |
| 48 friend class TrayIMETest; | |
| 49 | |
| 50 // Repopulates the DefaultView and DetailedView. | |
| 51 void Update(); | |
| 52 // Updates the System Tray label. | |
| 53 void UpdateTrayLabel(const IMEInfo& info, size_t count); | |
| 54 // Returns whether the virtual keyboard toggle should be shown in the | |
| 55 // detailed view. | |
| 56 bool ShouldShowKeyboardToggle(); | |
| 57 // Returns the appropriate label for the detailed view. | |
| 58 base::string16 GetDefaultViewLabel(bool show_ime_label); | |
| 59 | |
| 60 // Overridden from SystemTrayItem. | |
| 61 views::View* CreateTrayView(LoginStatus status) override; | |
| 62 views::View* CreateDefaultView(LoginStatus status) override; | |
| 63 views::View* CreateDetailedView(LoginStatus status) override; | |
| 64 void DestroyTrayView() override; | |
| 65 void DestroyDefaultView() override; | |
| 66 void DestroyDetailedView() override; | |
| 67 void UpdateAfterLoginStatusChange(LoginStatus status) override; | |
| 68 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override; | |
| 69 | |
| 70 // Overridden from IMEObserver. | |
| 71 void OnIMERefresh() override; | |
| 72 void OnIMEMenuActivationChanged(bool is_active) override; | |
| 73 | |
| 74 // Whether the default view should be shown. | |
| 75 bool ShouldDefaultViewBeVisible(); | |
| 76 | |
| 77 TrayItemView* tray_label_; | |
| 78 tray::IMEDefaultView* default_; | |
| 79 tray::IMEDetailedView* detailed_; | |
| 80 // Whether the virtual keyboard is suppressed. | |
| 81 bool keyboard_suppressed_; | |
| 82 // Cached IME info. | |
| 83 IMEInfoList ime_list_; | |
| 84 IMEInfo current_ime_; | |
| 85 IMEPropertyInfoList property_list_; | |
| 86 // Whether the IME label and tray items should be visible. | |
| 87 bool is_visible_; | |
| 88 | |
| 89 DISALLOW_COPY_AND_ASSIGN(TrayIME); | |
| 90 }; | |
| 91 | |
| 92 } // namespace ash | |
| 93 | |
| 94 #endif // ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ | |
| OLD | NEW |