| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/display/display_pref_util.h" | 10 #include "ash/display/display_pref_util.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 ash::DisplayManager* display_manager = GetDisplayManager(); | 246 ash::DisplayManager* display_manager = GetDisplayManager(); |
| 247 PrefService* local_state = g_browser_process->local_state(); | 247 PrefService* local_state = g_browser_process->local_state(); |
| 248 | 248 |
| 249 DictionaryPrefUpdate update(local_state, prefs::kDisplayProperties); | 249 DictionaryPrefUpdate update(local_state, prefs::kDisplayProperties); |
| 250 base::DictionaryValue* pref_data = update.Get(); | 250 base::DictionaryValue* pref_data = update.Get(); |
| 251 | 251 |
| 252 size_t num = display_manager->GetNumDisplays(); | 252 size_t num = display_manager->GetNumDisplays(); |
| 253 for (size_t i = 0; i < num; ++i) { | 253 for (size_t i = 0; i < num; ++i) { |
| 254 const display::Display& display = display_manager->GetDisplayAt(i); | 254 const display::Display& display = display_manager->GetDisplayAt(i); |
| 255 int64_t id = display.id(); | 255 int64_t id = display.id(); |
| 256 ash::DisplayInfo info = display_manager->GetDisplayInfo(id); | 256 display::ManagedDisplayInfo info = display_manager->GetDisplayInfo(id); |
| 257 | 257 |
| 258 std::unique_ptr<base::DictionaryValue> property_value( | 258 std::unique_ptr<base::DictionaryValue> property_value( |
| 259 new base::DictionaryValue()); | 259 new base::DictionaryValue()); |
| 260 // Don't save the display preference in unified mode because its | 260 // Don't save the display preference in unified mode because its |
| 261 // size and modes can change depending on the combination of displays. | 261 // size and modes can change depending on the combination of displays. |
| 262 if (display_manager->IsInUnifiedMode()) | 262 if (display_manager->IsInUnifiedMode()) |
| 263 continue; | 263 continue; |
| 264 property_value->SetInteger("rotation", | 264 property_value->SetInteger("rotation", |
| 265 static_cast<int>(info.GetRotation( | 265 static_cast<int>(info.GetRotation( |
| 266 display::Display::ROTATION_SOURCE_USER))); | 266 display::Display::ROTATION_SOURCE_USER))); |
| 267 property_value->SetInteger( | 267 property_value->SetInteger( |
| 268 "ui-scale", static_cast<int>(info.configured_ui_scale() * 1000)); | 268 "ui-scale", static_cast<int>(info.configured_ui_scale() * 1000)); |
| 269 | 269 |
| 270 scoped_refptr<ash::ManagedDisplayMode> mode = | 270 scoped_refptr<display::ManagedDisplayMode> mode = |
| 271 display_manager->GetSelectedModeForDisplayId(id); | 271 display_manager->GetSelectedModeForDisplayId(id); |
| 272 if (!display.IsInternal() && mode && !mode->native()) { | 272 if (!display.IsInternal() && mode && !mode->native()) { |
| 273 property_value->SetInteger("width", mode->size().width()); | 273 property_value->SetInteger("width", mode->size().width()); |
| 274 property_value->SetInteger("height", mode->size().height()); | 274 property_value->SetInteger("height", mode->size().height()); |
| 275 property_value->SetInteger( | 275 property_value->SetInteger( |
| 276 "device-scale-factor", | 276 "device-scale-factor", |
| 277 static_cast<int>(mode->device_scale_factor() * 1000)); | 277 static_cast<int>(mode->device_scale_factor() * 1000)); |
| 278 } | 278 } |
| 279 if (!info.overscan_insets_in_dip().IsEmpty()) | 279 if (!info.overscan_insets_in_dip().IsEmpty()) |
| 280 InsetsToValue(info.overscan_insets_in_dip(), property_value.get()); | 280 InsetsToValue(info.overscan_insets_in_dip(), property_value.get()); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 const display::DisplayLayout& layout) { | 394 const display::DisplayLayout& layout) { |
| 395 StoreDisplayLayoutPref(list, layout); | 395 StoreDisplayLayoutPref(list, layout); |
| 396 } | 396 } |
| 397 | 397 |
| 398 // Stores the given |power_state|. | 398 // Stores the given |power_state|. |
| 399 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { | 399 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { |
| 400 StoreDisplayPowerState(power_state); | 400 StoreDisplayPowerState(power_state); |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace chromeos | 403 } // namespace chromeos |
| OLD | NEW |