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

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

Issue 1645843003: Implement Non-Closable Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary property. Created 4 years, 9 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/message_center/views/message_center_view.h" 5 #include "ui/message_center/views/message_center_view.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 settings_transition_animation_.reset(new gfx::MultiAnimation( 249 settings_transition_animation_.reset(new gfx::MultiAnimation(
250 parts, base::TimeDelta::FromMicroseconds(1000000 / kDefaultFrameRateHz))); 250 parts, base::TimeDelta::FromMicroseconds(1000000 / kDefaultFrameRateHz)));
251 settings_transition_animation_->set_delegate(this); 251 settings_transition_animation_->set_delegate(this);
252 settings_transition_animation_->set_continuous(false); 252 settings_transition_animation_->set_continuous(false);
253 settings_transition_animation_->Start(); 253 settings_transition_animation_->Start();
254 254
255 button_bar_->SetBackArrowVisible(visible); 255 button_bar_->SetBackArrowVisible(visible);
256 } 256 }
257 257
258 void MessageCenterView::ClearAllNotifications() { 258 void MessageCenterView::ClearAllClosableNotifications() {
259 if (is_closing_) 259 if (is_closing_)
260 return; 260 return;
261 261
262 SetViewHierarchyEnabled(scroller_, false); 262 SetViewHierarchyEnabled(scroller_, false);
263 button_bar_->SetAllButtonsEnabled(false); 263 button_bar_->SetAllButtonsEnabled(false);
264 message_list_view_->ClearAllNotifications(scroller_->GetVisibleRect()); 264 message_list_view_->ClearAllClosableNotifications(
265 scroller_->GetVisibleRect());
265 } 266 }
266 267
267 void MessageCenterView::OnAllNotificationsCleared() { 268 void MessageCenterView::OnAllNotificationsCleared() {
268 SetViewHierarchyEnabled(scroller_, true); 269 SetViewHierarchyEnabled(scroller_, true);
269 button_bar_->SetAllButtonsEnabled(true); 270 button_bar_->SetAllButtonsEnabled(true);
270 button_bar_->SetCloseAllButtonEnabled(false); 271 button_bar_->SetCloseAllButtonEnabled(false);
271 message_center_->RemoveAllVisibleNotifications(true); // Action by user. 272
273 // Action by user.
274 message_center_->RemoveAllNotifications(
275 true /* by_user */,
276 message_center::MessageCenter::RemoveType::NON_PINNED);
272 } 277 }
273 278
274 size_t MessageCenterView::NumMessageViewsForTest() const { 279 size_t MessageCenterView::NumMessageViewsForTest() const {
275 return message_list_view_->child_count(); 280 return message_list_view_->child_count();
276 } 281 }
277 282
278 void MessageCenterView::OnSettingsChanged() { 283 void MessageCenterView::OnSettingsChanged() {
279 scroller_->InvalidateLayout(); 284 scroller_->InvalidateLayout();
280 PreferredSizeChanged(); 285 PreferredSizeChanged();
281 Layout(); 286 Layout();
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 View* focused_view = NULL; 586 View* focused_view = NULL;
582 // |focus_manager| can be NULL in tests. 587 // |focus_manager| can be NULL in tests.
583 if (focus_manager) 588 if (focus_manager)
584 focused_view = focus_manager->GetFocusedView(); 589 focused_view = focus_manager->GetFocusedView();
585 590
586 // All the children of this view are owned by |this|. 591 // All the children of this view are owned by |this|.
587 scroller_->contents()->RemoveAllChildViews(/*delete_children=*/false); 592 scroller_->contents()->RemoveAllChildViews(/*delete_children=*/false);
588 scroller_->contents()->AddChildView( 593 scroller_->contents()->AddChildView(
589 no_message_views ? empty_list_view_.get() : message_list_view_.get()); 594 no_message_views ? empty_list_view_.get() : message_list_view_.get());
590 595
591 button_bar_->SetCloseAllButtonEnabled(!no_message_views); 596 bool no_closable_views = true;
597 for (const auto& view : notification_views_) {
598 if (!view.second->IsPinned()) {
599 no_closable_views = false;
600 break;
601 }
602 }
603 button_bar_->SetCloseAllButtonEnabled(!no_closable_views);
592 scroller_->SetFocusable(!no_message_views); 604 scroller_->SetFocusable(!no_message_views);
593 605
594 if (focus_manager && focused_view) 606 if (focus_manager && focused_view)
595 focus_manager->SetFocusedView(focused_view); 607 focus_manager->SetFocusedView(focused_view);
596 608
597 scroller_->InvalidateLayout(); 609 scroller_->InvalidateLayout();
598 PreferredSizeChanged(); 610 PreferredSizeChanged();
599 Layout(); 611 Layout();
600 } 612 }
601 613
602 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { 614 void MessageCenterView::SetNotificationViewForTest(MessageView* view) {
603 message_list_view_->AddNotificationAt(view, 0); 615 message_list_view_->AddNotificationAt(view, 0);
604 } 616 }
605 617
606 } // namespace message_center 618 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/message_center_view.h ('k') | ui/message_center/views/message_center_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698