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

Unified Diff: ash/display/resolution_notification_controller.h

Issue 2799963003: Fix errors in display resolution change notifications (Closed)
Patch Set: Update commit message 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
« no previous file with comments | « no previous file | ash/display/resolution_notification_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/resolution_notification_controller.h
diff --git a/ash/display/resolution_notification_controller.h b/ash/display/resolution_notification_controller.h
index e12e1ba40b54986b429637d3b6edf9c95aec914e..c00150b04edafdd2db2bc759727f78351c928229 100644
--- a/ash/display/resolution_notification_controller.h
+++ b/ash/display/resolution_notification_controller.h
@@ -31,23 +31,34 @@ class ASH_EXPORT ResolutionNotificationController
ResolutionNotificationController();
~ResolutionNotificationController() override;
- // Prepare a resolution change notification for |display_id| from
- // |old_resolution| to |new_resolution|, which offers a button to revert the
- // change in case something goes wrong. The notification times out if there's
- // only one display connected and the user is trying to modify its resolution.
- // In that case, the timeout has to be set since the user cannot make any
- // changes if something goes wrong.
+ // If |display_id| is not the internal display, Prepare a resolution change
+ // notification for |display_id| from |old_resolution| to |new_resolution|,
+ // which offers a button to revert the change in case something goes wrong.
+ // The notification times out if there's only one display connected and the
+ // user is trying to modify its resolution. In that case, the timeout has to
+ // be set since the user cannot make any changes if something goes wrong.
+ //
+ // Then call DisplayManager::SetDisplayMode() to apply the resolution change,
+ // and return the result; true if success, false otherwise.
+ // In case SetDisplayMode() fails, the prepared notification will be
+ // discarded.
+ //
+ // If |display_id| is the internal display, the resolution change is applied
+ // directly without preparing the confirm/revert notification (this kind of
+ // notification is only useful for external displays).
//
// This method does not create a notification itself. The notification will be
// created the next OnDisplayConfigurationChanged(), which will be called
- // asynchronously after the resolution change is requested. So typically this
- // method will be combined with resolution change methods like
- // DisplayManager::SetDisplayMode().
- void PrepareNotification(
+ // asynchronously after the resolution change is requested by this method.
+ //
+ // |accept_callback| will be called when the user accepts the resoltion change
+ // by closing the notification bubble or clicking on the accept button (if
+ // any).
+ bool PrepareNotificationAndSetDisplayMode(
int64_t display_id,
const scoped_refptr<display::ManagedDisplayMode>& old_resolution,
const scoped_refptr<display::ManagedDisplayMode>& new_resolution,
- const base::Closure& accept_callback);
+ const base::Closure& accept_callback) WARN_UNUSED_RESULT;
// Returns true if the notification is visible or scheduled to be visible and
// the notification times out.
« no previous file with comments | « no previous file | ash/display/resolution_notification_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698