| 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 #ifndef ASH_SYSTEM_IME_MENU_IME_MENU_TRAY_H_ | 5 #ifndef ASH_SYSTEM_IME_MENU_IME_MENU_TRAY_H_ |
| 6 #define ASH_SYSTEM_IME_MENU_IME_MENU_TRAY_H_ | 6 #define ASH_SYSTEM_IME_MENU_IME_MENU_TRAY_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/system/ime/ime_observer.h" | |
| 10 #include "ash/system/tray/ime_info.h" | 9 #include "ash/system/tray/ime_info.h" |
| 11 #include "ash/system/tray/tray_background_view.h" | 10 #include "ash/system/tray/tray_background_view.h" |
| 12 #include "ash/system/tray/tray_bubble_wrapper.h" | 11 #include "ash/system/tray/tray_bubble_wrapper.h" |
| 13 #include "ash/system/virtual_keyboard/virtual_keyboard_observer.h" | 12 #include "ash/system/virtual_keyboard/virtual_keyboard_observer.h" |
| 14 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 15 #include "ui/chromeos/ime/input_method_menu_manager.h" |
| 15 #include "ui/keyboard/keyboard_controller_observer.h" | 16 #include "ui/keyboard/keyboard_controller_observer.h" |
| 16 #include "ui/views/bubble/tray_bubble_view.h" | 17 #include "ui/views/bubble/tray_bubble_view.h" |
| 17 | 18 |
| 18 namespace views { | 19 namespace views { |
| 19 class Label; | 20 class Label; |
| 20 } // namespace views | 21 } // namespace views |
| 21 | 22 |
| 22 namespace ash { | 23 namespace ash { |
| 23 class ImeListView; | 24 class ImeListView; |
| 24 | 25 |
| 25 // A button in the tray which displays the short name of the currently-activated | 26 // A button in the tray which displays the short name of the currently-activated |
| 26 // IME (e.g., 'GB', 'US'). Clicking this button opens the opt-in IME menu, | 27 // IME (e.g., 'GB', 'US'). Clicking this button opens the opt-in IME menu, |
| 27 // a standalone bubble displaying a list of available IMEs along with buttons | 28 // a standalone bubble displaying a list of available IMEs along with buttons |
| 28 // for emoji, handwriting, and voice. | 29 // for emoji, handwriting, and voice. |
| 29 class ASH_EXPORT ImeMenuTray : public TrayBackgroundView, | 30 class ASH_EXPORT ImeMenuTray |
| 30 public IMEObserver, | 31 : public TrayBackgroundView, |
| 31 public views::TrayBubbleView::Delegate, | 32 public views::TrayBubbleView::Delegate, |
| 32 public keyboard::KeyboardControllerObserver, | 33 public keyboard::KeyboardControllerObserver, |
| 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 ImeMenuTray(Shelf* shelf); | 39 explicit ImeMenuTray(Shelf* shelf); |
| 36 ~ImeMenuTray() override; | 40 ~ImeMenuTray() override; |
| 37 | 41 |
| 38 // Shows the IME menu bubble and highlights the button. | 42 // Shows the IME menu bubble and highlights the button. |
| 39 void ShowImeMenuBubble(); | 43 void ShowImeMenuBubble(); |
| 40 | 44 |
| 41 // Hides the IME menu bubble and lowlights the button. | 45 // Hides the IME menu bubble and lowlights the button. |
| 42 void HideImeMenuBubble(); | 46 void HideImeMenuBubble(); |
| 43 | 47 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 56 // Returns whether the virtual keyboard toggle should be shown in shown in the | 60 // Returns whether the virtual keyboard toggle should be shown in shown in the |
| 57 // opt-in IME menu. | 61 // opt-in IME menu. |
| 58 bool ShouldShowKeyboardToggle() const; | 62 bool ShouldShowKeyboardToggle() const; |
| 59 | 63 |
| 60 // TrayBackgroundView: | 64 // TrayBackgroundView: |
| 61 base::string16 GetAccessibleNameForTray() override; | 65 base::string16 GetAccessibleNameForTray() override; |
| 62 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; | 66 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; |
| 63 void ClickedOutsideBubble() override; | 67 void ClickedOutsideBubble() override; |
| 64 bool PerformAction(const ui::Event& event) override; | 68 bool PerformAction(const ui::Event& event) override; |
| 65 | 69 |
| 66 // IMEObserver: | 70 void RefreshCurrentIme(); |
| 67 void OnIMERefresh() override; | 71 |
| 68 void OnIMEMenuActivationChanged(bool is_activated) 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 // views::TrayBubbleView::Delegate: | 89 // views::TrayBubbleView::Delegate: |
| 71 void BubbleViewDestroyed() override; | 90 void BubbleViewDestroyed() override; |
| 72 void OnMouseEnteredView() override; | 91 void OnMouseEnteredView() override; |
| 73 void OnMouseExitedView() override; | 92 void OnMouseExitedView() override; |
| 74 base::string16 GetAccessibleNameForBubble() override; | 93 base::string16 GetAccessibleNameForBubble() override; |
| 75 void HideBubble(const views::TrayBubbleView* bubble_view) override; | 94 void HideBubble(const views::TrayBubbleView* bubble_view) override; |
| 76 | 95 |
| 77 // keyboard::KeyboardControllerObserver: | 96 // keyboard::KeyboardControllerObserver: |
| 78 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | 97 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 107 bool show_bubble_after_keyboard_hidden_; | 126 bool show_bubble_after_keyboard_hidden_; |
| 108 | 127 |
| 109 base::WeakPtrFactory<ImeMenuTray> weak_ptr_factory_; | 128 base::WeakPtrFactory<ImeMenuTray> weak_ptr_factory_; |
| 110 | 129 |
| 111 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray); | 130 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray); |
| 112 }; | 131 }; |
| 113 | 132 |
| 114 } // namespace ash | 133 } // namespace ash |
| 115 | 134 |
| 116 #endif // ASH_SYSTEM_IME_MENU_IME_MENU_TRAY_H_ | 135 #endif // ASH_SYSTEM_IME_MENU_IME_MENU_TRAY_H_ |
| OLD | NEW |