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

Side by Side Diff: chrome/browser/chromeos/display/display_preferences.cc

Issue 2196923002: Make ash::DisplayMode more like ui::DisplayMode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 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 unified diff | Download patch
OLDNEW
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_layout_store.h" 9 #include "ash/display/display_layout_store.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // Don't save the display preference in unified mode because its 259 // Don't save the display preference in unified mode because its
260 // size and modes can change depending on the combination of displays. 260 // size and modes can change depending on the combination of displays.
261 if (display_manager->IsInUnifiedMode()) 261 if (display_manager->IsInUnifiedMode())
262 continue; 262 continue;
263 property_value->SetInteger("rotation", 263 property_value->SetInteger("rotation",
264 static_cast<int>(info.GetRotation( 264 static_cast<int>(info.GetRotation(
265 display::Display::ROTATION_SOURCE_USER))); 265 display::Display::ROTATION_SOURCE_USER)));
266 property_value->SetInteger( 266 property_value->SetInteger(
267 "ui-scale", static_cast<int>(info.configured_ui_scale() * 1000)); 267 "ui-scale", static_cast<int>(info.configured_ui_scale() * 1000));
268 268
269 ash::DisplayMode mode; 269 scoped_refptr<ash::DisplayMode> mode =
270 if (!display.IsInternal() && 270 display_manager->GetSelectedModeForDisplayId(id);
271 display_manager->GetSelectedModeForDisplayId(id, &mode) && 271 if (!display.IsInternal() && mode && !mode->native()) {
272 !mode.native) { 272 property_value->SetInteger("width", mode->size().width());
273 property_value->SetInteger("width", mode.size.width()); 273 property_value->SetInteger("height", mode->size().height());
274 property_value->SetInteger("height", mode.size.height());
275 property_value->SetInteger( 274 property_value->SetInteger(
276 "device-scale-factor", 275 "device-scale-factor",
277 static_cast<int>(mode.device_scale_factor * 1000)); 276 static_cast<int>(mode->device_scale_factor() * 1000));
278 } 277 }
279 if (!info.overscan_insets_in_dip().IsEmpty()) 278 if (!info.overscan_insets_in_dip().IsEmpty())
280 InsetsToValue(info.overscan_insets_in_dip(), property_value.get()); 279 InsetsToValue(info.overscan_insets_in_dip(), property_value.get());
281 if (info.color_profile() != ui::COLOR_PROFILE_STANDARD) { 280 if (info.color_profile() != ui::COLOR_PROFILE_STANDARD) {
282 property_value->SetString( 281 property_value->SetString(
283 "color_profile_name", ColorProfileToString(info.color_profile())); 282 "color_profile_name", ColorProfileToString(info.color_profile()));
284 } 283 }
285 pref_data->Set(base::Int64ToString(id), property_value.release()); 284 pref_data->Set(base::Int64ToString(id), property_value.release());
286 } 285 }
287 } 286 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 const display::DisplayLayout& layout) { 393 const display::DisplayLayout& layout) {
395 StoreDisplayLayoutPref(list, layout); 394 StoreDisplayLayoutPref(list, layout);
396 } 395 }
397 396
398 // Stores the given |power_state|. 397 // Stores the given |power_state|.
399 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { 398 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) {
400 StoreDisplayPowerState(power_state); 399 StoreDisplayPowerState(power_state);
401 } 400 }
402 401
403 } // namespace chromeos 402 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698