| 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 c6175250be6380c485d7671d25c612f86863555b..becc4f6e3136f579808ac4aafcf38c2e5137ba27 100644
|
| --- a/chrome/browser/chromeos/display/display_preferences.cc
|
| +++ b/chrome/browser/chromeos/display/display_preferences.cc
|
| @@ -303,6 +303,7 @@ void LoadDisplayRotationState() {
|
|
|
| void StoreDisplayLayoutPref(const display::DisplayIdList& list,
|
| const display::DisplayLayout& display_layout) {
|
| + DCHECK(display::DisplayLayout::Validate(list, display_layout));
|
| std::string name = display::DisplayIdListToString(list);
|
|
|
| PrefService* local_state = g_browser_process->local_state();
|
| @@ -328,6 +329,15 @@ void StoreCurrentDisplayLayoutPrefs() {
|
| display::DisplayIdList list = display_manager->GetCurrentDisplayIdList();
|
| const display::DisplayLayout& display_layout =
|
| display_manager->layout_store()->GetRegisteredDisplayLayout(list);
|
| +
|
| + if (!display::DisplayLayout::Validate(list, display_layout)) {
|
| + // We should never apply an invalid layout, if we do, it persists and the
|
| + // user has no way of fixing it except by deleting the local state.
|
| + LOG(ERROR) << "Attempting to store an invalid display layout in the local"
|
| + << " state. Skipping.";
|
| + return;
|
| + }
|
| +
|
| StoreDisplayLayoutPref(list, display_layout);
|
| }
|
|
|
|
|