| 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_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 5 #ifndef ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
| 6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/login_status.h" | 11 #include "ash/login_status.h" |
| 12 #include "ash/system/tray/tray_background_view.h" | 12 #include "ash/system/tray/tray_background_view.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "ui/base/models/simple_menu_model.h" | 16 #include "ui/base/models/simple_menu_model.h" |
| 17 #include "ui/gfx/animation/animation_container.h" | 17 #include "ui/gfx/animation/animation_container.h" |
| 18 #include "ui/message_center/message_center_tray.h" | 18 #include "ui/message_center/message_center_tray.h" |
| 19 #include "ui/message_center/message_center_tray_delegate.h" | 19 #include "ui/message_center/message_center_tray_delegate.h" |
| 20 #include "ui/views/bubble/tray_bubble_view.h" | 20 #include "ui/views/bubble/tray_bubble_view.h" |
| 21 | 21 |
| 22 // Status area tray for showing browser and app notifications. This hosts | 22 namespace aura { |
| 23 // a MessageCenter class which manages the notification list. This class | 23 class Window; |
| 24 // contains the Ash specific tray implementation. | 24 } |
| 25 // | |
| 26 // Note: These are not related to system notifications (i.e NotificationView | |
| 27 // generated by SystemTrayItem). Visibility of one notification type or other | |
| 28 // is controlled by StatusAreaWidget. | |
| 29 | 25 |
| 30 namespace message_center { | 26 namespace message_center { |
| 31 class MessageCenter; | 27 class MessageCenter; |
| 32 class MessageCenterBubble; | 28 class MessageCenterBubble; |
| 33 class MessagePopupCollection; | 29 class MessagePopupCollection; |
| 34 } | 30 } |
| 35 | 31 |
| 36 namespace ash { | 32 namespace ash { |
| 37 class AshPopupAlignmentDelegate; | 33 class AshPopupAlignmentDelegate; |
| 38 class SystemTray; | 34 class SystemTray; |
| 39 class WebNotificationBubbleWrapper; | 35 class WebNotificationBubbleWrapper; |
| 40 class WebNotificationImage; | 36 class WebNotificationImage; |
| 41 class WebNotificationLabel; | 37 class WebNotificationLabel; |
| 42 class WmWindow; | |
| 43 | 38 |
| 39 // Status area tray for showing browser and app notifications. This hosts |
| 40 // a MessageCenter class which manages the notification list. This class |
| 41 // contains the Ash specific tray implementation. |
| 42 // |
| 43 // Note: These are not related to system notifications (i.e NotificationView |
| 44 // generated by SystemTrayItem). Visibility of one notification type or other |
| 45 // is controlled by StatusAreaWidget. |
| 44 class ASH_EXPORT WebNotificationTray | 46 class ASH_EXPORT WebNotificationTray |
| 45 : public TrayBackgroundView, | 47 : public TrayBackgroundView, |
| 46 public views::TrayBubbleView::Delegate, | 48 public views::TrayBubbleView::Delegate, |
| 47 public message_center::MessageCenterTrayDelegate, | 49 public message_center::MessageCenterTrayDelegate, |
| 48 public base::SupportsWeakPtr<WebNotificationTray>, | 50 public base::SupportsWeakPtr<WebNotificationTray>, |
| 49 public ui::SimpleMenuModel::Delegate { | 51 public ui::SimpleMenuModel::Delegate { |
| 50 public: | 52 public: |
| 51 WebNotificationTray(WmShelf* shelf, | 53 WebNotificationTray(WmShelf* shelf, |
| 52 WmWindow* status_area_window, | 54 aura::Window* status_area_window, |
| 53 SystemTray* system_tray); | 55 SystemTray* system_tray); |
| 54 ~WebNotificationTray() override; | 56 ~WebNotificationTray() override; |
| 55 | 57 |
| 56 static void DisableAnimationsForTest(bool disable); | 58 static void DisableAnimationsForTest(bool disable); |
| 57 | 59 |
| 58 // Sets the height of the system tray bubble (or legacy notification bubble) | 60 // Sets the height of the system tray bubble (or legacy notification bubble) |
| 59 // from the edge of the work area so that the web notification popups don't | 61 // from the edge of the work area so that the web notification popups don't |
| 60 // overlap with the tray. Pass 0 if no bubble is shown. | 62 // overlap with the tray. Pass 0 if no bubble is shown. |
| 61 void SetTrayBubbleHeight(int height); | 63 void SetTrayBubbleHeight(int height); |
| 62 | 64 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 ui::MenuModel* CreateQuietModeMenu(); | 148 ui::MenuModel* CreateQuietModeMenu(); |
| 147 | 149 |
| 148 WebNotificationBubbleWrapper* message_center_bubble() const { | 150 WebNotificationBubbleWrapper* message_center_bubble() const { |
| 149 return message_center_bubble_.get(); | 151 return message_center_bubble_.get(); |
| 150 } | 152 } |
| 151 | 153 |
| 152 // Testing accessors. | 154 // Testing accessors. |
| 153 bool IsPopupVisible() const; | 155 bool IsPopupVisible() const; |
| 154 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); | 156 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); |
| 155 | 157 |
| 156 WmWindow* status_area_window_; | 158 aura::Window* status_area_window_; |
| 157 SystemTray* system_tray_; | 159 SystemTray* system_tray_; |
| 158 std::unique_ptr<message_center::MessageCenterTray> message_center_tray_; | 160 std::unique_ptr<message_center::MessageCenterTray> message_center_tray_; |
| 159 std::unique_ptr<WebNotificationBubbleWrapper> message_center_bubble_; | 161 std::unique_ptr<WebNotificationBubbleWrapper> message_center_bubble_; |
| 160 std::unique_ptr<message_center::MessagePopupCollection> popup_collection_; | 162 std::unique_ptr<message_center::MessagePopupCollection> popup_collection_; |
| 161 std::unique_ptr<WebNotificationImage> bell_icon_; | 163 std::unique_ptr<WebNotificationImage> bell_icon_; |
| 162 std::unique_ptr<WebNotificationLabel> counter_; | 164 std::unique_ptr<WebNotificationLabel> counter_; |
| 163 | 165 |
| 164 scoped_refptr<gfx::AnimationContainer> animation_container_ = | 166 scoped_refptr<gfx::AnimationContainer> animation_container_ = |
| 165 new gfx::AnimationContainer(); | 167 new gfx::AnimationContainer(); |
| 166 | 168 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 177 bool should_block_shelf_auto_hide_; | 179 bool should_block_shelf_auto_hide_; |
| 178 | 180 |
| 179 std::unique_ptr<AshPopupAlignmentDelegate> popup_alignment_delegate_; | 181 std::unique_ptr<AshPopupAlignmentDelegate> popup_alignment_delegate_; |
| 180 | 182 |
| 181 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); | 183 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); |
| 182 }; | 184 }; |
| 183 | 185 |
| 184 } // namespace ash | 186 } // namespace ash |
| 185 | 187 |
| 186 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 188 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
| OLD | NEW |