| 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_COMMON_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ | |
| 6 #define ASH_COMMON_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/chromeos/ime_menu/ime_list_view.h" | |
| 12 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_observer.
h" | |
| 13 #include "ash/common/system/ime/ime_observer.h" | |
| 14 #include "ash/common/system/tray/ime_info.h" | |
| 15 #include "ash/common/system/tray/system_tray_item.h" | |
| 16 #include "base/macros.h" | |
| 17 | |
| 18 namespace ash { | |
| 19 | |
| 20 namespace tray { | |
| 21 class IMEDefaultView; | |
| 22 class IMEDetailedView; | |
| 23 } | |
| 24 | |
| 25 class TrayItemView; | |
| 26 | |
| 27 class ASH_EXPORT TrayIME : public SystemTrayItem, | |
| 28 public IMEObserver, | |
| 29 public AccessibilityObserver, | |
| 30 public VirtualKeyboardObserver { | |
| 31 public: | |
| 32 explicit TrayIME(SystemTray* system_tray); | |
| 33 ~TrayIME() override; | |
| 34 | |
| 35 // Overridden from VirtualKeyboardObserver. | |
| 36 void OnKeyboardSuppressionChanged(bool suppressed) override; | |
| 37 | |
| 38 // Overridden from AccessibilityObserver: | |
| 39 void OnAccessibilityModeChanged( | |
| 40 AccessibilityNotificationVisibility notify) override; | |
| 41 | |
| 42 private: | |
| 43 friend class TrayIMETest; | |
| 44 | |
| 45 // Repopulates the DefaultView and DetailedView. | |
| 46 void Update(); | |
| 47 // Updates the System Tray label. | |
| 48 void UpdateTrayLabel(const IMEInfo& info, size_t count); | |
| 49 // Returns whether the virtual keyboard toggle should be shown in the | |
| 50 // detailed view. | |
| 51 bool ShouldShowKeyboardToggle(); | |
| 52 // Returns the appropriate label for the detailed view. | |
| 53 base::string16 GetDefaultViewLabel(bool show_ime_label); | |
| 54 | |
| 55 // Overridden from SystemTrayItem. | |
| 56 views::View* CreateTrayView(LoginStatus status) override; | |
| 57 views::View* CreateDefaultView(LoginStatus status) override; | |
| 58 views::View* CreateDetailedView(LoginStatus status) override; | |
| 59 void DestroyTrayView() override; | |
| 60 void DestroyDefaultView() override; | |
| 61 void DestroyDetailedView() override; | |
| 62 void UpdateAfterLoginStatusChange(LoginStatus status) override; | |
| 63 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override; | |
| 64 | |
| 65 // Overridden from IMEObserver. | |
| 66 void OnIMERefresh() override; | |
| 67 void OnIMEMenuActivationChanged(bool is_active) override; | |
| 68 | |
| 69 // Returns true input methods are managed by policy. | |
| 70 bool IsIMEManaged(); | |
| 71 | |
| 72 // Whether the default view should be shown. | |
| 73 bool ShouldDefaultViewBeVisible(); | |
| 74 | |
| 75 // Decides if a tray icon should be shown. | |
| 76 bool ShouldShowImeTrayItem(size_t ime_count); | |
| 77 // Mandates behavior for the single IME case for the detailed IME list | |
| 78 // sub-view. | |
| 79 ImeListView::SingleImeBehavior GetSingleImeBehavior(); | |
| 80 | |
| 81 TrayItemView* tray_label_; | |
| 82 tray::IMEDefaultView* default_; | |
| 83 tray::IMEDetailedView* detailed_; | |
| 84 // Whether the virtual keyboard is suppressed. | |
| 85 bool keyboard_suppressed_; | |
| 86 // Cached IME info. | |
| 87 IMEInfoList ime_list_; | |
| 88 IMEInfo current_ime_; | |
| 89 IMEPropertyInfoList property_list_; | |
| 90 // If non-empty, a controlled-setting icon should be displayed with a tooltip | |
| 91 // text defined by this string. | |
| 92 base::string16 ime_managed_message_; | |
| 93 | |
| 94 // Whether the IME label and tray items should be visible. | |
| 95 bool is_visible_; | |
| 96 | |
| 97 DISALLOW_COPY_AND_ASSIGN(TrayIME); | |
| 98 }; | |
| 99 | |
| 100 } // namespace ash | |
| 101 | |
| 102 #endif // ASH_COMMON_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ | |
| OLD | NEW |