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

Unified Diff: chrome/browser/chromeos/display/display_preferences.cc

Issue 21297003: Add ability to set resolution on external display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adraddressed comment, adjusted test Created 7 years, 5 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
Index: chrome/browser/chromeos/display/display_preferences.cc
diff --git a/chrome/browser/chromeos/display/display_preferences.cc b/chrome/browser/chromeos/display/display_preferences.cc
index a6a6b89f88cdfab9ab91270f505f1db68db2a502..168404ce39e35ed7d02732aa6c94771428f4f2c2 100644
--- a/chrome/browser/chromeos/display/display_preferences.cc
+++ b/chrome/browser/chromeos/display/display_preferences.cc
@@ -135,13 +135,20 @@ void LoadDisplayProperties() {
int ui_scale_value = 0;
if (dict_value->GetInteger("ui-scale", &ui_scale_value))
ui_scale = static_cast<float>(ui_scale_value) / 1000.0f;
+
+ int width = 0, height = 0;
+ dict_value->GetInteger("width", &width);
+ dict_value->GetInteger("height", &height);
+ gfx::Size resolution_in_pixels(width, height);
+
gfx::Insets insets;
if (ValueToInsets(*dict_value, &insets))
insets_to_set = &insets;
GetDisplayManager()->RegisterDisplayProperty(id,
rotation,
ui_scale,
- insets_to_set);
+ insets_to_set,
+ resolution_in_pixels);
}
}
@@ -182,7 +189,8 @@ void StoreCurrentDisplayProperties() {
size_t num = display_manager->GetNumDisplays();
for (size_t i = 0; i < num; ++i) {
- int64 id = display_manager->GetDisplayAt(i).id();
+ const gfx::Display& display = display_manager->GetDisplayAt(i);
+ int64 id = display.id();
ash::internal::DisplayInfo info = display_manager->GetDisplayInfo(id);
scoped_ptr<base::DictionaryValue> property_value(
@@ -190,6 +198,13 @@ void StoreCurrentDisplayProperties() {
property_value->SetInteger("rotation", static_cast<int>(info.rotation()));
property_value->SetInteger("ui-scale",
static_cast<int>(info.ui_scale() * 1000));
+ gfx::Size resolution;
+ if (!display.IsInternal() &&
+ display_manager->GetSelectedResolutionForDisplayId(id, &resolution)) {
+ property_value->SetInteger("width", resolution.width());
+ property_value->SetInteger("height", resolution.height());
+ }
+
if (!info.overscan_insets_in_dip().empty())
InsetsToValue(info.overscan_insets_in_dip(), property_value.get());
pref_data->Set(base::Int64ToString(id), property_value.release());
« no previous file with comments | « ash/display/display_util_x11_unittest.cc ('k') | chrome/browser/chromeos/display/display_preferences_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698