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

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

Issue 10836227: Fix status area accessability issues. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 23 matching lines...) Expand all
34 class SmsObserver; 34 class SmsObserver;
35 class PowerStatusObserver; 35 class PowerStatusObserver;
36 class UpdateObserver; 36 class UpdateObserver;
37 class UserObserver; 37 class UserObserver;
38 38
39 class SystemTrayItem; 39 class SystemTrayItem;
40 40
41 namespace internal { 41 namespace internal {
42 class SystemTrayBubble; 42 class SystemTrayBubble;
43 class SystemTrayContainer; 43 class SystemTrayContainer;
44 class SystemTrayLayerAnimationObserver;
45 } 44 }
46 45
47 // There are different methods for creating bubble views. 46 // There are different methods for creating bubble views.
48 enum BubbleCreationType { 47 enum BubbleCreationType {
49 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. 48 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. 49 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one.
51 }; 50 };
52 51
53 class ASH_EXPORT SystemTray : public internal::TrayBackgroundView { 52 class ASH_EXPORT SystemTray : public internal::TrayBackgroundView {
54 public: 53 public:
55 explicit SystemTray(internal::StatusAreaWidget* status_area_widget); 54 explicit SystemTray(internal::StatusAreaWidget* status_area_widget);
56 virtual ~SystemTray(); 55 virtual ~SystemTray();
57 56
58 // Called after the tray has been added to the widget containing it.
59 void Initialize();
60
61 // Creates the default set of items for the sytem tray. 57 // Creates the default set of items for the sytem tray.
62 void CreateItems(); 58 void CreateItems();
63 59
64 // Adds a new item in the tray. 60 // Adds a new item in the tray.
65 void AddTrayItem(SystemTrayItem* item); 61 void AddTrayItem(SystemTrayItem* item);
66 62
67 // Removes an existing tray item. 63 // Removes an existing tray item.
68 void RemoveTrayItem(SystemTrayItem* item); 64 void RemoveTrayItem(SystemTrayItem* item);
69 65
70 // Shows the default view of all items. 66 // Shows the default view of all items.
(...skipping 21 matching lines...) Expand all
92 88
93 // Updates the items when the login status of the system changes. 89 // Updates the items when the login status of the system changes.
94 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); 90 void UpdateAfterLoginStatusChange(user::LoginStatus login_status);
95 91
96 // Updates the items when the shelf alignment changes. 92 // Updates the items when the shelf alignment changes.
97 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment); 93 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment);
98 94
99 // Temporarily hides/unhides the notification bubble. 95 // Temporarily hides/unhides the notification bubble.
100 void SetHideNotifications(bool hidden); 96 void SetHideNotifications(bool hidden);
101 97
98 // Returns true if the system bubble is visible.
99 bool IsSystemBubbleVisible() const;
100
102 // Returns true if any bubble is visible. 101 // Returns true if any bubble is visible.
103 bool IsAnyBubbleVisible() const; 102 bool IsAnyBubbleVisible() const;
104 103
105 // Returns true if the launcher should show. 104 // Returns true if the mouse is inside the notification bubble.
106 bool should_show_launcher() const { 105 bool IsMouseInNotificationBubble() const;
107 return bubble_.get() && should_show_launcher_;
108 }
109 106
110 AccessibilityObserver* accessibility_observer() const { 107 AccessibilityObserver* accessibility_observer() const {
111 return accessibility_observer_; 108 return accessibility_observer_;
112 } 109 }
113 AudioObserver* audio_observer() const { 110 AudioObserver* audio_observer() const {
114 return audio_observer_; 111 return audio_observer_;
115 } 112 }
116 BluetoothObserver* bluetooth_observer() const { 113 BluetoothObserver* bluetooth_observer() const {
117 return bluetooth_observer_; 114 return bluetooth_observer_;
118 } 115 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return user_observer_; 147 return user_observer_;
151 } 148 }
152 149
153 // Accessors for testing. 150 // Accessors for testing.
154 151
155 // Returns true if the bubble exists. 152 // Returns true if the bubble exists.
156 bool CloseBubbleForTest() const; 153 bool CloseBubbleForTest() const;
157 154
158 // Overridden from TrayBackgroundView. 155 // Overridden from TrayBackgroundView.
159 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; 156 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE;
157 virtual void AnchorUpdated() OVERRIDE;
158 virtual string16 GetAccessibleName() OVERRIDE;
160 159
161 private: 160 private:
162 friend class internal::SystemTrayLayerAnimationObserver;
163 friend class internal::SystemTrayBubble; 161 friend class internal::SystemTrayBubble;
164 162
165 // Resets |bubble_| and clears any related state. 163 // Resets |bubble_| and clears any related state.
166 void DestroyBubble(); 164 void DestroyBubble();
167 165
168 // Called when the widget associated with |bubble| closes. |bubble| should 166 // Called when the widget associated with |bubble| closes. |bubble| should
169 // always == |bubble_|. This triggers destroying |bubble_| and hiding the 167 // always == |bubble_|. This triggers destroying |bubble_| and hiding the
170 // launcher if necessary. 168 // launcher if necessary.
171 void RemoveBubble(internal::SystemTrayBubble* bubble); 169 void RemoveBubble(internal::SystemTrayBubble* bubble);
172 170
(...skipping 11 matching lines...) Expand all
184 void ShowItems(const std::vector<SystemTrayItem*>& items, 182 void ShowItems(const std::vector<SystemTrayItem*>& items,
185 bool details, 183 bool details,
186 bool activate, 184 bool activate,
187 BubbleCreationType creation_type, 185 BubbleCreationType creation_type,
188 int x_offset); 186 int x_offset);
189 187
190 // Constructs or re-constructs |notification_bubble_| and populates it with 188 // Constructs or re-constructs |notification_bubble_| and populates it with
191 // |notification_items_|, or destroys it if there are no notification items. 189 // |notification_items_|, or destroys it if there are no notification items.
192 void UpdateNotificationBubble(); 190 void UpdateNotificationBubble();
193 191
194 // Called when the anchor (tray or bubble) may have moved or changed.
195 void UpdateNotificationAnchor();
196
197 // Overridden from internal::ActionableView. 192 // Overridden from internal::ActionableView.
198 virtual bool PerformAction(const ui::Event& event) OVERRIDE; 193 virtual bool PerformAction(const ui::Event& event) OVERRIDE;
199 194
200 // Overridden from views::View.
201 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE;
202 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
203 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
204 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
205 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
206
207 // Owned items. 195 // Owned items.
208 ScopedVector<SystemTrayItem> items_; 196 ScopedVector<SystemTrayItem> items_;
209 197
210 // Pointers to members of |items_|. 198 // Pointers to members of |items_|.
211 SystemTrayItem* detailed_item_; 199 SystemTrayItem* detailed_item_;
212 std::vector<SystemTrayItem*> notification_items_; 200 std::vector<SystemTrayItem*> notification_items_;
213 201
214 // Mappings of system tray item and it's view in the tray. 202 // Mappings of system tray item and it's view in the tray.
215 std::map<SystemTrayItem*, views::View*> tray_item_map_; 203 std::map<SystemTrayItem*, views::View*> tray_item_map_;
216 204
(...skipping 12 matching lines...) Expand all
229 SmsObserver* sms_observer_; 217 SmsObserver* sms_observer_;
230 UpdateObserver* update_observer_; 218 UpdateObserver* update_observer_;
231 UserObserver* user_observer_; 219 UserObserver* user_observer_;
232 220
233 // Bubble for default and detailed views. 221 // Bubble for default and detailed views.
234 scoped_ptr<internal::SystemTrayBubble> bubble_; 222 scoped_ptr<internal::SystemTrayBubble> bubble_;
235 223
236 // Bubble for notifications. 224 // Bubble for notifications.
237 scoped_ptr<internal::SystemTrayBubble> notification_bubble_; 225 scoped_ptr<internal::SystemTrayBubble> notification_bubble_;
238 226
239 // See description agove getter.
240 bool should_show_launcher_;
241
242 scoped_ptr<internal::SystemTrayLayerAnimationObserver>
243 layer_animation_observer_;
244
245 // Keep track of the default view height so that when we create detailed 227 // Keep track of the default view height so that when we create detailed
246 // views directly (e.g. from a notification) we know what height to use. 228 // views directly (e.g. from a notification) we know what height to use.
247 int default_bubble_height_; 229 int default_bubble_height_;
248 230
249 // Set to true when system notifications should be hidden (e.g. web 231 // Set to true when system notifications should be hidden (e.g. web
250 // notification bubble is visible). 232 // notification bubble is visible).
251 bool hide_notifications_; 233 bool hide_notifications_;
252 234
253 DISALLOW_COPY_AND_ASSIGN(SystemTray); 235 DISALLOW_COPY_AND_ASSIGN(SystemTray);
254 }; 236 };
255 237
256 } // namespace ash 238 } // namespace ash
257 239
258 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ 240 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698