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

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: Address feedback 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_delegate.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 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 30 matching lines...) Expand all
149 UserObserver* user_observer() const { 146 UserObserver* user_observer() const {
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.
156 virtual void Initialize() OVERRIDE;
159 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; 157 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE;
158 virtual void AnchorUpdated() OVERRIDE;
159 virtual string16 GetAccessibleName() OVERRIDE;
160 160
161 private: 161 private:
162 friend class internal::SystemTrayLayerAnimationObserver;
163 friend class internal::SystemTrayBubble; 162 friend class internal::SystemTrayBubble;
164 163
165 // Resets |bubble_| and clears any related state. 164 // Resets |bubble_| and clears any related state.
166 void DestroyBubble(); 165 void DestroyBubble();
167 166
168 // Called when the widget associated with |bubble| closes. |bubble| should 167 // Called when the widget associated with |bubble| closes. |bubble| should
169 // always == |bubble_|. This triggers destroying |bubble_| and hiding the 168 // always == |bubble_|. This triggers destroying |bubble_| and hiding the
170 // launcher if necessary. 169 // launcher if necessary.
171 void RemoveBubble(internal::SystemTrayBubble* bubble); 170 void RemoveBubble(internal::SystemTrayBubble* bubble);
172 171
(...skipping 11 matching lines...) Expand all
184 void ShowItems(const std::vector<SystemTrayItem*>& items, 183 void ShowItems(const std::vector<SystemTrayItem*>& items,
185 bool details, 184 bool details,
186 bool activate, 185 bool activate,
187 BubbleCreationType creation_type, 186 BubbleCreationType creation_type,
188 int x_offset); 187 int x_offset);
189 188
190 // Constructs or re-constructs |notification_bubble_| and populates it with 189 // Constructs or re-constructs |notification_bubble_| and populates it with
191 // |notification_items_|, or destroys it if there are no notification items. 190 // |notification_items_|, or destroys it if there are no notification items.
192 void UpdateNotificationBubble(); 191 void UpdateNotificationBubble();
193 192
194 // Called when the anchor (tray or bubble) may have moved or changed.
195 void UpdateNotificationAnchor();
196
197 // Overridden from internal::ActionableView. 193 // Overridden from internal::ActionableView.
198 virtual bool PerformAction(const ui::Event& event) OVERRIDE; 194 virtual bool PerformAction(const ui::Event& event) OVERRIDE;
199 195
200 // Overridden from views::View.
201 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
202 virtual void OnMouseExited(const ui::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. 196 // Owned items.
208 ScopedVector<SystemTrayItem> items_; 197 ScopedVector<SystemTrayItem> items_;
209 198
210 // Pointers to members of |items_|. 199 // Pointers to members of |items_|.
211 SystemTrayItem* detailed_item_; 200 SystemTrayItem* detailed_item_;
212 std::vector<SystemTrayItem*> notification_items_; 201 std::vector<SystemTrayItem*> notification_items_;
213 202
214 // Mappings of system tray item and it's view in the tray. 203 // Mappings of system tray item and it's view in the tray.
215 std::map<SystemTrayItem*, views::View*> tray_item_map_; 204 std::map<SystemTrayItem*, views::View*> tray_item_map_;
216 205
(...skipping 12 matching lines...) Expand all
229 SmsObserver* sms_observer_; 218 SmsObserver* sms_observer_;
230 UpdateObserver* update_observer_; 219 UpdateObserver* update_observer_;
231 UserObserver* user_observer_; 220 UserObserver* user_observer_;
232 221
233 // Bubble for default and detailed views. 222 // Bubble for default and detailed views.
234 scoped_ptr<internal::SystemTrayBubble> bubble_; 223 scoped_ptr<internal::SystemTrayBubble> bubble_;
235 224
236 // Bubble for notifications. 225 // Bubble for notifications.
237 scoped_ptr<internal::SystemTrayBubble> notification_bubble_; 226 scoped_ptr<internal::SystemTrayBubble> notification_bubble_;
238 227
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 228 // 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. 229 // views directly (e.g. from a notification) we know what height to use.
247 int default_bubble_height_; 230 int default_bubble_height_;
248 231
249 // Set to true when system notifications should be hidden (e.g. web 232 // Set to true when system notifications should be hidden (e.g. web
250 // notification bubble is visible). 233 // notification bubble is visible).
251 bool hide_notifications_; 234 bool hide_notifications_;
252 235
253 DISALLOW_COPY_AND_ASSIGN(SystemTray); 236 DISALLOW_COPY_AND_ASSIGN(SystemTray);
254 }; 237 };
255 238
256 } // namespace ash 239 } // namespace ash
257 240
258 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ 241 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_
OLDNEW
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698