| 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 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/system/tray/system_tray_bubble.h" | 9 #include "ash/system/tray/system_tray_bubble.h" |
| 10 #include "ash/system/tray/tray_background_view.h" | 10 #include "ash/system/tray/tray_background_view.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // Adds a new item in the tray. | 50 // Adds a new item in the tray. |
| 51 void AddTrayItem(SystemTrayItem* item); | 51 void AddTrayItem(SystemTrayItem* item); |
| 52 | 52 |
| 53 // Removes an existing tray item. | 53 // Removes an existing tray item. |
| 54 void RemoveTrayItem(SystemTrayItem* item); | 54 void RemoveTrayItem(SystemTrayItem* item); |
| 55 | 55 |
| 56 // Returns all tray items that has been added to system tray. | 56 // Returns all tray items that has been added to system tray. |
| 57 const std::vector<SystemTrayItem*>& GetTrayItems() const; | 57 const std::vector<SystemTrayItem*>& GetTrayItems() const; |
| 58 | 58 |
| 59 // Returns all tray user items that were added to the system tray. | |
| 60 const std::vector<internal::TrayUser*>& GetTrayUserItems() const; | |
| 61 | |
| 62 // Shows the default view of all items. | 59 // Shows the default view of all items. |
| 63 void ShowDefaultView(BubbleCreationType creation_type); | 60 void ShowDefaultView(BubbleCreationType creation_type); |
| 64 | 61 |
| 65 // Shows default view that ingnores outside clicks and activation loss. | 62 // Shows default view that ingnores outside clicks and activation loss. |
| 66 void ShowPersistentDefaultView(); | 63 void ShowPersistentDefaultView(); |
| 67 | 64 |
| 68 // Shows details of a particular item. If |close_delay_in_seconds| is | 65 // Shows details of a particular item. If |close_delay_in_seconds| is |
| 69 // non-zero, then the view is automatically closed after the specified time. | 66 // non-zero, then the view is automatically closed after the specified time. |
| 70 void ShowDetailedView(SystemTrayItem* item, | 67 void ShowDetailedView(SystemTrayItem* item, |
| 71 int close_delay_in_seconds, | 68 int close_delay_in_seconds, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 AnchorAlignment anchor_alignment) OVERRIDE; | 144 AnchorAlignment anchor_alignment) OVERRIDE; |
| 148 virtual void HideBubble(const views::TrayBubbleView* bubble_view) OVERRIDE; | 145 virtual void HideBubble(const views::TrayBubbleView* bubble_view) OVERRIDE; |
| 149 | 146 |
| 150 internal::TrayAccessibility* GetTrayAccessibilityForTest() { | 147 internal::TrayAccessibility* GetTrayAccessibilityForTest() { |
| 151 return tray_accessibility_; | 148 return tray_accessibility_; |
| 152 } | 149 } |
| 153 | 150 |
| 154 // Get the tray item view (or NULL) for a given |tray_item| in a unit test. | 151 // Get the tray item view (or NULL) for a given |tray_item| in a unit test. |
| 155 views::View* GetTrayItemViewForTest(SystemTrayItem* tray_item); | 152 views::View* GetTrayItemViewForTest(SystemTrayItem* tray_item); |
| 156 | 153 |
| 157 // Add a tray user item for testing purposes. Note: The passed |tray_user| | |
| 158 // will be owned by the SystemTray after the call. | |
| 159 void AddTrayUserItemForTest(internal::TrayUser* tray_user); | |
| 160 | |
| 161 // Gets tray_date_ for browser tests. | 154 // Gets tray_date_ for browser tests. |
| 162 internal::TrayDate* GetTrayDateForTesting() const; | 155 internal::TrayDate* GetTrayDateForTesting() const; |
| 163 | 156 |
| 164 private: | 157 private: |
| 165 // Creates the default set of items for the sytem tray. | 158 // Creates the default set of items for the sytem tray. |
| 166 void CreateItems(SystemTrayDelegate* delegate); | 159 void CreateItems(SystemTrayDelegate* delegate); |
| 167 | 160 |
| 168 // Resets |system_bubble_| and clears any related state. | 161 // Resets |system_bubble_| and clears any related state. |
| 169 void DestroySystemBubble(); | 162 void DestroySystemBubble(); |
| 170 | 163 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 void CloseSystemBubbleAndDeactivateSystemTray(); | 195 void CloseSystemBubbleAndDeactivateSystemTray(); |
| 203 | 196 |
| 204 const ScopedVector<SystemTrayItem>& items() const { return items_; } | 197 const ScopedVector<SystemTrayItem>& items() const { return items_; } |
| 205 | 198 |
| 206 // Overridden from internal::ActionableView. | 199 // Overridden from internal::ActionableView. |
| 207 virtual bool PerformAction(const ui::Event& event) OVERRIDE; | 200 virtual bool PerformAction(const ui::Event& event) OVERRIDE; |
| 208 | 201 |
| 209 // Owned items. | 202 // Owned items. |
| 210 ScopedVector<SystemTrayItem> items_; | 203 ScopedVector<SystemTrayItem> items_; |
| 211 | 204 |
| 212 // User items - note, this is a subset of the |items_| list. Note that no | |
| 213 // item in this list needs to be deleted. | |
| 214 std::vector<internal::TrayUser*> user_items_; | |
| 215 | |
| 216 // Pointers to members of |items_|. | 205 // Pointers to members of |items_|. |
| 217 SystemTrayItem* detailed_item_; | 206 SystemTrayItem* detailed_item_; |
| 218 std::vector<SystemTrayItem*> notification_items_; | 207 std::vector<SystemTrayItem*> notification_items_; |
| 219 | 208 |
| 220 // Mappings of system tray item and it's view in the tray. | 209 // Mappings of system tray item and it's view in the tray. |
| 221 std::map<SystemTrayItem*, views::View*> tray_item_map_; | 210 std::map<SystemTrayItem*, views::View*> tray_item_map_; |
| 222 | 211 |
| 223 // Bubble for default and detailed views. | 212 // Bubble for default and detailed views. |
| 224 scoped_ptr<internal::SystemBubbleWrapper> system_bubble_; | 213 scoped_ptr<internal::SystemBubbleWrapper> system_bubble_; |
| 225 | 214 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 241 | 230 |
| 242 internal::TrayAccessibility* tray_accessibility_; // not owned | 231 internal::TrayAccessibility* tray_accessibility_; // not owned |
| 243 internal::TrayDate* tray_date_; | 232 internal::TrayDate* tray_date_; |
| 244 | 233 |
| 245 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 234 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
| 246 }; | 235 }; |
| 247 | 236 |
| 248 } // namespace ash | 237 } // namespace ash |
| 249 | 238 |
| 250 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 239 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
| OLD | NEW |