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

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

Issue 2799963003: Fix errors in display resolution change notifications (Closed)
Patch Set: Fix compile errors on non-cros systems 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/common/wm/maximize_mode/maximize_mode_controller.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
10 #include "ash/display/display_configuration_controller.h" 10 #include "ash/display/display_configuration_controller.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 new display::ManagedDisplayMode( 333 new display::ManagedDisplayMode(
334 size, current_mode->refresh_rate(), current_mode->is_interlaced(), 334 size, current_mode->refresh_rate(), current_mode->is_interlaced(),
335 info.display_mode->is_native, info.display_mode->ui_scale, 335 info.display_mode->is_native, info.display_mode->ui_scale,
336 info.display_mode->device_scale_factor)); 336 info.display_mode->device_scale_factor));
337 337
338 if (new_mode->IsEquivalent(current_mode)) { 338 if (new_mode->IsEquivalent(current_mode)) {
339 *error = "Display mode matches current mode."; 339 *error = "Display mode matches current mode.";
340 return false; 340 return false;
341 } 341 }
342 342
343 if (!display_manager->SetDisplayMode(id, new_mode)) { 343 // If it's the internal display, the display mode will be applied directly,
344 // otherwise a confirm/revert notification will be prepared first, and the
345 // display mode will be applied. If the user accepts the mode change by
346 // dismissing the notification, StoreDisplayPrefs() will be called back to
347 // persist the new preferences.
348 if (!ash::Shell::Get()
349 ->resolution_notification_controller()
350 ->PrepareNotificationAndSetDisplayMode(
351 id, current_mode, new_mode,
352 base::Bind(&chromeos::StoreDisplayPrefs))) {
344 *error = "Unable to set the display mode."; 353 *error = "Unable to set the display mode.";
345 return false; 354 return false;
346 } 355 }
347
348 if (!display::Display::IsInternalDisplayId(id)) {
349 // For external displays, show a notification confirming the resolution
350 // change.
351 ash::Shell::Get()
352 ->resolution_notification_controller()
353 ->PrepareNotification(id, current_mode, new_mode,
354 base::Bind(&chromeos::StoreDisplayPrefs));
355 }
356 } 356 }
357 return true; 357 return true;
358 } 358 }
359 359
360 system_display::DisplayMode GetDisplayMode( 360 system_display::DisplayMode GetDisplayMode(
361 display::DisplayManager* display_manager, 361 display::DisplayManager* display_manager,
362 const display::ManagedDisplayInfo& display_info, 362 const display::ManagedDisplayInfo& display_info,
363 const scoped_refptr<display::ManagedDisplayMode>& display_mode) { 363 const scoped_refptr<display::ManagedDisplayMode>& display_mode) {
364 system_display::DisplayMode result; 364 system_display::DisplayMode result;
365 365
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 touch_calibrator_.reset(new chromeos::TouchCalibratorController); 888 touch_calibrator_.reset(new chromeos::TouchCalibratorController);
889 return touch_calibrator_.get(); 889 return touch_calibrator_.get();
890 } 890 }
891 891
892 // static 892 // static
893 DisplayInfoProvider* DisplayInfoProvider::Create() { 893 DisplayInfoProvider* DisplayInfoProvider::Create() {
894 return new DisplayInfoProviderChromeOS(); 894 return new DisplayInfoProviderChromeOS();
895 } 895 }
896 896
897 } // namespace extensions 897 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698