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 20 matching lines...) Expand all Loading... |
31 // There are different methods for creating bubble views. | 31 // There are different methods for creating bubble views. |
32 enum BubbleCreationType { | 32 enum BubbleCreationType { |
33 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. | 33 BUBBLE_CREATE_NEW, // Closes any existing bubble and creates a new one. |
34 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. | 34 BUBBLE_USE_EXISTING, // Uses any existing bubble, or creates a new one. |
35 }; | 35 }; |
36 | 36 |
37 class ASH_EXPORT SystemTray : public TrayBackgroundView, | 37 class ASH_EXPORT SystemTray : public TrayBackgroundView, |
38 public views::TrayBubbleView::Delegate { | 38 public views::TrayBubbleView::Delegate { |
39 public: | 39 public: |
40 explicit SystemTray(StatusAreaWidget* status_area_widget); | 40 explicit SystemTray(StatusAreaWidget* status_area_widget); |
41 virtual ~SystemTray(); | 41 ~SystemTray() override; |
42 | 42 |
43 // Calls TrayBackgroundView::Initialize(), creates the tray items, and | 43 // Calls TrayBackgroundView::Initialize(), creates the tray items, and |
44 // adds them to SystemTrayNotifier. | 44 // adds them to SystemTrayNotifier. |
45 void InitializeTrayItems(SystemTrayDelegate* delegate); | 45 void InitializeTrayItems(SystemTrayDelegate* delegate); |
46 | 46 |
47 // Adds a new item in the tray. | 47 // Adds a new item in the tray. |
48 void AddTrayItem(SystemTrayItem* item); | 48 void AddTrayItem(SystemTrayItem* item); |
49 | 49 |
50 // Removes an existing tray item. | 50 // Removes an existing tray item. |
51 void RemoveTrayItem(SystemTrayItem* item); | 51 void RemoveTrayItem(SystemTrayItem* item); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Returns view for help button if default view is shown. Returns NULL | 116 // Returns view for help button if default view is shown. Returns NULL |
117 // otherwise. | 117 // otherwise. |
118 views::View* GetHelpButtonView() const; | 118 views::View* GetHelpButtonView() const; |
119 | 119 |
120 // Accessors for testing. | 120 // Accessors for testing. |
121 | 121 |
122 // Returns true if the bubble exists. | 122 // Returns true if the bubble exists. |
123 bool CloseNotificationBubbleForTest() const; | 123 bool CloseNotificationBubbleForTest() const; |
124 | 124 |
125 // Overridden from TrayBackgroundView. | 125 // Overridden from TrayBackgroundView. |
126 virtual void SetShelfAlignment(ShelfAlignment alignment) override; | 126 void SetShelfAlignment(ShelfAlignment alignment) override; |
127 virtual void AnchorUpdated() override; | 127 void AnchorUpdated() override; |
128 virtual base::string16 GetAccessibleNameForTray() override; | 128 base::string16 GetAccessibleNameForTray() override; |
129 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) override; | 129 void BubbleResized(const views::TrayBubbleView* bubble_view) override; |
130 virtual void HideBubbleWithView( | 130 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; |
131 const views::TrayBubbleView* bubble_view) override; | 131 bool ClickedOutsideBubble() override; |
132 virtual bool ClickedOutsideBubble() override; | |
133 | 132 |
134 // Overridden from message_center::TrayBubbleView::Delegate. | 133 // Overridden from message_center::TrayBubbleView::Delegate. |
135 virtual void BubbleViewDestroyed() override; | 134 void BubbleViewDestroyed() override; |
136 virtual void OnMouseEnteredView() override; | 135 void OnMouseEnteredView() override; |
137 virtual void OnMouseExitedView() override; | 136 void OnMouseExitedView() override; |
138 virtual base::string16 GetAccessibleNameForBubble() override; | 137 base::string16 GetAccessibleNameForBubble() override; |
139 virtual gfx::Rect GetAnchorRect( | 138 gfx::Rect GetAnchorRect(views::Widget* anchor_widget, |
140 views::Widget* anchor_widget, | 139 AnchorType anchor_type, |
141 AnchorType anchor_type, | 140 AnchorAlignment anchor_alignment) const override; |
142 AnchorAlignment anchor_alignment) const override; | 141 void HideBubble(const views::TrayBubbleView* bubble_view) override; |
143 virtual void HideBubble(const views::TrayBubbleView* bubble_view) override; | |
144 | 142 |
145 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } | 143 ScreenTrayItem* GetScreenShareItem() { return screen_share_tray_item_; } |
146 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } | 144 ScreenTrayItem* GetScreenCaptureItem() { return screen_capture_tray_item_; } |
147 | 145 |
148 TrayAccessibility* GetTrayAccessibilityForTest() { | 146 TrayAccessibility* GetTrayAccessibilityForTest() { |
149 return tray_accessibility_; | 147 return tray_accessibility_; |
150 } | 148 } |
151 | 149 |
152 // Get the tray item view (or NULL) for a given |tray_item| in a unit test. | 150 // Get the tray item view (or NULL) for a given |tray_item| in a unit test. |
153 views::View* GetTrayItemViewForTest(SystemTrayItem* tray_item); | 151 views::View* GetTrayItemViewForTest(SystemTrayItem* tray_item); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Checks the current status of the system tray and updates the web | 193 // Checks the current status of the system tray and updates the web |
196 // notification tray according to the current status. | 194 // notification tray according to the current status. |
197 void UpdateWebNotifications(); | 195 void UpdateWebNotifications(); |
198 | 196 |
199 // Deactivate the system tray in the shelf if it was active before. | 197 // Deactivate the system tray in the shelf if it was active before. |
200 void CloseSystemBubbleAndDeactivateSystemTray(); | 198 void CloseSystemBubbleAndDeactivateSystemTray(); |
201 | 199 |
202 const ScopedVector<SystemTrayItem>& items() const { return items_; } | 200 const ScopedVector<SystemTrayItem>& items() const { return items_; } |
203 | 201 |
204 // Overridden from ActionableView. | 202 // Overridden from ActionableView. |
205 virtual bool PerformAction(const ui::Event& event) override; | 203 bool PerformAction(const ui::Event& event) override; |
206 | 204 |
207 // Owned items. | 205 // Owned items. |
208 ScopedVector<SystemTrayItem> items_; | 206 ScopedVector<SystemTrayItem> items_; |
209 | 207 |
210 // Pointers to members of |items_|. | 208 // Pointers to members of |items_|. |
211 SystemTrayItem* detailed_item_; | 209 SystemTrayItem* detailed_item_; |
212 std::vector<SystemTrayItem*> notification_items_; | 210 std::vector<SystemTrayItem*> notification_items_; |
213 | 211 |
214 // Mappings of system tray item and it's view in the tray. | 212 // Mappings of system tray item and it's view in the tray. |
215 std::map<SystemTrayItem*, views::View*> tray_item_map_; | 213 std::map<SystemTrayItem*, views::View*> tray_item_map_; |
(...skipping 23 matching lines...) Expand all Loading... |
239 // A reference to the Screen share and capture item. | 237 // A reference to the Screen share and capture item. |
240 ScreenTrayItem* screen_capture_tray_item_; // not owned | 238 ScreenTrayItem* screen_capture_tray_item_; // not owned |
241 ScreenTrayItem* screen_share_tray_item_; // not owned | 239 ScreenTrayItem* screen_share_tray_item_; // not owned |
242 | 240 |
243 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 241 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
244 }; | 242 }; |
245 | 243 |
246 } // namespace ash | 244 } // namespace ash |
247 | 245 |
248 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 246 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
OLD | NEW |