| 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_COMMON_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
| 6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 6 #define ASH_COMMON_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/common/login_status.h" | 11 #include "ash/common/login_status.h" |
| 12 #include "ash/common/system/tray/tray_background_view.h" | 12 #include "ash/common/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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace message_center { | 35 namespace message_center { |
| 36 class MessageBubbleBase; | 36 class MessageBubbleBase; |
| 37 class MessageCenter; | 37 class MessageCenter; |
| 38 class MessageCenterBubble; | 38 class MessageCenterBubble; |
| 39 class MessagePopupCollection; | 39 class MessagePopupCollection; |
| 40 } | 40 } |
| 41 | 41 |
| 42 namespace ash { | 42 namespace ash { |
| 43 class StatusAreaWidget; | 43 class AshPopupAlignmentDelegate; |
| 44 class SystemTray; |
| 44 class WebNotificationBubbleWrapper; | 45 class WebNotificationBubbleWrapper; |
| 45 class WebNotificationButton; | 46 class WebNotificationButton; |
| 46 class AshPopupAlignmentDelegate; | 47 class WmShelf; |
| 48 class WmWindow; |
| 47 | 49 |
| 48 class ASH_EXPORT WebNotificationTray | 50 class ASH_EXPORT WebNotificationTray |
| 49 : public TrayBackgroundView, | 51 : public TrayBackgroundView, |
| 50 public views::TrayBubbleView::Delegate, | 52 public views::TrayBubbleView::Delegate, |
| 51 public message_center::MessageCenterTrayDelegate, | 53 public message_center::MessageCenterTrayDelegate, |
| 52 public views::ButtonListener, | 54 public views::ButtonListener, |
| 53 public base::SupportsWeakPtr<WebNotificationTray>, | 55 public base::SupportsWeakPtr<WebNotificationTray>, |
| 54 public ui::SimpleMenuModel::Delegate { | 56 public ui::SimpleMenuModel::Delegate { |
| 55 public: | 57 public: |
| 56 explicit WebNotificationTray(StatusAreaWidget* status_area_widget); | 58 WebNotificationTray(WmShelf* shelf, |
| 59 WmWindow* status_area_window, |
| 60 SystemTray* system_tray); |
| 57 ~WebNotificationTray() override; | 61 ~WebNotificationTray() override; |
| 58 | 62 |
| 59 // Sets the height of the system tray from the edge of the work area so that | 63 // Sets the height of the system tray from the edge of the work area so that |
| 60 // the notification popups don't overlap with the tray. Passes 0 if no UI is | 64 // the notification popups don't overlap with the tray. Passes 0 if no UI is |
| 61 // shown in the system tray side. | 65 // shown in the system tray side. |
| 62 void SetSystemTrayHeight(int height); | 66 void SetSystemTrayHeight(int height); |
| 63 | 67 |
| 64 // Returns the current system tray height. | 68 // Returns the current system tray height. |
| 65 int system_tray_height_for_test() const; | 69 int system_tray_height_for_test() const; |
| 66 | 70 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 166 } |
| 163 | 167 |
| 164 // Returns true if any user is logged in and the system is not at the screen | 168 // Returns true if any user is logged in and the system is not at the screen |
| 165 // for adding a secondary user. | 169 // for adding a secondary user. |
| 166 bool IsLoggedIn() const; | 170 bool IsLoggedIn() const; |
| 167 | 171 |
| 168 // Testing accessors. | 172 // Testing accessors. |
| 169 bool IsPopupVisible() const; | 173 bool IsPopupVisible() const; |
| 170 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); | 174 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); |
| 171 | 175 |
| 172 StatusAreaWidget* status_area_widget_; | 176 WmWindow* status_area_window_; |
| 177 SystemTray* system_tray_; |
| 173 std::unique_ptr<message_center::MessageCenterTray> message_center_tray_; | 178 std::unique_ptr<message_center::MessageCenterTray> message_center_tray_; |
| 174 std::unique_ptr<WebNotificationBubbleWrapper> message_center_bubble_; | 179 std::unique_ptr<WebNotificationBubbleWrapper> message_center_bubble_; |
| 175 std::unique_ptr<message_center::MessagePopupCollection> popup_collection_; | 180 std::unique_ptr<message_center::MessagePopupCollection> popup_collection_; |
| 176 WebNotificationButton* button_; | 181 WebNotificationButton* button_; |
| 177 | 182 |
| 178 bool show_message_center_on_unlock_; | 183 bool show_message_center_on_unlock_; |
| 179 | 184 |
| 180 bool should_update_tray_content_; | 185 bool should_update_tray_content_; |
| 181 | 186 |
| 182 // True when the shelf auto hide behavior has to be blocked. Previously | 187 // True when the shelf auto hide behavior has to be blocked. Previously |
| 183 // this was done by checking |message_center_bubble_| but actually | 188 // this was done by checking |message_center_bubble_| but actually |
| 184 // the check can be called when creating this object, so it would cause | 189 // the check can be called when creating this object, so it would cause |
| 185 // flickers of the shelf from hidden to shown. See: crbug.com/181213 | 190 // flickers of the shelf from hidden to shown. See: crbug.com/181213 |
| 186 bool should_block_shelf_auto_hide_; | 191 bool should_block_shelf_auto_hide_; |
| 187 | 192 |
| 188 std::unique_ptr<AshPopupAlignmentDelegate> popup_alignment_delegate_; | 193 std::unique_ptr<AshPopupAlignmentDelegate> popup_alignment_delegate_; |
| 189 | 194 |
| 190 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); | 195 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); |
| 191 }; | 196 }; |
| 192 | 197 |
| 193 } // namespace ash | 198 } // namespace ash |
| 194 | 199 |
| 195 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ | 200 #endif // ASH_COMMON_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ |
| OLD | NEW |