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

Unified Diff: ash/system/web_notification/web_notification_tray.cc

Issue 2075953003: mash: Convert WebNotificationTray to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@statusarea
Patch Set: rebase Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/web_notification/web_notification_tray.cc
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index de86ec23c95e6118b815f2b9ef4a3d73d021e944..9f300f4eef8c1706da7edb325602ef50d2762a59 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -10,13 +10,12 @@
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shelf/wm_shelf_util.h"
-#include "ash/common/shell_window_ids.h"
#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_utils.h"
#include "ash/common/wm_lookup.h"
#include "ash/common/wm_root_window_controller.h"
+#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
-#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/tray_background_view.h"
@@ -221,12 +220,7 @@ WebNotificationTray::WebNotificationTray(StatusAreaWidget* status_area_widget)
->GetRootWindowController()
->GetShelf();
popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf));
- // TODO(jamescook): Either MessagePopupCollection needs to become aware of
- // mus or we need some sort of parent/container provider.
popup_collection_.reset(new message_center::MessagePopupCollection(
- ash::Shell::GetContainer(
- status_area_widget->GetNativeView()->GetRootWindow(),
- kShellWindowId_StatusContainer),
message_center(),
message_center_tray_.get(),
popup_alignment_delegate_.get()));
@@ -427,12 +421,7 @@ bool WebNotificationTray::ShowNotifierSettings() {
}
bool WebNotificationTray::IsContextMenuEnabled() const {
- LoginStatus login_status = status_area_widget()->login_status();
- bool userAddingRunning = ash::Shell::GetInstance()
- ->session_state_delegate()
- ->IsInSecondaryLoginScreen();
-
- return login_status != LoginStatus::NOT_LOGGED_IN && !userAddingRunning;
+ return IsLoggedIn();
}
message_center::MessageCenterTray* WebNotificationTray::GetMessageCenterTray() {
@@ -495,13 +484,8 @@ void WebNotificationTray::UpdateTrayContent() {
button_->SetState(views::CustomButton::STATE_PRESSED);
else
button_->SetState(views::CustomButton::STATE_NORMAL);
- bool userAddingRunning = ash::Shell::GetInstance()
- ->session_state_delegate()
- ->IsInSecondaryLoginScreen();
- SetVisible(
- (status_area_widget()->login_status() != LoginStatus::NOT_LOGGED_IN) &&
- !userAddingRunning);
+ SetVisible(IsLoggedIn());
Layout();
SchedulePaint();
}
@@ -518,6 +502,11 @@ message_center::MessageCenter* WebNotificationTray::message_center() const {
return message_center_tray_->message_center();
}
+bool WebNotificationTray::IsLoggedIn() const {
+ return status_area_widget()->login_status() != LoginStatus::NOT_LOGGED_IN &&
+ !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen();
+}
+
// Methods for testing
bool WebNotificationTray::IsPopupVisible() const {
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | ash/system/web_notification/web_notification_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698