OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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_IME_TRAY_IME_CHROMEOS_H_ | 5 #ifndef ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ |
6 #define ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ | 6 #define ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "ash/system/accessibility_observer.h" | 10 #include "ash/system/accessibility_observer.h" |
11 #include "ash/system/ime/ime_observer.h" | |
12 #include "ash/system/ime_menu/ime_list_view.h" | 11 #include "ash/system/ime_menu/ime_list_view.h" |
13 #include "ash/system/tray/ime_info.h" | 12 #include "ash/system/tray/ime_info.h" |
14 #include "ash/system/tray/system_tray_item.h" | 13 #include "ash/system/tray/system_tray_item.h" |
15 #include "ash/system/virtual_keyboard/virtual_keyboard_observer.h" | 14 #include "ash/system/virtual_keyboard/virtual_keyboard_observer.h" |
16 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 17 #include "ui/chromeos/ime/input_method_menu_manager.h" |
17 | 18 |
18 namespace ash { | 19 namespace ash { |
19 | 20 |
20 namespace tray { | 21 namespace tray { |
21 class IMEDefaultView; | 22 class IMEDefaultView; |
22 class IMEDetailedView; | 23 class IMEDetailedView; |
23 } | 24 } |
24 | 25 |
25 class TrayItemView; | 26 class TrayItemView; |
26 | 27 |
27 // Controller for IME options in the system menu. Note this is separate from | 28 // Controller for IME options in the system menu. Note this is separate from |
28 // the "opt-in" IME menu which can appear as a button in the system tray | 29 // the "opt-in" IME menu which can appear as a button in the system tray |
29 // area; that is controlled by ImeMenuTray. | 30 // area; that is controlled by ImeMenuTray. |
30 class ASH_EXPORT TrayIME : public SystemTrayItem, | 31 class ASH_EXPORT TrayIME |
31 public IMEObserver, | 32 : public SystemTrayItem, |
32 public AccessibilityObserver, | 33 public AccessibilityObserver, |
33 public VirtualKeyboardObserver { | 34 public VirtualKeyboardObserver, |
| 35 public chromeos::input_method::InputMethodManager::Observer, |
| 36 public chromeos::input_method::InputMethodManager::ImeMenuObserver, |
| 37 public ui::ime::InputMethodMenuManager::Observer { |
34 public: | 38 public: |
35 explicit TrayIME(SystemTray* system_tray); | 39 explicit TrayIME(SystemTray* system_tray); |
36 ~TrayIME() override; | 40 ~TrayIME() override; |
37 | 41 |
38 // Overridden from VirtualKeyboardObserver. | 42 // Overridden from VirtualKeyboardObserver. |
39 void OnKeyboardSuppressionChanged(bool suppressed) override; | 43 void OnKeyboardSuppressionChanged(bool suppressed) override; |
40 | 44 |
41 // Overridden from AccessibilityObserver: | 45 // Overridden from AccessibilityObserver: |
42 void OnAccessibilityModeChanged( | 46 void OnAccessibilityModeChanged( |
43 AccessibilityNotificationVisibility notify) override; | 47 AccessibilityNotificationVisibility notify) override; |
(...skipping 12 matching lines...) Expand all Loading... |
56 base::string16 GetDefaultViewLabel(bool show_ime_label); | 60 base::string16 GetDefaultViewLabel(bool show_ime_label); |
57 | 61 |
58 // Overridden from SystemTrayItem. | 62 // Overridden from SystemTrayItem. |
59 views::View* CreateTrayView(LoginStatus status) override; | 63 views::View* CreateTrayView(LoginStatus status) override; |
60 views::View* CreateDefaultView(LoginStatus status) override; | 64 views::View* CreateDefaultView(LoginStatus status) override; |
61 views::View* CreateDetailedView(LoginStatus status) override; | 65 views::View* CreateDetailedView(LoginStatus status) override; |
62 void DestroyTrayView() override; | 66 void DestroyTrayView() override; |
63 void DestroyDefaultView() override; | 67 void DestroyDefaultView() override; |
64 void DestroyDetailedView() override; | 68 void DestroyDetailedView() override; |
65 | 69 |
66 // Overridden from IMEObserver. | 70 void RefreshCurrentIme(); |
67 void OnIMERefresh() override; | 71 |
68 void OnIMEMenuActivationChanged(bool is_active) override; | 72 // chromeos::input_method::InputMethodManager::Observer: |
| 73 void InputMethodChanged(chromeos::input_method::InputMethodManager* manager, |
| 74 Profile* profile, |
| 75 bool show_message) override; |
| 76 |
| 77 // chromeos::input_method::InputMethodManager::ImeMenuObserver: |
| 78 void ImeMenuActivationChanged(bool is_active) override; |
| 79 void ImeMenuListChanged() override; |
| 80 void ImeMenuItemsChanged( |
| 81 const std::string& engine_id, |
| 82 const std::vector<chromeos::input_method::InputMethodManager::MenuItem>& |
| 83 items) override; |
| 84 |
| 85 // ui::ime::InputMethodMenuManager::Observer: |
| 86 void InputMethodMenuItemChanged( |
| 87 ui::ime::InputMethodMenuManager* manager) override; |
69 | 88 |
70 // Returns true input methods are managed by policy. | 89 // Returns true input methods are managed by policy. |
71 bool IsIMEManaged(); | 90 bool IsIMEManaged(); |
72 | 91 |
73 // Whether the default view should be shown. | 92 // Whether the default view should be shown. |
74 bool ShouldDefaultViewBeVisible(); | 93 bool ShouldDefaultViewBeVisible(); |
75 | 94 |
76 // Decides if a tray icon should be shown. | 95 // Decides if a tray icon should be shown. |
77 bool ShouldShowImeTrayItem(size_t ime_count); | 96 bool ShouldShowImeTrayItem(size_t ime_count); |
| 97 |
78 // Mandates behavior for the single IME case for the detailed IME list | 98 // Mandates behavior for the single IME case for the detailed IME list |
79 // sub-view. | 99 // sub-view. |
80 ImeListView::SingleImeBehavior GetSingleImeBehavior(); | 100 ImeListView::SingleImeBehavior GetSingleImeBehavior(); |
81 | 101 |
82 TrayItemView* tray_label_; | 102 TrayItemView* tray_label_; |
83 tray::IMEDefaultView* default_; | 103 tray::IMEDefaultView* default_; |
84 tray::IMEDetailedView* detailed_; | 104 tray::IMEDetailedView* detailed_; |
85 // Whether the virtual keyboard is suppressed. | 105 // Whether the virtual keyboard is suppressed. |
86 bool keyboard_suppressed_; | 106 bool keyboard_suppressed_; |
87 // Cached IME info. | 107 // Cached IME info. |
88 IMEInfoList ime_list_; | 108 IMEInfoList ime_list_; |
89 IMEInfo current_ime_; | 109 IMEInfo current_ime_; |
90 IMEPropertyInfoList property_list_; | 110 IMEPropertyInfoList property_list_; |
91 // If non-empty, a controlled-setting icon should be displayed with a tooltip | 111 // If non-empty, a controlled-setting icon should be displayed with a tooltip |
92 // text defined by this string. | 112 // text defined by this string. |
93 base::string16 ime_managed_message_; | 113 base::string16 ime_managed_message_; |
94 | 114 |
95 // Whether the IME label and tray items should be visible. | 115 // Whether the IME label and tray items should be visible. |
96 bool is_visible_; | 116 bool is_visible_; |
97 | 117 |
98 DISALLOW_COPY_AND_ASSIGN(TrayIME); | 118 DISALLOW_COPY_AND_ASSIGN(TrayIME); |
99 }; | 119 }; |
100 | 120 |
101 } // namespace ash | 121 } // namespace ash |
102 | 122 |
103 #endif // ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ | 123 #endif // ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_ |
OLD | NEW |