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

Unified Diff: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc

Issue 2799963003: Fix errors in display resolution change notifications (Closed)
Patch Set: Created 3 years, 8 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: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
index 297d54326916649163d325b92753837f5ffa1899..4b9a7a3b17d5721bf6e17ad9ab25320859c37341 100644
--- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
@@ -491,19 +491,28 @@ void DisplayOptionsHandler::HandleSetDisplayMode(const base::ListValue* args) {
display::DisplayManager* display_manager = GetDisplayManager();
scoped_refptr<display::ManagedDisplayMode> current_mode =
display_manager->GetActiveModeForDisplayId(display_id);
+
+ if (mode->IsEquivalent(current_mode)) {
+ LOG(ERROR) << "New display mode matches current mode.";
+ return;
+ }
+
+ // We must prepare the notification before we set the mode, since setting
+ // the mode actually shows the notification, so it should be ready by then.
+ // crbug.com/701389.
+ if (display::Display::IsInternalDisplayId(display_id)) {
+ // For external displays, show a notification confirming the resolution
+ // change.
+ ash::Shell::GetInstance()
+ ->resolution_notification_controller()
+ ->PrepareNotification(display_id, current_mode, mode,
+ base::Bind(&chromeos::StoreDisplayPrefs));
+ }
+
if (!display_manager->SetDisplayMode(display_id, mode)) {
LOG(ERROR) << "Unable to set display mode for: " << display_id
<< " Mode: " << *mode_data;
- return;
}
- if (display::Display::IsInternalDisplayId(display_id))
- return;
- // For external displays, show a notification confirming the resolution
- // change.
- ash::Shell::GetInstance()
- ->resolution_notification_controller()
- ->PrepareNotification(display_id, current_mode, mode,
- base::Bind(&chromeos::StoreDisplayPrefs));
}
void DisplayOptionsHandler::HandleSetRotation(const base::ListValue* args) {

Powered by Google App Engine
This is Rietveld 408576698