Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ash / system / ime / tray_ime_chromeos.h
blob8ff1a87f3a234c3d2d01a6afd30d3d71f6736417
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.
5 #ifndef ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_
6 #define ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_
8 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h"
9 #include "ash/system/ime/ime_observer.h"
10 #include "ash/system/tray/system_tray_delegate.h"
11 #include "ash/system/tray/system_tray_item.h"
12 #include "ash/system/tray_accessibility.h"
14 namespace views {
15 class Label;
18 namespace ash {
19 struct IMEInfo;
21 namespace tray {
22 class IMEDefaultView;
23 class IMEDetailedView;
24 class IMENotificationView;
27 class TrayItemView;
29 class ASH_EXPORT TrayIME : public SystemTrayItem,
30 public IMEObserver,
31 public AccessibilityObserver,
32 public VirtualKeyboardObserver {
33 public:
34 explicit TrayIME(SystemTray* system_tray);
35 ~TrayIME() override;
37 // Overridden from VirtualKeyboardObserver.
38 void OnKeyboardSuppressionChanged(bool suppressed) override;
40 // Overridden from AccessibilityObserver:
41 void OnAccessibilityModeChanged(
42 ui::AccessibilityNotificationVisibility notify) override;
44 private:
45 friend class TrayIMETest;
47 // Repopulates the DefaultView and DetailedView.
48 void Update();
49 // Updates the System Tray label.
50 void UpdateTrayLabel(const IMEInfo& info, size_t count);
51 // Returns whether the virtual keyboard toggle should be shown in the
52 // detailed view.
53 bool ShouldShowKeyboardToggle();
54 // Returns the appropriate label for the detailed view.
55 base::string16 GetDefaultViewLabel(bool show_ime_label);
57 // Overridden from SystemTrayItem.
58 views::View* CreateTrayView(user::LoginStatus status) override;
59 views::View* CreateDefaultView(user::LoginStatus status) override;
60 views::View* CreateDetailedView(user::LoginStatus status) override;
61 void DestroyTrayView() override;
62 void DestroyDefaultView() override;
63 void DestroyDetailedView() override;
64 void UpdateAfterLoginStatusChange(user::LoginStatus status) override;
65 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override;
67 // Overridden from IMEObserver.
68 void OnIMERefresh() override;
70 // Whether the default view should be shown.
71 bool ShouldDefaultViewBeVisible();
73 TrayItemView* tray_label_;
74 tray::IMEDefaultView* default_;
75 tray::IMEDetailedView* detailed_;
76 // Whether the virtual keyboard is suppressed.
77 bool keyboard_suppressed_;
78 // Cached IME info.
79 IMEInfoList ime_list_;
80 IMEInfo current_ime_;
81 IMEPropertyInfoList property_list_;
83 DISALLOW_COPY_AND_ASSIGN(TrayIME);
86 } // namespace ash
88 #endif // ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_