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

Side by Side Diff: ui/message_center/views/message_list_view.cc

Issue 2868793002: Delete MessageViews cleared by "Clear All" after animation. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/message_center/views/message_list_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 clear_all_started_ = true; 553 clear_all_started_ = true;
554 554
555 views::View* child = clearing_all_views_.front(); 555 views::View* child = clearing_all_views_.front();
556 clearing_all_views_.pop_front(); 556 clearing_all_views_.pop_front();
557 557
558 // Slide from left to right. 558 // Slide from left to right.
559 gfx::Rect new_bounds = child->bounds(); 559 gfx::Rect new_bounds = child->bounds();
560 new_bounds.set_x(new_bounds.right() + kMarginBetweenItems); 560 new_bounds.set_x(new_bounds.right() + kMarginBetweenItems);
561 animator_.AnimateViewTo(child, new_bounds); 561 animator_.AnimateViewTo(child, new_bounds);
562 562
563 // Deleting the child after animation.
564 deleted_when_done_.insert(child);
565
563 // Schedule to start sliding out next notification after a short delay. 566 // Schedule to start sliding out next notification after a short delay.
564 if (!clearing_all_views_.empty()) { 567 if (!clearing_all_views_.empty()) {
565 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 568 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
566 FROM_HERE, base::Bind(&MessageListView::AnimateClearingOneNotification, 569 FROM_HERE, base::Bind(&MessageListView::AnimateClearingOneNotification,
567 weak_ptr_factory_.GetWeakPtr()), 570 weak_ptr_factory_.GetWeakPtr()),
568 base::TimeDelta::FromMilliseconds( 571 base::TimeDelta::FromMilliseconds(
569 kAnimateClearingNextNotificationDelayMS)); 572 kAnimateClearingNextNotificationDelayMS));
570 } 573 }
571 } 574 }
572 575
573 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) { 576 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) {
574 SetRepositionTarget(target_rect); 577 SetRepositionTarget(target_rect);
575 } 578 }
576 579
577 } // namespace message_center 580 } // namespace message_center
OLDNEW
« no previous file with comments | « no previous file | ui/message_center/views/message_list_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698