OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_H_ | 5 #ifndef ASH_SYSTEM_IME_TRAY_IME_H_ |
6 #define ASH_SYSTEM_IME_TRAY_IME_H_ | 6 #define ASH_SYSTEM_IME_TRAY_IME_H_ |
7 | 7 |
8 #include "ash/system/ime/ime_observer.h" | 8 #include "ash/system/ime/ime_observer.h" |
9 #include "ash/system/tray/system_tray_item.h" | 9 #include "ash/system/tray/system_tray_item.h" |
10 #include "base/memory/weak_ptr.h" | |
11 | 10 |
12 namespace views { | 11 namespace views { |
13 class Label; | 12 class Label; |
14 } | 13 } |
15 | 14 |
16 namespace ash { | 15 namespace ash { |
17 | 16 |
18 struct IMEInfo; | 17 struct IMEInfo; |
19 | 18 |
20 namespace internal { | 19 namespace internal { |
21 | 20 |
22 namespace tray { | 21 namespace tray { |
23 class IMEDefaultView; | 22 class IMEDefaultView; |
24 class IMEDetailedView; | 23 class IMEDetailedView; |
25 class IMENotificationView; | 24 class IMENotificationView; |
26 } | 25 } |
27 | 26 |
28 class TrayItemView; | 27 class TrayItemView; |
29 | 28 |
30 class TrayIME : public SystemTrayItem, | 29 class TrayIME : public SystemTrayItem, |
31 public IMEObserver { | 30 public IMEObserver { |
32 public: | 31 public: |
33 explicit TrayIME(SystemTray* system_tray); | 32 explicit TrayIME(SystemTray* system_tray); |
34 virtual ~TrayIME(); | 33 virtual ~TrayIME(); |
35 | 34 |
36 private: | 35 private: |
37 void UpdateTrayLabel(const IMEInfo& info, size_t count); | 36 void UpdateTrayLabel(const IMEInfo& info, size_t count); |
38 | 37 |
39 // Update the content of the existing IME notification, or create a new one if | |
40 // necessary. IME notification should be created only once in a session, i.e. | |
41 // if an IME notification is created and removed already, it doesn't create a | |
42 // new one. | |
43 void UpdateOrCreateNotification(); | |
44 | |
45 // Overridden from SystemTrayItem. | 38 // Overridden from SystemTrayItem. |
46 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; | 39 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; |
47 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | 40 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; |
48 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; | 41 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; |
49 virtual void DestroyTrayView() OVERRIDE; | 42 virtual void DestroyTrayView() OVERRIDE; |
50 virtual void DestroyDefaultView() OVERRIDE; | 43 virtual void DestroyDefaultView() OVERRIDE; |
51 virtual void DestroyDetailedView() OVERRIDE; | 44 virtual void DestroyDetailedView() OVERRIDE; |
52 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; | 45 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; |
53 virtual void UpdateAfterShelfAlignmentChange( | 46 virtual void UpdateAfterShelfAlignmentChange( |
54 ShelfAlignment alignment) OVERRIDE; | 47 ShelfAlignment alignment) OVERRIDE; |
55 | 48 |
56 // Overridden from IMEObserver. | 49 // Overridden from IMEObserver. |
57 virtual void OnIMERefresh(bool show_message) OVERRIDE; | 50 virtual void OnIMERefresh() OVERRIDE; |
58 | 51 |
59 TrayItemView* tray_label_; | 52 TrayItemView* tray_label_; |
60 tray::IMEDefaultView* default_; | 53 tray::IMEDefaultView* default_; |
61 tray::IMEDetailedView* detailed_; | 54 tray::IMEDetailedView* detailed_; |
62 | 55 |
63 bool message_shown_; | |
64 | |
65 base::WeakPtrFactory<TrayIME> weak_factory_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(TrayIME); | 56 DISALLOW_COPY_AND_ASSIGN(TrayIME); |
68 }; | 57 }; |
69 | 58 |
70 } // namespace internal | 59 } // namespace internal |
71 } // namespace ash | 60 } // namespace ash |
72 | 61 |
73 #endif // ASH_SYSTEM_IME_TRAY_IME_H_ | 62 #endif // ASH_SYSTEM_IME_TRAY_IME_H_ |
OLD | NEW |