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

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

Issue 2807693002: Make LogoutButtonTray a regular View (Closed)
Patch Set: Rebased Created 3 years, 8 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
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 20d9149476cec9bb4d9735fed36f519a069d6f65..e3bc136932ceea183ae2b488808f4db1a92912b5 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -18,6 +18,7 @@
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/tray_bubble_wrapper.h"
#include "ash/system/tray/tray_constants.h"
+#include "ash/system/tray/tray_container.h"
#include "ash/system/tray/tray_utils.h"
#include "ash/system/web_notification/ash_popup_alignment_delegate.h"
#include "ash/wm_window.h"
@@ -164,7 +165,7 @@ class WebNotificationItem : public views::View, public gfx::AnimationDelegate {
// the icons on the left are shifted with the animation.
// Note that TrayItemView does the same thing.
gfx::Size size = kTrayItemOuterSize;
- if (IsHorizontalLayout()) {
+ if (tray_->shelf()->IsHorizontalAlignment()) {
size.set_width(std::max(
1, gfx::ToRoundedInt(size.width() * animation_->GetCurrentValue())));
} else {
@@ -178,15 +179,11 @@ class WebNotificationItem : public views::View, public gfx::AnimationDelegate {
return GetPreferredSize().height();
}
- bool IsHorizontalLayout() const {
- return IsHorizontalAlignment(tray_->shelf_alignment());
- }
-
private:
// gfx::AnimationDelegate:
void AnimationProgressed(const gfx::Animation* animation) override {
gfx::Transform transform;
- if (IsHorizontalLayout()) {
+ if (tray_->shelf()->IsHorizontalAlignment()) {
transform.Translate(0, animation->CurrentValueBetween(
static_cast<double>(height()) / 2., 0.));
} else {
@@ -273,7 +270,7 @@ class WebNotificationLabel : public WebNotificationItem {
WebNotificationTray::WebNotificationTray(WmShelf* shelf,
WmWindow* status_area_window,
SystemTray* system_tray)
- : TrayBackgroundView(shelf, true),
+ : TrayBackgroundView(shelf),
status_area_window_(status_area_window),
system_tray_(system_tray),
show_message_center_on_unlock_(false),
@@ -333,7 +330,7 @@ bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings) {
// In the horizontal case, message center starts from the top of the shelf.
// In the vertical case, it starts from the bottom of WebNotificationTray.
- const int max_height = IsHorizontalAlignment(shelf_alignment())
+ const int max_height = shelf()->IsHorizontalAlignment()
? shelf()->GetIdealBounds().y()
: GetBoundsInScreen().bottom();
message_center_bubble->SetMaxHeight(max_height);
@@ -344,7 +341,7 @@ bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings) {
// For vertical shelf alignments, anchor to the WebNotificationTray, but for
// horizontal (i.e. bottom) shelves, anchor to the system tray.
TrayBackgroundView* anchor_tray = this;
- if (IsHorizontalAlignment(shelf_alignment())) {
+ if (shelf()->IsHorizontalAlignment()) {
anchor_tray = WmShelf::ForWindow(status_area_window_)
->GetStatusAreaWidget()
->system_tray();
@@ -420,10 +417,8 @@ void WebNotificationTray::UpdateAfterLoginStatusChange(
OnMessageCenterTrayChanged();
}
-void WebNotificationTray::SetShelfAlignment(ShelfAlignment alignment) {
- if (alignment == shelf_alignment())
- return;
- TrayBackgroundView::SetShelfAlignment(alignment);
+void WebNotificationTray::UpdateAfterShelfAlignmentChange() {
+ TrayBackgroundView::UpdateAfterShelfAlignmentChange();
// Destroy any existing bubble so that it will be rebuilt correctly.
message_center_tray_->HideMessageCenterBubble();
message_center_tray_->HidePopupBubble();
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698