Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: ash/common/system/web_notification/web_notification_tray.h

Issue 2103603002: mash: Remove StatusAreaWidget references from system tray classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments, rename SetSystemTrayHeight to SetTrayBubbleHeight Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 WmWindow;
47 48
48 class ASH_EXPORT WebNotificationTray 49 class ASH_EXPORT WebNotificationTray
49 : public TrayBackgroundView, 50 : public TrayBackgroundView,
50 public views::TrayBubbleView::Delegate, 51 public views::TrayBubbleView::Delegate,
51 public message_center::MessageCenterTrayDelegate, 52 public message_center::MessageCenterTrayDelegate,
52 public views::ButtonListener, 53 public views::ButtonListener,
53 public base::SupportsWeakPtr<WebNotificationTray>, 54 public base::SupportsWeakPtr<WebNotificationTray>,
54 public ui::SimpleMenuModel::Delegate { 55 public ui::SimpleMenuModel::Delegate {
55 public: 56 public:
56 explicit WebNotificationTray(StatusAreaWidget* status_area_widget); 57 WebNotificationTray(WmShelf* shelf,
58 WmWindow* status_area_window,
59 SystemTray* system_tray);
57 ~WebNotificationTray() override; 60 ~WebNotificationTray() override;
58 61
59 // Sets the height of the system tray from the edge of the work area so that 62 // Sets the height of the system tray bubble (or legacy notification bubble)
60 // the notification popups don't overlap with the tray. Passes 0 if no UI is 63 // from the edge of the work area so that the web notification popups don't
61 // shown in the system tray side. 64 // overlap with the tray. Pass 0 if no bubble is shown.
62 void SetSystemTrayHeight(int height); 65 void SetTrayBubbleHeight(int height);
63 66
64 // Returns the current system tray height. 67 // Returns the current tray bubble height or 0 if there is no bubble.
65 int system_tray_height_for_test() const; 68 int tray_bubble_height_for_test() const;
66 69
67 // Returns true if it should block the auto hide behavior of the shelf. 70 // Returns true if it should block the auto hide behavior of the shelf.
68 bool ShouldBlockShelfAutoHide() const; 71 bool ShouldBlockShelfAutoHide() const;
69 72
70 // Returns true if the message center bubble is visible. 73 // Returns true if the message center bubble is visible.
71 bool IsMessageCenterBubbleVisible() const; 74 bool IsMessageCenterBubbleVisible() const;
72 75
73 // Returns true if the mouse is inside the notification bubble. 76 // Returns true if the mouse is inside the notification bubble.
74 bool IsMouseInNotificationBubble() const; 77 bool IsMouseInNotificationBubble() const;
75 78
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 165 }
163 166
164 // Returns true if any user is logged in and the system is not at the screen 167 // Returns true if any user is logged in and the system is not at the screen
165 // for adding a secondary user. 168 // for adding a secondary user.
166 bool IsLoggedIn() const; 169 bool IsLoggedIn() const;
167 170
168 // Testing accessors. 171 // Testing accessors.
169 bool IsPopupVisible() const; 172 bool IsPopupVisible() const;
170 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest(); 173 message_center::MessageCenterBubble* GetMessageCenterBubbleForTest();
171 174
172 StatusAreaWidget* status_area_widget_; 175 WmWindow* status_area_window_;
176 SystemTray* system_tray_;
173 std::unique_ptr<message_center::MessageCenterTray> message_center_tray_; 177 std::unique_ptr<message_center::MessageCenterTray> message_center_tray_;
174 std::unique_ptr<WebNotificationBubbleWrapper> message_center_bubble_; 178 std::unique_ptr<WebNotificationBubbleWrapper> message_center_bubble_;
175 std::unique_ptr<message_center::MessagePopupCollection> popup_collection_; 179 std::unique_ptr<message_center::MessagePopupCollection> popup_collection_;
176 WebNotificationButton* button_; 180 WebNotificationButton* button_;
177 181
178 bool show_message_center_on_unlock_; 182 bool show_message_center_on_unlock_;
179 183
180 bool should_update_tray_content_; 184 bool should_update_tray_content_;
181 185
182 // True when the shelf auto hide behavior has to be blocked. Previously 186 // True when the shelf auto hide behavior has to be blocked. Previously
183 // this was done by checking |message_center_bubble_| but actually 187 // this was done by checking |message_center_bubble_| but actually
184 // the check can be called when creating this object, so it would cause 188 // 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 189 // flickers of the shelf from hidden to shown. See: crbug.com/181213
186 bool should_block_shelf_auto_hide_; 190 bool should_block_shelf_auto_hide_;
187 191
188 std::unique_ptr<AshPopupAlignmentDelegate> popup_alignment_delegate_; 192 std::unique_ptr<AshPopupAlignmentDelegate> popup_alignment_delegate_;
189 193
190 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray); 194 DISALLOW_COPY_AND_ASSIGN(WebNotificationTray);
191 }; 195 };
192 196
193 } // namespace ash 197 } // namespace ash
194 198
195 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_ 199 #endif // ASH_COMMON_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_TRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698