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

Side by Side Diff: chrome/browser/extensions/display_info_provider_chromeos.cc

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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/extensions/display_info_provider_chromeos.h" 5 #include "chrome/browser/extensions/display_info_provider_chromeos.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "ash/display/display_configuration_controller.h" 9 #include "ash/display/display_configuration_controller.h"
10 #include "ash/display/resolution_notification_controller.h" 10 #include "ash/display/resolution_notification_controller.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 new display::ManagedDisplayMode( 345 new display::ManagedDisplayMode(
346 size, current_mode->refresh_rate(), current_mode->is_interlaced(), 346 size, current_mode->refresh_rate(), current_mode->is_interlaced(),
347 info.display_mode->is_native, info.display_mode->ui_scale, 347 info.display_mode->is_native, info.display_mode->ui_scale,
348 info.display_mode->device_scale_factor)); 348 info.display_mode->device_scale_factor));
349 349
350 if (new_mode->IsEquivalent(current_mode)) { 350 if (new_mode->IsEquivalent(current_mode)) {
351 *error = "Display mode matches current mode."; 351 *error = "Display mode matches current mode.";
352 return false; 352 return false;
353 } 353 }
354 354
355 if (!display_manager->SetDisplayMode(id, new_mode)) { 355 // If it's the internal display, the display mode will be applied directly,
356 // otherwise a confirm/revert notification will be prepared first, and the
357 // display mode will be applied. If the user accepts the mode change by
358 // dismissing the notification, StoreDisplayPrefs() will be called back to
359 // persist the new preferences.
360 if (!ash::Shell::Get()
361 ->resolution_notification_controller()
362 ->PrepareNotificationAndSetDisplayMode(
363 id, current_mode, new_mode,
364 base::Bind(&chromeos::StoreDisplayPrefs))) {
356 *error = "Unable to set the display mode."; 365 *error = "Unable to set the display mode.";
357 return false; 366 return false;
358 } 367 }
359
360 if (!display::Display::IsInternalDisplayId(id)) {
361 // For external displays, show a notification confirming the resolution
362 // change.
363 ash::Shell::Get()
364 ->resolution_notification_controller()
365 ->PrepareNotification(id, current_mode, new_mode,
366 base::Bind(&chromeos::StoreDisplayPrefs));
367 }
368 } 368 }
369 return true; 369 return true;
370 } 370 }
371 371
372 system_display::DisplayMode GetDisplayMode( 372 system_display::DisplayMode GetDisplayMode(
373 display::DisplayManager* display_manager, 373 display::DisplayManager* display_manager,
374 const display::ManagedDisplayInfo& display_info, 374 const display::ManagedDisplayInfo& display_info,
375 const scoped_refptr<display::ManagedDisplayMode>& display_mode) { 375 const scoped_refptr<display::ManagedDisplayMode>& display_mode) {
376 system_display::DisplayMode result; 376 system_display::DisplayMode result;
377 377
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 touch_calibrator_.reset(new chromeos::TouchCalibratorController); 919 touch_calibrator_.reset(new chromeos::TouchCalibratorController);
920 return touch_calibrator_.get(); 920 return touch_calibrator_.get();
921 } 921 }
922 922
923 // static 923 // static
924 DisplayInfoProvider* DisplayInfoProvider::Create() { 924 DisplayInfoProvider* DisplayInfoProvider::Create() {
925 return new DisplayInfoProviderChromeOS(); 925 return new DisplayInfoProviderChromeOS();
926 } 926 }
927 927
928 } // namespace extensions 928 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698