OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/location.h" | 6 #include "base/location.h" |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
9 #include "ui/gfx/animation/slide_animation.h" | 9 #include "ui/gfx/animation/slide_animation.h" |
10 #include "ui/message_center/message_center_style.h" | 10 #include "ui/message_center/message_center_style.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 } | 181 } |
182 | 182 |
183 void MessageListView::ResetRepositionSession() { | 183 void MessageListView::ResetRepositionSession() { |
184 // Don't call DoUpdateIfPossible(), but let Layout() do the task without | 184 // Don't call DoUpdateIfPossible(), but let Layout() do the task without |
185 // animation. Reset will cause the change of the bubble size itself, and | 185 // animation. Reset will cause the change of the bubble size itself, and |
186 // animation from the old location will look weird. | 186 // animation from the old location will look weird. |
187 if (reposition_top_ >= 0) { | 187 if (reposition_top_ >= 0) { |
188 has_deferred_task_ = false; | 188 has_deferred_task_ = false; |
189 // cancel cause OnBoundsAnimatorDone which deletes |deleted_when_done_|. | 189 // cancel cause OnBoundsAnimatorDone which deletes |deleted_when_done_|. |
190 animator_.Cancel(); | 190 animator_.Cancel(); |
191 for (auto view : deleting_views_) | 191 for (auto* view : deleting_views_) |
192 delete view; | 192 delete view; |
193 deleting_views_.clear(); | 193 deleting_views_.clear(); |
194 adding_views_.clear(); | 194 adding_views_.clear(); |
195 } | 195 } |
196 | 196 |
197 reposition_top_ = -1; | 197 reposition_top_ = -1; |
198 fixed_height_ = 0; | 198 fixed_height_ = 0; |
199 } | 199 } |
200 | 200 |
201 void MessageListView::ClearAllClosableNotifications( | 201 void MessageListView::ClearAllClosableNotifications( |
(...skipping 21 matching lines...) Expand all Loading... |
223 observers_.AddObserver(observer); | 223 observers_.AddObserver(observer); |
224 } | 224 } |
225 | 225 |
226 void MessageListView::RemoveObserver(MessageListView::Observer* observer) { | 226 void MessageListView::RemoveObserver(MessageListView::Observer* observer) { |
227 observers_.RemoveObserver(observer); | 227 observers_.RemoveObserver(observer); |
228 } | 228 } |
229 | 229 |
230 void MessageListView::OnBoundsAnimatorProgressed( | 230 void MessageListView::OnBoundsAnimatorProgressed( |
231 views::BoundsAnimator* animator) { | 231 views::BoundsAnimator* animator) { |
232 DCHECK_EQ(&animator_, animator); | 232 DCHECK_EQ(&animator_, animator); |
233 for (auto view : deleted_when_done_) { | 233 for (auto* view : deleted_when_done_) { |
234 const gfx::SlideAnimation* animation = animator->GetAnimationForView(view); | 234 const gfx::SlideAnimation* animation = animator->GetAnimationForView(view); |
235 if (animation) | 235 if (animation) |
236 view->layer()->SetOpacity(animation->CurrentValueBetween(1.0, 0.0)); | 236 view->layer()->SetOpacity(animation->CurrentValueBetween(1.0, 0.0)); |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 void MessageListView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { | 240 void MessageListView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { |
241 for (auto view : deleted_when_done_) | 241 for (auto* view : deleted_when_done_) |
242 delete view; | 242 delete view; |
243 deleted_when_done_.clear(); | 243 deleted_when_done_.clear(); |
244 | 244 |
245 if (clear_all_started_) { | 245 if (clear_all_started_) { |
246 clear_all_started_ = false; | 246 clear_all_started_ = false; |
247 for (auto& observer : observers_) | 247 for (auto& observer : observers_) |
248 observer.OnAllNotificationsCleared(); | 248 observer.OnAllNotificationsCleared(); |
249 } | 249 } |
250 | 250 |
251 if (has_deferred_task_) { | 251 if (has_deferred_task_) { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 base::TimeDelta::FromMilliseconds( | 495 base::TimeDelta::FromMilliseconds( |
496 kAnimateClearingNextNotificationDelayMS)); | 496 kAnimateClearingNextNotificationDelayMS)); |
497 } | 497 } |
498 } | 498 } |
499 | 499 |
500 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) { | 500 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) { |
501 SetRepositionTarget(target_rect); | 501 SetRepositionTarget(target_rect); |
502 } | 502 } |
503 | 503 |
504 } // namespace message_center | 504 } // namespace message_center |
OLD | NEW |