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

Unified Diff: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc

Issue 22703004: Creates notifications for display resolution change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix on display_preferences_unittest Created 7 years, 4 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 | « chrome/browser/chromeos/display/display_preferences_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8714639ed058db0e3835ef992cb008ebbac1e389..d02c3b3b31032cdb174297b7aa27f98d68620f25 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"
@@ -344,9 +345,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) {
« no previous file with comments | « chrome/browser/chromeos/display/display_preferences_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698