| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ash/display/display_layout.h" | 5 #include "ash/display/display_layout.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_pref_util.h" | 10 #include "ash/display/display_pref_util.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 converter->RegisterCustomField<int64_t>( | 221 converter->RegisterCustomField<int64_t>( |
| 222 kPrimaryIdKey, &DisplayLayout::primary_id, &GetDisplayIdFromString); | 222 kPrimaryIdKey, &DisplayLayout::primary_id, &GetDisplayIdFromString); |
| 223 converter->RegisterRepeatedMessage<DisplayPlacement>( | 223 converter->RegisterRepeatedMessage<DisplayPlacement>( |
| 224 kDisplayPlacementKey, &DisplayLayout::placement_list); | 224 kDisplayPlacementKey, &DisplayLayout::placement_list); |
| 225 } | 225 } |
| 226 | 226 |
| 227 // static | 227 // static |
| 228 bool DisplayLayout::Validate(const DisplayIdList& list, | 228 bool DisplayLayout::Validate(const DisplayIdList& list, |
| 229 const DisplayLayout& layout) { | 229 const DisplayLayout& layout) { |
| 230 // The primary display should be in the list. | 230 // The primary display should be in the list. |
| 231 DCHECK(IsIdInList(layout.primary_id, list)); | 231 if (!IsIdInList(layout.primary_id, list)) |
| 232 return false; |
| 232 | 233 |
| 233 // Unified mode, or mirror mode switched from unified mode, | 234 // Unified mode, or mirror mode switched from unified mode, |
| 234 // may not have the placement yet. | 235 // may not have the placement yet. |
| 235 if (layout.placement_list.size() == 0u) | 236 if (layout.placement_list.size() == 0u) |
| 236 return true; | 237 return true; |
| 237 | 238 |
| 238 bool has_primary_as_parent = false; | 239 bool has_primary_as_parent = false; |
| 239 int64_t id = 0; | 240 int64_t id = 0; |
| 240 | 241 |
| 241 for (const auto* placement : layout.placement_list) { | 242 for (const auto* placement : layout.placement_list) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 s << (added ? "),(" : " [("); | 313 s << (added ? "),(" : " [("); |
| 313 s << placement->ToString(); | 314 s << placement->ToString(); |
| 314 added = true; | 315 added = true; |
| 315 } | 316 } |
| 316 if (added) | 317 if (added) |
| 317 s << ")]"; | 318 s << ")]"; |
| 318 return s.str(); | 319 return s.str(); |
| 319 } | 320 } |
| 320 | 321 |
| 321 } // namespace ash | 322 } // namespace ash |
| OLD | NEW |