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

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

Issue 2095663004: Revert of mash: Convert TrayBackgroundView to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 4125dd58ab073f10ac94867cd079f3a2472b322e..208187b9972a67c591f93046e8c98e7aa87d3065 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -11,8 +11,6 @@
#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/system_tray_delegate.h"
-#include "ash/common/system/tray/tray_bubble_wrapper.h"
#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_utils.h"
#include "ash/common/wm_lookup.h"
@@ -21,6 +19,8 @@
#include "ash/common/wm_window.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
+#include "ash/system/tray/tray_background_view.h"
+#include "ash/system/tray/tray_bubble_wrapper.h"
#include "ash/system/web_notification/ash_popup_alignment_delegate.h"
#include "base/auto_reset.h"
#include "base/i18n/number_formatting.h"
@@ -205,13 +205,11 @@
};
WebNotificationTray::WebNotificationTray(StatusAreaWidget* status_area_widget)
- : TrayBackgroundView(status_area_widget->wm_shelf()),
- status_area_widget_(status_area_widget),
+ : TrayBackgroundView(status_area_widget),
button_(NULL),
show_message_center_on_unlock_(false),
should_update_tray_content_(false),
should_block_shelf_auto_hide_(false) {
- DCHECK(status_area_widget_);
button_ = new WebNotificationButton(this);
button_->set_triggerable_event_flags(
ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON);
@@ -258,13 +256,14 @@
message_center_tray_.get(),
true);
+ WmShelf* shelf = GetShelf();
int max_height;
- if (IsHorizontalAlignment(shelf()->GetAlignment())) {
- max_height = shelf()->GetIdealBounds().y();
+ if (IsHorizontalAlignment(shelf->GetAlignment())) {
+ max_height = shelf->GetIdealBounds().y();
} else {
// Assume the status area and bubble bottoms are aligned when vertical.
WmWindow* status_area_window =
- WmLookup::Get()->GetWindowForWidget(status_area_widget_);
+ WmLookup::Get()->GetWindowForWidget(status_area_widget());
gfx::Rect bounds_in_root =
status_area_window->GetRootWindow()->ConvertRectFromScreen(
status_area_window->GetBoundsInScreen());
@@ -277,8 +276,8 @@
message_center_bubble_.reset(
new WebNotificationBubbleWrapper(this, message_center_bubble));
- status_area_widget_->SetHideSystemNotifications(true);
- shelf()->UpdateAutoHideState();
+ status_area_widget()->SetHideSystemNotifications(true);
+ shelf->UpdateAutoHideState();
button_->SetBubbleVisible(true);
SetDrawBackgroundAsActive(true);
return true;
@@ -295,8 +294,8 @@
message_center_bubble_.reset();
should_block_shelf_auto_hide_ = false;
show_message_center_on_unlock_ = false;
- status_area_widget_->SetHideSystemNotifications(false);
- shelf()->UpdateAutoHideState();
+ status_area_widget()->SetHideSystemNotifications(false);
+ GetShelf()->UpdateAutoHideState();
button_->SetBubbleVisible(false);
}
@@ -324,8 +323,8 @@
// Private methods.
bool WebNotificationTray::ShouldShowMessageCenter() {
- return !(status_area_widget_->system_tray() &&
- status_area_widget_->system_tray()->HasNotificationBubble());
+ return !(status_area_widget()->system_tray() &&
+ status_area_widget()->system_tray()->HasNotificationBubble());
}
bool WebNotificationTray::ShouldBlockShelfAutoHide() const {
@@ -520,11 +519,8 @@
}
bool WebNotificationTray::IsLoggedIn() const {
- WmShell* shell = WmShell::Get();
- // TODO(jamescook): Should this also check LoginState::LOCKED?
- return shell->system_tray_delegate()->GetUserLoginStatus() !=
- LoginStatus::NOT_LOGGED_IN &&
- !shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen();
+ return status_area_widget()->login_status() != LoginStatus::NOT_LOGGED_IN &&
+ !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen();
}
// Methods for testing
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | chrome/browser/chromeos/ui/focus_ring_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698