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_TRAY_SYSTEM_TRAY_H_ | 5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/launcher/background_animator.h" | 9 #include "ash/launcher/background_animator.h" |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 class ASH_EXPORT SystemTray : NON_EXPORTED_BASE( | 43 class ASH_EXPORT SystemTray : NON_EXPORTED_BASE( |
44 public internal::ActionableView), | 44 public internal::ActionableView), |
45 public views::Widget::Observer, | 45 public views::Widget::Observer, |
46 public internal::BackgroundAnimatorDelegate, | 46 public internal::BackgroundAnimatorDelegate, |
47 public base::MessagePumpObserver { | 47 public base::MessagePumpObserver { |
48 public: | 48 public: |
49 SystemTray(); | 49 SystemTray(); |
50 virtual ~SystemTray(); | 50 virtual ~SystemTray(); |
51 | 51 |
| 52 // Creates the default set of items for the sytem tray. |
| 53 void CreateItems(); |
| 54 |
| 55 // Creates the widget for the tray. |
| 56 void CreateWidget(); |
| 57 |
52 // Adds a new item in the tray. | 58 // Adds a new item in the tray. |
53 void AddTrayItem(SystemTrayItem* item); | 59 void AddTrayItem(SystemTrayItem* item); |
54 | 60 |
55 // Removes an existing tray item. | 61 // Removes an existing tray item. |
56 void RemoveTrayItem(SystemTrayItem* item); | 62 void RemoveTrayItem(SystemTrayItem* item); |
57 | 63 |
58 // Shows the default view of all items. | 64 // Shows the default view of all items. |
59 void ShowDefaultView(); | 65 void ShowDefaultView(); |
60 | 66 |
61 // Shows details of a particular item. If |close_delay_in_seconds| is | 67 // Shows details of a particular item. If |close_delay_in_seconds| is |
(...skipping 13 matching lines...) Expand all Loading... |
75 | 81 |
76 // Sets whether the tray paints a background. Default is true, but is set to | 82 // Sets whether the tray paints a background. Default is true, but is set to |
77 // false if a window overlaps the shelf. | 83 // false if a window overlaps the shelf. |
78 void SetPaintsBackground( | 84 void SetPaintsBackground( |
79 bool value, | 85 bool value, |
80 internal::BackgroundAnimator::ChangeType change_type); | 86 internal::BackgroundAnimator::ChangeType change_type); |
81 | 87 |
82 // Returns true if the launcher should show. | 88 // Returns true if the launcher should show. |
83 bool should_show_launcher() const { return popup_ && should_show_launcher_; } | 89 bool should_show_launcher() const { return popup_ && should_show_launcher_; } |
84 | 90 |
| 91 views::Widget* widget() const { return widget_; } |
| 92 |
85 AccessibilityObserver* accessibility_observer() const { | 93 AccessibilityObserver* accessibility_observer() const { |
86 return accessibility_observer_; | 94 return accessibility_observer_; |
87 } | 95 } |
88 AudioObserver* audio_observer() const { | 96 AudioObserver* audio_observer() const { |
89 return audio_observer_; | 97 return audio_observer_; |
90 } | 98 } |
91 BluetoothObserver* bluetooth_observer() const { | 99 BluetoothObserver* bluetooth_observer() const { |
92 return bluetooth_observer_; | 100 return bluetooth_observer_; |
93 } | 101 } |
94 BrightnessObserver* brightness_observer() const { | 102 BrightnessObserver* brightness_observer() const { |
(...skipping 15 matching lines...) Expand all Loading... |
110 return power_status_observer_; | 118 return power_status_observer_; |
111 } | 119 } |
112 UpdateObserver* update_observer() const { | 120 UpdateObserver* update_observer() const { |
113 return update_observer_; | 121 return update_observer_; |
114 } | 122 } |
115 UserObserver* user_observer() const { | 123 UserObserver* user_observer() const { |
116 return user_observer_; | 124 return user_observer_; |
117 } | 125 } |
118 | 126 |
119 private: | 127 private: |
120 friend class Shell; | |
121 | |
122 void ShowItems(std::vector<SystemTrayItem*>& items, | 128 void ShowItems(std::vector<SystemTrayItem*>& items, |
123 bool details, | 129 bool details, |
124 bool activate); | 130 bool activate); |
125 | 131 |
126 // Overridden from internal::ActionableView. | 132 // Overridden from internal::ActionableView. |
127 virtual bool PerformAction(const views::Event& event) OVERRIDE; | 133 virtual bool PerformAction(const views::Event& event) OVERRIDE; |
128 | 134 |
129 // Overridden from views::View. | 135 // Overridden from views::View. |
130 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 136 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
131 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 137 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
(...skipping 25 matching lines...) Expand all Loading... |
157 BluetoothObserver* bluetooth_observer_; | 163 BluetoothObserver* bluetooth_observer_; |
158 BrightnessObserver* brightness_observer_; | 164 BrightnessObserver* brightness_observer_; |
159 CapsLockObserver* caps_lock_observer_; | 165 CapsLockObserver* caps_lock_observer_; |
160 ClockObserver* clock_observer_; | 166 ClockObserver* clock_observer_; |
161 IMEObserver* ime_observer_; | 167 IMEObserver* ime_observer_; |
162 NetworkObserver* network_observer_; | 168 NetworkObserver* network_observer_; |
163 PowerStatusObserver* power_status_observer_; | 169 PowerStatusObserver* power_status_observer_; |
164 UpdateObserver* update_observer_; | 170 UpdateObserver* update_observer_; |
165 UserObserver* user_observer_; | 171 UserObserver* user_observer_; |
166 | 172 |
| 173 // The widget hosting the tray. |
| 174 views::Widget* widget_; |
| 175 |
167 // The popup widget and the delegate. | 176 // The popup widget and the delegate. |
168 internal::SystemTrayBubble* bubble_; | 177 internal::SystemTrayBubble* bubble_; |
169 views::Widget* popup_; | 178 views::Widget* popup_; |
170 | 179 |
171 // Owned by the view it's installed on. | 180 // Owned by the view it's installed on. |
172 internal::SystemTrayBackground* background_; | 181 internal::SystemTrayBackground* background_; |
173 | 182 |
174 // See description agove getter. | 183 // See description agove getter. |
175 bool should_show_launcher_; | 184 bool should_show_launcher_; |
176 | 185 |
177 internal::BackgroundAnimator hide_background_animator_; | 186 internal::BackgroundAnimator hide_background_animator_; |
178 internal::BackgroundAnimator hover_background_animator_; | 187 internal::BackgroundAnimator hover_background_animator_; |
179 | 188 |
180 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 189 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
181 }; | 190 }; |
182 | 191 |
183 } // namespace ash | 192 } // namespace ash |
184 | 193 |
185 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 194 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
OLD | NEW |