Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: ash/system/tray/system_tray.h

Issue 10824153: Change Ash web notification behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix clang Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/status_area_widget.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/system/power/power_supply_status.h" 9 #include "ash/system/power/power_supply_status.h"
10 #include "ash/system/tray/tray_background_view.h" 10 #include "ash/system/tray/tray_background_view.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 // There are different methods for creating bubble views. 47 // There are different methods for creating bubble views.
48 enum BubbleCreationType { 48 enum BubbleCreationType {
49 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. 49 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one.
50 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. 50 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one.
51 }; 51 };
52 52
53 class ASH_EXPORT SystemTray : public internal::TrayBackgroundView { 53 class ASH_EXPORT SystemTray : public internal::TrayBackgroundView {
54 public: 54 public:
55 SystemTray(); 55 explicit SystemTray(internal::StatusAreaWidget* status_area_widget);
56 virtual ~SystemTray(); 56 virtual ~SystemTray();
57 57
58 // Called after the tray has been added to the widget containing it. 58 // Called after the tray has been added to the widget containing it.
59 void Initialize(); 59 void Initialize();
60 60
61 // Creates the default set of items for the sytem tray. 61 // Creates the default set of items for the sytem tray.
62 void CreateItems(); 62 void CreateItems();
63 63
64 // Adds a new item in the tray. 64 // Adds a new item in the tray.
65 void AddTrayItem(SystemTrayItem* item); 65 void AddTrayItem(SystemTrayItem* item);
(...skipping 26 matching lines...) Expand all
92 92
93 // Updates the items when the login status of the system changes. 93 // Updates the items when the login status of the system changes.
94 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); 94 void UpdateAfterLoginStatusChange(user::LoginStatus login_status);
95 95
96 // Updates the items when the shelf alignment changes. 96 // Updates the items when the shelf alignment changes.
97 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment); 97 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment);
98 98
99 // Temporarily hides/unhides the notification bubble. 99 // Temporarily hides/unhides the notification bubble.
100 void SetHideNotifications(bool hidden); 100 void SetHideNotifications(bool hidden);
101 101
102 // Returns true if the primary bubble is visible. 102 // Returns true if any bubble is visible.
103 bool IsBubbleVisible() const; 103 bool IsAnyBubbleVisible() const;
104 104
105 // Returns true if the launcher should show. 105 // Returns true if the launcher should show.
106 bool should_show_launcher() const { 106 bool should_show_launcher() const {
107 return bubble_.get() && should_show_launcher_; 107 return bubble_.get() && should_show_launcher_;
108 } 108 }
109 109
110 AccessibilityObserver* accessibility_observer() const { 110 AccessibilityObserver* accessibility_observer() const {
111 return accessibility_observer_; 111 return accessibility_observer_;
112 } 112 }
113 AudioObserver* audio_observer() const { 113 AudioObserver* audio_observer() const {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 BubbleCreationType creation_type, 187 BubbleCreationType creation_type,
188 int x_offset); 188 int x_offset);
189 189
190 // Constructs or re-constructs |notification_bubble_| and populates it with 190 // Constructs or re-constructs |notification_bubble_| and populates it with
191 // |notification_items_|, or destroys it if there are no notification items. 191 // |notification_items_|, or destroys it if there are no notification items.
192 void UpdateNotificationBubble(); 192 void UpdateNotificationBubble();
193 193
194 // Called when the anchor (tray or bubble) may have moved or changed. 194 // Called when the anchor (tray or bubble) may have moved or changed.
195 void UpdateNotificationAnchor(); 195 void UpdateNotificationAnchor();
196 196
197 void SetBorder();
198
199 // Overridden from internal::ActionableView. 197 // Overridden from internal::ActionableView.
200 virtual bool PerformAction(const views::Event& event) OVERRIDE; 198 virtual bool PerformAction(const views::Event& event) OVERRIDE;
201 199
202 // Overridden from views::View. 200 // Overridden from views::View.
203 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; 201 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE;
204 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; 202 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
205 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; 203 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
206 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 204 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
207 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; 205 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
208 206
209 // Owned items. 207 // Owned items.
210 ScopedVector<SystemTrayItem> items_; 208 ScopedVector<SystemTrayItem> items_;
211 209
212 // Pointers to members of |items_|. 210 // Pointers to members of |items_|.
213 SystemTrayItem* detailed_item_; 211 SystemTrayItem* detailed_item_;
214 std::vector<SystemTrayItem*> notification_items_; 212 std::vector<SystemTrayItem*> notification_items_;
215 213
216 // The container for all the tray views of the items.
217 internal::SystemTrayContainer* tray_container_;
218
219 // Mappings of system tray item and it's view in the tray. 214 // Mappings of system tray item and it's view in the tray.
220 std::map<SystemTrayItem*, views::View*> tray_item_map_; 215 std::map<SystemTrayItem*, views::View*> tray_item_map_;
221 216
222 // These observers are not owned by the tray. 217 // These observers are not owned by the tray.
223 AccessibilityObserver* accessibility_observer_; 218 AccessibilityObserver* accessibility_observer_;
224 AudioObserver* audio_observer_; 219 AudioObserver* audio_observer_;
225 BluetoothObserver* bluetooth_observer_; 220 BluetoothObserver* bluetooth_observer_;
226 BrightnessObserver* brightness_observer_; 221 BrightnessObserver* brightness_observer_;
227 CapsLockObserver* caps_lock_observer_; 222 CapsLockObserver* caps_lock_observer_;
228 ClockObserver* clock_observer_; 223 ClockObserver* clock_observer_;
229 DriveObserver* drive_observer_; 224 DriveObserver* drive_observer_;
230 IMEObserver* ime_observer_; 225 IMEObserver* ime_observer_;
231 LocaleObserver* locale_observer_; 226 LocaleObserver* locale_observer_;
232 NetworkObserver* network_observer_; 227 NetworkObserver* network_observer_;
233 ObserverList<PowerStatusObserver> power_status_observers_; 228 ObserverList<PowerStatusObserver> power_status_observers_;
234 SmsObserver* sms_observer_; 229 SmsObserver* sms_observer_;
235 UpdateObserver* update_observer_; 230 UpdateObserver* update_observer_;
236 UserObserver* user_observer_; 231 UserObserver* user_observer_;
237 232
238 // Bubble for default and detailed views. 233 // Bubble for default and detailed views.
239 scoped_ptr<internal::SystemTrayBubble> bubble_; 234 scoped_ptr<internal::SystemTrayBubble> bubble_;
240 235
241 // Buble for notifications. 236 // Bubble for notifications.
242 scoped_ptr<internal::SystemTrayBubble> notification_bubble_; 237 scoped_ptr<internal::SystemTrayBubble> notification_bubble_;
243 238
244 // See description agove getter. 239 // See description agove getter.
245 bool should_show_launcher_; 240 bool should_show_launcher_;
246 241
247 scoped_ptr<internal::SystemTrayLayerAnimationObserver> 242 scoped_ptr<internal::SystemTrayLayerAnimationObserver>
248 layer_animation_observer_; 243 layer_animation_observer_;
249 244
250 // Keep track of the default view height so that when we create detailed 245 // Keep track of the default view height so that when we create detailed
251 // views directly (e.g. from a notification) we know what height to use. 246 // views directly (e.g. from a notification) we know what height to use.
252 int default_bubble_height_; 247 int default_bubble_height_;
253 248
254 // Set to true when system notifications should be hidden (e.g. web 249 // Set to true when system notifications should be hidden (e.g. web
255 // notification bubble is visible). 250 // notification bubble is visible).
256 bool hide_notifications_; 251 bool hide_notifications_;
257 252
258 DISALLOW_COPY_AND_ASSIGN(SystemTray); 253 DISALLOW_COPY_AND_ASSIGN(SystemTray);
259 }; 254 };
260 255
261 } // namespace ash 256 } // namespace ash
262 257
263 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ 258 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_
OLDNEW
« no previous file with comments | « ash/system/status_area_widget.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698