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 #include "ash/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
6 | 6 |
7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/resources/vector_icons/vector_icons.h" | 8 #include "ash/resources/vector_icons/vector_icons.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/session/session_controller.h" | 10 #include "ash/session/session_controller.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (parent()) | 148 if (parent()) |
149 parent()->RemoveChildView(this); | 149 parent()->RemoveChildView(this); |
150 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); | 150 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
151 } else { | 151 } else { |
152 delete_after_animation_ = true; | 152 delete_after_animation_ = true; |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 protected: | 156 protected: |
157 // Overridden from views::View: | 157 // Overridden from views::View: |
158 gfx::Size GetPreferredSize() const override { | 158 gfx::Size CalculatePreferredSize() const override { |
159 if (!animation_.get() || !animation_->is_animating()) | 159 if (!animation_.get() || !animation_->is_animating()) |
160 return kTrayItemOuterSize; | 160 return kTrayItemOuterSize; |
161 | 161 |
162 // Animate the width (or height) when this item shows (or hides) so that | 162 // Animate the width (or height) when this item shows (or hides) so that |
163 // the icons on the left are shifted with the animation. | 163 // the icons on the left are shifted with the animation. |
164 // Note that TrayItemView does the same thing. | 164 // Note that TrayItemView does the same thing. |
165 gfx::Size size = kTrayItemOuterSize; | 165 gfx::Size size = kTrayItemOuterSize; |
166 if (tray_->shelf()->IsHorizontalAlignment()) { | 166 if (tray_->shelf()->IsHorizontalAlignment()) { |
167 size.set_width(std::max( | 167 size.set_width(std::max( |
168 1, gfx::ToRoundedInt(size.width() * animation_->GetCurrentValue()))); | 168 1, gfx::ToRoundedInt(size.width() * animation_->GetCurrentValue()))); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 602 |
603 message_center::MessageCenterBubble* | 603 message_center::MessageCenterBubble* |
604 WebNotificationTray::GetMessageCenterBubbleForTest() { | 604 WebNotificationTray::GetMessageCenterBubbleForTest() { |
605 if (!message_center_bubble()) | 605 if (!message_center_bubble()) |
606 return nullptr; | 606 return nullptr; |
607 return static_cast<message_center::MessageCenterBubble*>( | 607 return static_cast<message_center::MessageCenterBubble*>( |
608 message_center_bubble()->bubble()); | 608 message_center_bubble()->bubble()); |
609 } | 609 } |
610 | 610 |
611 } // namespace ash | 611 } // namespace ash |
OLD | NEW |