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

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

Issue 1645843003: Implement Non-Closable Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed the comments Created 4 years, 10 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
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "ui/gfx/animation/slide_animation.h" 6 #include "ui/gfx/animation/slide_animation.h"
7 #include "ui/message_center/message_center_style.h" 7 #include "ui/message_center/message_center_style.h"
8 #include "ui/message_center/message_center_switches.h" 8 #include "ui/message_center/message_center_switches.h"
9 #include "ui/message_center/views/message_center_view.h" 9 #include "ui/message_center/views/message_center_view.h"
10 #include "ui/message_center/views/message_list_view.h" 10 #include "ui/message_center/views/message_list_view.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 animator_.Cancel(); 184 animator_.Cancel();
185 STLDeleteContainerPointers(deleting_views_.begin(), deleting_views_.end()); 185 STLDeleteContainerPointers(deleting_views_.begin(), deleting_views_.end());
186 deleting_views_.clear(); 186 deleting_views_.clear();
187 adding_views_.clear(); 187 adding_views_.clear();
188 } 188 }
189 189
190 reposition_top_ = -1; 190 reposition_top_ = -1;
191 fixed_height_ = 0; 191 fixed_height_ = 0;
192 } 192 }
193 193
194 void MessageListView::ClearAllNotifications( 194 void MessageListView::ClearAllClosableNotifications(
dewittj 2016/02/08 18:02:34 How does the clear-all animation look when there a
yoshiki 2016/02/09 23:42:25 Android dosen't have any animation for non-closabl
dewittj 2016/02/10 00:03:15 Does the ChromeOS notification center close itself
195 const gfx::Rect& visible_scroll_rect) { 195 const gfx::Rect& visible_scroll_rect) {
196 for (int i = 0; i < child_count(); ++i) { 196 for (int i = 0; i < child_count(); ++i) {
197 views::View* child = child_at(i); 197 // Safe cast since all views in MessageListView are MessageViews.
198 MessageView* child = (MessageView*)child_at(i);
198 if (!child->visible()) 199 if (!child->visible())
199 continue; 200 continue;
200 if (gfx::IntersectRects(child->bounds(), visible_scroll_rect).IsEmpty()) 201 if (gfx::IntersectRects(child->bounds(), visible_scroll_rect).IsEmpty())
201 continue; 202 continue;
203 if (!child->IsClosable())
204 continue;
202 clearing_all_views_.push_back(child); 205 clearing_all_views_.push_back(child);
203 } 206 }
204 DoUpdateIfPossible(); 207 if (clearing_all_views_.empty()) {
208 message_center_view()->OnAllNotificationsCleared();
209 } else {
210 DoUpdateIfPossible();
211 }
205 } 212 }
206 213
207 void MessageListView::OnBoundsAnimatorProgressed( 214 void MessageListView::OnBoundsAnimatorProgressed(
208 views::BoundsAnimator* animator) { 215 views::BoundsAnimator* animator) {
209 DCHECK_EQ(&animator_, animator); 216 DCHECK_EQ(&animator_, animator);
210 for (std::set<views::View*>::iterator iter = deleted_when_done_.begin(); 217 for (std::set<views::View*>::iterator iter = deleted_when_done_.begin();
211 iter != deleted_when_done_.end(); ++iter) { 218 iter != deleted_when_done_.end(); ++iter) {
212 const gfx::SlideAnimation* animation = animator->GetAnimationForView(*iter); 219 const gfx::SlideAnimation* animation = animator->GetAnimationForView(*iter);
213 if (animation) 220 if (animation)
214 (*iter)->layer()->SetOpacity(animation->CurrentValueBetween(1.0, 0.0)); 221 (*iter)->layer()->SetOpacity(animation->CurrentValueBetween(1.0, 0.0));
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 base::TimeDelta::FromMilliseconds( 462 base::TimeDelta::FromMilliseconds(
456 kAnimateClearingNextNotificationDelayMS)); 463 kAnimateClearingNextNotificationDelayMS));
457 } 464 }
458 } 465 }
459 466
460 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) { 467 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) {
461 SetRepositionTarget(target_rect); 468 SetRepositionTarget(target_rect);
462 } 469 }
463 470
464 } // namespace message_center 471 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698