| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
| 10 #include "ash/system/tray/tray_background_view.h" | 10 #include "ash/system/tray/tray_background_view.h" |
| 11 #include "ash/system/tray/tray_views.h" | 11 #include "ash/system/tray/tray_views.h" |
| 12 #include "ash/system/user/login_status.h" | 12 #include "ash/system/user/login_status.h" |
| 13 #include "ash/wm/shelf_auto_hide_behavior.h" | |
| 14 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 15 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 16 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 18 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
| 19 | 18 |
| 20 #include <map> | 19 #include <map> |
| 21 #include <vector> | 20 #include <vector> |
| 22 | 21 |
| 23 namespace ash { | 22 namespace ash { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 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 SystemTray(); | 54 SystemTray(); |
| 56 virtual ~SystemTray(); | 55 virtual ~SystemTray(); |
| 57 | 56 |
| 57 // Overridden from TrayBackgroundView. |
| 58 virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; |
| 59 |
| 58 // Called after the tray has been added to the widget containing it. | 60 // Called after the tray has been added to the widget containing it. |
| 59 void Initialize(); | 61 void Initialize(); |
| 60 | 62 |
| 61 // Creates the default set of items for the sytem tray. | 63 // Creates the default set of items for the sytem tray. |
| 62 void CreateItems(); | 64 void CreateItems(); |
| 63 | 65 |
| 64 // Adds a new item in the tray. | 66 // Adds a new item in the tray. |
| 65 void AddTrayItem(SystemTrayItem* item); | 67 void AddTrayItem(SystemTrayItem* item); |
| 66 | 68 |
| 67 // Removes an existing tray item. | 69 // Removes an existing tray item. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 89 | 91 |
| 90 // Hides the notification view for |item|. | 92 // Hides the notification view for |item|. |
| 91 void HideNotificationView(SystemTrayItem* item); | 93 void HideNotificationView(SystemTrayItem* item); |
| 92 | 94 |
| 93 // Updates the items when the login status of the system changes. | 95 // Updates the items when the login status of the system changes. |
| 94 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); | 96 void UpdateAfterLoginStatusChange(user::LoginStatus login_status); |
| 95 | 97 |
| 96 // Updates the items when the shelf alignment changes. | 98 // Updates the items when the shelf alignment changes. |
| 97 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment); | 99 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment); |
| 98 | 100 |
| 101 // Temporarily hides/unhides the notification bubble. |
| 102 void SetHideNotifications(bool hidden); |
| 103 |
| 104 // Returns true if the primary bubble is visible. |
| 105 bool IsBubbleVisible() const; |
| 106 |
| 99 // Returns true if the launcher should show. | 107 // Returns true if the launcher should show. |
| 100 bool should_show_launcher() const { | 108 bool should_show_launcher() const { |
| 101 return bubble_.get() && should_show_launcher_; | 109 return bubble_.get() && should_show_launcher_; |
| 102 } | 110 } |
| 103 | 111 |
| 104 AccessibilityObserver* accessibility_observer() const { | 112 AccessibilityObserver* accessibility_observer() const { |
| 105 return accessibility_observer_; | 113 return accessibility_observer_; |
| 106 } | 114 } |
| 107 AudioObserver* audio_observer() const { | 115 AudioObserver* audio_observer() const { |
| 108 return audio_observer_; | 116 return audio_observer_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 139 } | 147 } |
| 140 UserObserver* user_observer() const { | 148 UserObserver* user_observer() const { |
| 141 return user_observer_; | 149 return user_observer_; |
| 142 } | 150 } |
| 143 | 151 |
| 144 // Accessors for testing. | 152 // Accessors for testing. |
| 145 | 153 |
| 146 // Returns true if the bubble exists. | 154 // Returns true if the bubble exists. |
| 147 bool CloseBubbleForTest() const; | 155 bool CloseBubbleForTest() const; |
| 148 | 156 |
| 149 void SetShelfAlignment(ShelfAlignment alignment); | |
| 150 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | |
| 151 | |
| 152 private: | 157 private: |
| 153 friend class internal::SystemTrayLayerAnimationObserver; | 158 friend class internal::SystemTrayLayerAnimationObserver; |
| 154 friend class internal::SystemTrayBubble; | 159 friend class internal::SystemTrayBubble; |
| 155 | 160 |
| 156 // Resets |bubble_| and clears any related state. | 161 // Resets |bubble_| and clears any related state. |
| 157 void DestroyBubble(); | 162 void DestroyBubble(); |
| 158 | 163 |
| 159 // Called when the widget associated with |bubble| closes. |bubble| should | 164 // Called when the widget associated with |bubble| closes. |bubble| should |
| 160 // always == |bubble_|. This triggers destroying |bubble_| and hiding the | 165 // always == |bubble_|. This triggers destroying |bubble_| and hiding the |
| 161 // launcher if necessary. | 166 // launcher if necessary. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 232 |
| 228 // Bubble for default and detailed views. | 233 // Bubble for default and detailed views. |
| 229 scoped_ptr<internal::SystemTrayBubble> bubble_; | 234 scoped_ptr<internal::SystemTrayBubble> bubble_; |
| 230 | 235 |
| 231 // Buble for notifications. | 236 // Buble for notifications. |
| 232 scoped_ptr<internal::SystemTrayBubble> notification_bubble_; | 237 scoped_ptr<internal::SystemTrayBubble> notification_bubble_; |
| 233 | 238 |
| 234 // See description agove getter. | 239 // See description agove getter. |
| 235 bool should_show_launcher_; | 240 bool should_show_launcher_; |
| 236 | 241 |
| 237 // Shelf alignment. | |
| 238 ShelfAlignment shelf_alignment_; | |
| 239 | |
| 240 scoped_ptr<internal::SystemTrayLayerAnimationObserver> | 242 scoped_ptr<internal::SystemTrayLayerAnimationObserver> |
| 241 layer_animation_observer_; | 243 layer_animation_observer_; |
| 242 | 244 |
| 243 // 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 |
| 244 // 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. |
| 245 int default_bubble_height_; | 247 int default_bubble_height_; |
| 246 | 248 |
| 249 // Set to true when system notifications should be hidden (e.g. web |
| 250 // notification bubble is visible). |
| 251 bool hide_notifications_; |
| 252 |
| 247 DISALLOW_COPY_AND_ASSIGN(SystemTray); | 253 DISALLOW_COPY_AND_ASSIGN(SystemTray); |
| 248 }; | 254 }; |
| 249 | 255 |
| 250 } // namespace ash | 256 } // namespace ash |
| 251 | 257 |
| 252 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ | 258 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_H_ |
| OLD | NEW |