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

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

Issue 2848523002: Fix use-after-free in MessageListView. (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
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 void MessageCenterView::SetSettingsVisible(bool visible) { 171 void MessageCenterView::SetSettingsVisible(bool visible) {
172 settings_visible_ = visible; 172 settings_visible_ = visible;
173 Update(true /* animate */); 173 Update(true /* animate */);
174 } 174 }
175 175
176 void MessageCenterView::ClearAllClosableNotifications() { 176 void MessageCenterView::ClearAllClosableNotifications() {
177 if (is_closing_) 177 if (is_closing_)
178 return; 178 return;
179 179
180 is_clearing_ = true; 180 is_clearing_all_notifications_ = true;
181 UpdateButtonBarStatus(); 181 UpdateButtonBarStatus();
182 SetViewHierarchyEnabled(scroller_, false); 182 SetViewHierarchyEnabled(scroller_, false);
183 message_list_view_->ClearAllClosableNotifications( 183 message_list_view_->ClearAllClosableNotifications(
184 scroller_->GetVisibleRect()); 184 scroller_->GetVisibleRect());
185 } 185 }
186 186
187 void MessageCenterView::OnAllNotificationsCleared() { 187 void MessageCenterView::OnAllNotificationsCleared() {
188 is_clearing_ = false; 188 is_clearing_all_notifications_ = false;
189 SetViewHierarchyEnabled(scroller_, true); 189 SetViewHierarchyEnabled(scroller_, true);
190 button_bar_->SetCloseAllButtonEnabled(false); 190 button_bar_->SetCloseAllButtonEnabled(false);
191 191
192 // The status of buttons will be updated after removing all notifications. 192 // The status of buttons will be updated after removing all notifications.
193 193
194 // Action by user. 194 // Action by user.
195 message_center_->RemoveAllNotifications( 195 message_center_->RemoveAllNotifications(
196 true /* by_user */, 196 true /* by_user */,
197 message_center::MessageCenter::RemoveType::NON_PINNED); 197 message_center::MessageCenter::RemoveType::NON_PINNED);
198 } 198 }
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 } 632 }
633 settings_transition_animation_.reset(new gfx::MultiAnimation( 633 settings_transition_animation_.reset(new gfx::MultiAnimation(
634 parts, base::TimeDelta::FromMicroseconds(1000000 / kDefaultFrameRateHz))); 634 parts, base::TimeDelta::FromMicroseconds(1000000 / kDefaultFrameRateHz)));
635 settings_transition_animation_->set_delegate(this); 635 settings_transition_animation_->set_delegate(this);
636 settings_transition_animation_->set_continuous(false); 636 settings_transition_animation_->set_continuous(false);
637 settings_transition_animation_->Start(); 637 settings_transition_animation_->Start();
638 } 638 }
639 639
640 void MessageCenterView::UpdateButtonBarStatus() { 640 void MessageCenterView::UpdateButtonBarStatus() {
641 // Disables all buttons during animation of cleaning of all notifications. 641 // Disables all buttons during animation of cleaning of all notifications.
642 if (is_clearing_) { 642 if (is_clearing_all_notifications_) {
643 button_bar_->SetSettingsAndQuietModeButtonsEnabled(false); 643 button_bar_->SetSettingsAndQuietModeButtonsEnabled(false);
644 button_bar_->SetCloseAllButtonEnabled(false); 644 button_bar_->SetCloseAllButtonEnabled(false);
645 return; 645 return;
646 } 646 }
647 647
648 button_bar_->SetBackArrowVisible(mode_ == Mode::SETTINGS); 648 button_bar_->SetBackArrowVisible(mode_ == Mode::SETTINGS);
649 button_bar_->SetButtonsVisible(!is_locked_); 649 button_bar_->SetButtonsVisible(!is_locked_);
650 button_bar_->SetTitle(GetButtonBarTitle()); 650 button_bar_->SetTitle(GetButtonBarTitle());
651 651
652 if (!is_locked_) 652 if (!is_locked_)
(...skipping 14 matching lines...) Expand all
667 // Disable the close-all button since no notification is visible. 667 // Disable the close-all button since no notification is visible.
668 button_bar_->SetCloseAllButtonEnabled(false); 668 button_bar_->SetCloseAllButtonEnabled(false);
669 } 669 }
670 } 670 }
671 671
672 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { 672 void MessageCenterView::SetNotificationViewForTest(MessageView* view) {
673 message_list_view_->AddNotificationAt(view, 0); 673 message_list_view_->AddNotificationAt(view, 0);
674 } 674 }
675 675
676 } // namespace message_center 676 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/message_center_view.h ('k') | ui/message_center/views/message_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698