| 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/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 void StoreCurrentDisplayLayoutPrefs() { | 321 void StoreCurrentDisplayLayoutPrefs() { |
| 322 display::DisplayManager* display_manager = GetDisplayManager(); | 322 display::DisplayManager* display_manager = GetDisplayManager(); |
| 323 if (!UserCanSaveDisplayPreference() || | 323 if (!UserCanSaveDisplayPreference() || |
| 324 display_manager->num_connected_displays() < 2) { | 324 display_manager->num_connected_displays() < 2) { |
| 325 return; | 325 return; |
| 326 } | 326 } |
| 327 | 327 |
| 328 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList(); | 328 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList(); |
| 329 const display::DisplayLayout& display_layout = | 329 const display::DisplayLayout& display_layout = |
| 330 display_manager->layout_store()->GetRegisteredDisplayLayout(list); | 330 display_manager->layout_store()->GetRegisteredDisplayLayout(list); |
| 331 |
| 332 if (!display::DisplayLayout::Validate(list, display_layout)) { |
| 333 // We should never apply an invalid layout, if we do, it persists and the |
| 334 // user has no way of fixing it except by deleting the local state. |
| 335 LOG(ERROR) << "Attempting to store an invalid display layout in the local" |
| 336 << " state. Skipping."; |
| 337 return; |
| 338 } |
| 339 |
| 331 StoreDisplayLayoutPref(list, display_layout); | 340 StoreDisplayLayoutPref(list, display_layout); |
| 332 } | 341 } |
| 333 | 342 |
| 334 void StoreCurrentDisplayProperties() { | 343 void StoreCurrentDisplayProperties() { |
| 335 display::DisplayManager* display_manager = GetDisplayManager(); | 344 display::DisplayManager* display_manager = GetDisplayManager(); |
| 336 PrefService* local_state = g_browser_process->local_state(); | 345 PrefService* local_state = g_browser_process->local_state(); |
| 337 | 346 |
| 338 DictionaryPrefUpdate update(local_state, prefs::kDisplayProperties); | 347 DictionaryPrefUpdate update(local_state, prefs::kDisplayProperties); |
| 339 base::DictionaryValue* pref_data = update.Get(); | 348 base::DictionaryValue* pref_data = update.Get(); |
| 340 | 349 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 StoreDisplayPowerState(power_state); | 500 StoreDisplayPowerState(power_state); |
| 492 } | 501 } |
| 493 | 502 |
| 494 bool ParseTouchCalibrationStringForTest( | 503 bool ParseTouchCalibrationStringForTest( |
| 495 const std::string& str, | 504 const std::string& str, |
| 496 display::TouchCalibrationData::CalibrationPointPairQuad* point_pair_quad) { | 505 display::TouchCalibrationData::CalibrationPointPairQuad* point_pair_quad) { |
| 497 return ParseTouchCalibrationStringValue(str, point_pair_quad); | 506 return ParseTouchCalibrationStringValue(str, point_pair_quad); |
| 498 } | 507 } |
| 499 | 508 |
| 500 } // namespace chromeos | 509 } // namespace chromeos |
| OLD | NEW |