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

Unified Diff: ash/display/resolution_notification_controller.cc

Issue 22960004: Fix the crash bug of close button for the resolution change notification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the new test Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/resolution_notification_controller.cc
diff --git a/ash/display/resolution_notification_controller.cc b/ash/display/resolution_notification_controller.cc
index a765d610fec89b826d06f220c872d7decebfa538..e2755a037a88ce65a3b746f816566c5b53db0e63 100644
--- a/ash/display/resolution_notification_controller.cc
+++ b/ash/display/resolution_notification_controller.cc
@@ -71,11 +71,11 @@ void ResolutionChangeNotificationDelegate::Error() {
void ResolutionChangeNotificationDelegate::Close(bool by_user) {
if (by_user)
- controller_->AcceptResolutionChange();
+ controller_->AcceptResolutionChange(false);
}
void ResolutionChangeNotificationDelegate::Click() {
- controller_->AcceptResolutionChange();
+ controller_->AcceptResolutionChange(true);
}
bool ResolutionChangeNotificationDelegate::HasClickedListener() {
@@ -86,7 +86,7 @@ void ResolutionChangeNotificationDelegate::ButtonClick(int button_index) {
// If there's the timeout, the first button is "Accept". Otherwise the
// button click should be "Revert".
if (has_timeout_ && button_index == 0)
- controller_->AcceptResolutionChange();
+ controller_->AcceptResolutionChange(true);
else
controller_->RevertResolutionChange();
}
@@ -243,9 +243,12 @@ void ResolutionNotificationController::OnTimerTick() {
CreateOrUpdateNotification();
}
-void ResolutionNotificationController::AcceptResolutionChange() {
- message_center::MessageCenter::Get()->RemoveNotification(
- kNotificationId, false /* by_user */);
+void ResolutionNotificationController::AcceptResolutionChange(
+ bool close_notification) {
+ if (close_notification) {
+ message_center::MessageCenter::Get()->RemoveNotification(
+ kNotificationId, false /* by_user */);
+ }
base::Closure callback = change_info_->accept_callback;
change_info_.reset();
callback.Run();
« no previous file with comments | « ash/display/resolution_notification_controller.h ('k') | ash/display/resolution_notification_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698