| 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 8861b50a14b5e416042e6309bdaa89e2b5e16811..df8f64903c66d64e49f63ee71e8bfc7fb6063325 100644
|
| --- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
|
| @@ -9,6 +9,7 @@
|
| #include "ash/display/display_controller.h"
|
| #include "ash/display/display_manager.h"
|
| #include "ash/display/output_configurator_animation.h"
|
| +#include "ash/display/resolution_notification_controller.h"
|
| #include "ash/screen_ash.h"
|
| #include "ash/shell.h"
|
| #include "base/bind.h"
|
| @@ -343,9 +344,34 @@ void DisplayOptionsHandler::HandleSetResolution(const base::ListValue* args) {
|
| return;
|
| }
|
|
|
| - // TODO(mukai): creates a confirmation dialog.
|
| - GetDisplayManager()->SetDisplayResolution(
|
| - display_id, gfx::ToFlooredSize(gfx::SizeF(width, height)));
|
| + const ash::internal::DisplayInfo& display_info =
|
| + GetDisplayManager()->GetDisplayInfo(display_id);
|
| + gfx::Size new_resolution = gfx::ToFlooredSize(gfx::SizeF(width, height));
|
| + gfx::Size old_resolution = display_info.size_in_pixel();
|
| + bool has_new_resolution = false;
|
| + bool has_old_resolution = false;
|
| + for (size_t i = 0; i < display_info.resolutions().size(); ++i) {
|
| + ash::internal::Resolution resolution = display_info.resolutions()[i];
|
| + if (resolution.size == new_resolution)
|
| + has_new_resolution = true;
|
| + if (resolution.size == old_resolution)
|
| + has_old_resolution = true;
|
| + }
|
| + if (!has_new_resolution) {
|
| + LOG(ERROR) << "No new resolution " << new_resolution.ToString()
|
| + << " is found in the display info " << display_info.ToString();
|
| + return;
|
| + }
|
| + if (!has_old_resolution) {
|
| + LOG(ERROR) << "No old resolution " << old_resolution.ToString()
|
| + << " is found in the display info " << display_info.ToString();
|
| + return;
|
| + }
|
| +
|
| + ash::Shell::GetInstance()->resolution_notification_controller()->
|
| + SetDisplayResolutionAndNotify(
|
| + display_id, old_resolution, new_resolution,
|
| + base::Bind(&StoreDisplayPrefs));
|
| }
|
|
|
| void DisplayOptionsHandler::HandleSetOrientation(const base::ListValue* args) {
|
|
|