Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 new display::ManagedDisplayMode( | 335 new display::ManagedDisplayMode( |
| 336 size, current_mode->refresh_rate(), current_mode->is_interlaced(), | 336 size, current_mode->refresh_rate(), current_mode->is_interlaced(), |
| 337 info.display_mode->is_native, info.display_mode->ui_scale, | 337 info.display_mode->is_native, info.display_mode->ui_scale, |
| 338 info.display_mode->device_scale_factor)); | 338 info.display_mode->device_scale_factor)); |
| 339 | 339 |
| 340 if (new_mode->IsEquivalent(current_mode)) { | 340 if (new_mode->IsEquivalent(current_mode)) { |
| 341 *error = "Display mode matches current mode."; | 341 *error = "Display mode matches current mode."; |
| 342 return false; | 342 return false; |
| 343 } | 343 } |
| 344 | 344 |
| 345 if (!display_manager->SetDisplayMode(id, new_mode)) { | 345 // We must prepare the notification before we set the mode, since setting |
| 346 *error = "Unable to set the display mode."; | 346 // the mode actually shows the notification, so it should be ready by then. |
| 347 return false; | 347 // crbug.com/701389. |
|
stevenjb
2017/04/06 22:10:53
This is all kind of awkward. It looks like we do t
afakhry
2017/04/07 00:04:57
ResolutionNotificationController::OnDisplayConfigu
| |
| 348 } | |
| 349 | |
| 350 if (!display::Display::IsInternalDisplayId(id)) { | 348 if (!display::Display::IsInternalDisplayId(id)) { |
| 351 // For external displays, show a notification confirming the resolution | 349 // For external displays, show a notification confirming the resolution |
| 352 // change. | 350 // change. |
| 353 ash::Shell::GetInstance() | 351 ash::Shell::GetInstance() |
| 354 ->resolution_notification_controller() | 352 ->resolution_notification_controller() |
| 355 ->PrepareNotification(id, current_mode, new_mode, | 353 ->PrepareNotification(id, current_mode, new_mode, |
| 356 base::Bind(&chromeos::StoreDisplayPrefs)); | 354 base::Bind(&chromeos::StoreDisplayPrefs)); |
| 357 } | 355 } |
| 356 | |
| 357 if (!display_manager->SetDisplayMode(id, new_mode)) { | |
| 358 *error = "Unable to set the display mode."; | |
| 359 return false; | |
| 360 } | |
| 358 } | 361 } |
| 359 return true; | 362 return true; |
| 360 } | 363 } |
| 361 | 364 |
| 362 system_display::DisplayMode GetDisplayMode( | 365 system_display::DisplayMode GetDisplayMode( |
| 363 display::DisplayManager* display_manager, | 366 display::DisplayManager* display_manager, |
| 364 const display::ManagedDisplayInfo& display_info, | 367 const display::ManagedDisplayInfo& display_info, |
| 365 const scoped_refptr<display::ManagedDisplayMode>& display_mode) { | 368 const scoped_refptr<display::ManagedDisplayMode>& display_mode) { |
| 366 system_display::DisplayMode result; | 369 system_display::DisplayMode result; |
| 367 | 370 |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 896 touch_calibrator_.reset(new chromeos::TouchCalibratorController); | 899 touch_calibrator_.reset(new chromeos::TouchCalibratorController); |
| 897 return touch_calibrator_.get(); | 900 return touch_calibrator_.get(); |
| 898 } | 901 } |
| 899 | 902 |
| 900 // static | 903 // static |
| 901 DisplayInfoProvider* DisplayInfoProvider::Create() { | 904 DisplayInfoProvider* DisplayInfoProvider::Create() { |
| 902 return new DisplayInfoProviderChromeOS(); | 905 return new DisplayInfoProviderChromeOS(); |
| 903 } | 906 } |
| 904 | 907 |
| 905 } // namespace extensions | 908 } // namespace extensions |
| OLD | NEW |