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

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

Issue 2836023002: Fix use-after-free in MessageListView. (Closed)
Patch Set: rebase 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 } 618 }
619 settings_transition_animation_.reset(new gfx::MultiAnimation( 619 settings_transition_animation_.reset(new gfx::MultiAnimation(
620 parts, base::TimeDelta::FromMicroseconds(1000000 / kDefaultFrameRateHz))); 620 parts, base::TimeDelta::FromMicroseconds(1000000 / kDefaultFrameRateHz)));
621 settings_transition_animation_->set_delegate(this); 621 settings_transition_animation_->set_delegate(this);
622 settings_transition_animation_->set_continuous(false); 622 settings_transition_animation_->set_continuous(false);
623 settings_transition_animation_->Start(); 623 settings_transition_animation_->Start();
624 } 624 }
625 625
626 void MessageCenterView::UpdateButtonBarStatus() { 626 void MessageCenterView::UpdateButtonBarStatus() {
627 // Disables all buttons during animation of cleaning of all notifications. 627 // Disables all buttons during animation of cleaning of all notifications.
628 if (is_clearing_) { 628 if (is_clearing_all_notifications_) {
629 button_bar_->SetSettingsAndQuietModeButtonsEnabled(false); 629 button_bar_->SetSettingsAndQuietModeButtonsEnabled(false);
630 button_bar_->SetCloseAllButtonEnabled(false); 630 button_bar_->SetCloseAllButtonEnabled(false);
631 return; 631 return;
632 } 632 }
633 633
634 button_bar_->SetBackArrowVisible(mode_ == Mode::SETTINGS); 634 button_bar_->SetBackArrowVisible(mode_ == Mode::SETTINGS);
635 button_bar_->SetButtonsVisible(!is_locked_); 635 button_bar_->SetButtonsVisible(!is_locked_);
636 button_bar_->SetTitle(GetButtonBarTitle()); 636 button_bar_->SetTitle(GetButtonBarTitle());
637 637
638 if (!is_locked_) 638 if (!is_locked_)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 } 687 }
688 break; 688 break;
689 } 689 }
690 } 690 }
691 691
692 // Notify accessibility that the contents have changed. 692 // Notify accessibility that the contents have changed.
693 view->NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, false); 693 view->NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, false);
694 } 694 }
695 695
696 } // namespace message_center 696 } // 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