| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 AddChildViewAt(view, real_index); | 95 AddChildViewAt(view, real_index); |
| 96 if (GetContentsBounds().IsEmpty()) | 96 if (GetContentsBounds().IsEmpty()) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 adding_views_.insert(view); | 99 adding_views_.insert(view); |
| 100 DoUpdateIfPossible(); | 100 DoUpdateIfPossible(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void MessageListView::RemoveNotification(MessageView* view) { | 103 void MessageListView::RemoveNotification(MessageView* view) { |
| 104 DCHECK_EQ(view->parent(), this); | 104 DCHECK_EQ(view->parent(), this); |
| 105 |
| 106 |
| 105 if (GetContentsBounds().IsEmpty()) { | 107 if (GetContentsBounds().IsEmpty()) { |
| 106 delete view; | 108 delete view; |
| 107 } else { | 109 } else { |
| 110 if (adding_views_.find(view) != adding_views_.end()) |
| 111 adding_views_.erase(view); |
| 112 if (animator_.IsAnimating(view)) |
| 113 animator_.StopAnimatingView(view); |
| 114 |
| 108 if (view->layer()) { | 115 if (view->layer()) { |
| 109 deleting_views_.insert(view); | 116 deleting_views_.insert(view); |
| 110 } else { | 117 } else { |
| 111 animator_.StopAnimatingView(view); | |
| 112 delete view; | 118 delete view; |
| 113 } | 119 } |
| 114 DoUpdateIfPossible(); | 120 DoUpdateIfPossible(); |
| 115 } | 121 } |
| 116 } | 122 } |
| 117 | 123 |
| 118 void MessageListView::UpdateNotification(MessageView* view, | 124 void MessageListView::UpdateNotification(MessageView* view, |
| 119 const Notification& notification) { | 125 const Notification& notification) { |
| 120 int index = GetIndexOf(view); | 126 int index = GetIndexOf(view); |
| 121 DCHECK_LE(0, index); // GetIndexOf is negative if not a child. | 127 DCHECK_LE(0, index); // GetIndexOf is negative if not a child. |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 base::TimeDelta::FromMilliseconds( | 471 base::TimeDelta::FromMilliseconds( |
| 466 kAnimateClearingNextNotificationDelayMS)); | 472 kAnimateClearingNextNotificationDelayMS)); |
| 467 } | 473 } |
| 468 } | 474 } |
| 469 | 475 |
| 470 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) { | 476 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) { |
| 471 SetRepositionTarget(target_rect); | 477 SetRepositionTarget(target_rect); |
| 472 } | 478 } |
| 473 | 479 |
| 474 } // namespace message_center | 480 } // namespace message_center |
| OLD | NEW |