OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/display/display_preferences.h" | 5 #include "chrome/browser/chromeos/display/display_preferences.h" |
6 | 6 |
7 #include "ash/display/display_layout_store.h" | 7 #include "ash/display/display_layout_store.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/display/display_pref_util.h" | 9 #include "ash/display/display_pref_util.h" |
10 #include "ash/display/resolution_notification_controller.h" | 10 #include "ash/display/resolution_notification_controller.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 const gfx::Display& display = display_manager->GetDisplayAt(i); | 192 const gfx::Display& display = display_manager->GetDisplayAt(i); |
193 int64 id = display.id(); | 193 int64 id = display.id(); |
194 ash::internal::DisplayInfo info = display_manager->GetDisplayInfo(id); | 194 ash::internal::DisplayInfo info = display_manager->GetDisplayInfo(id); |
195 | 195 |
196 scoped_ptr<base::DictionaryValue> property_value( | 196 scoped_ptr<base::DictionaryValue> property_value( |
197 new base::DictionaryValue()); | 197 new base::DictionaryValue()); |
198 property_value->SetInteger("rotation", static_cast<int>(info.rotation())); | 198 property_value->SetInteger("rotation", static_cast<int>(info.rotation())); |
199 property_value->SetInteger( | 199 property_value->SetInteger( |
200 "ui-scale", | 200 "ui-scale", |
201 static_cast<int>(info.configured_ui_scale() * 1000)); | 201 static_cast<int>(info.configured_ui_scale() * 1000)); |
202 ash::internal::DisplayMode mode; | 202 gfx::Size resolution; |
203 if (!display.IsInternal() && | 203 if (!display.IsInternal() && |
204 display_manager->GetSelectedModeForDisplayId(id, &mode) && | 204 display_manager->GetSelectedResolutionForDisplayId(id, &resolution)) { |
205 !mode.native) { | 205 property_value->SetInteger("width", resolution.width()); |
206 property_value->SetInteger("width", mode.size.width()); | 206 property_value->SetInteger("height", resolution.height()); |
207 property_value->SetInteger("height", mode.size.height()); | |
208 } | 207 } |
209 | 208 |
210 if (!info.overscan_insets_in_dip().empty()) | 209 if (!info.overscan_insets_in_dip().empty()) |
211 InsetsToValue(info.overscan_insets_in_dip(), property_value.get()); | 210 InsetsToValue(info.overscan_insets_in_dip(), property_value.get()); |
212 pref_data->Set(base::Int64ToString(id), property_value.release()); | 211 pref_data->Set(base::Int64ToString(id), property_value.release()); |
213 } | 212 } |
214 } | 213 } |
215 | 214 |
216 typedef std::map<chromeos::DisplayPowerState, std::string> | 215 typedef std::map<chromeos::DisplayPowerState, std::string> |
217 DisplayPowerStateToStringMap; | 216 DisplayPowerStateToStringMap; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 const ash::DisplayLayout& layout) { | 300 const ash::DisplayLayout& layout) { |
302 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); | 301 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); |
303 } | 302 } |
304 | 303 |
305 // Stores the given |power_state|. | 304 // Stores the given |power_state|. |
306 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { | 305 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { |
307 StoreDisplayPowerState(power_state); | 306 StoreDisplayPowerState(power_state); |
308 } | 307 } |
309 | 308 |
310 } // namespace chromeos | 309 } // namespace chromeos |
OLD | NEW |