OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/json_converter.h" | 5 #include "ash/display/json_converter.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/display/display_pref_util.h" | 10 #include "ash/display/display_pref_util.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 const base::ListValue* list = nullptr; | 119 const base::ListValue* list = nullptr; |
120 if (!UpdateFromDict(dict_value, field_name, getter, &list)) | 120 if (!UpdateFromDict(dict_value, field_name, getter, &list)) |
121 return false; | 121 return false; |
122 | 122 |
123 if (list == nullptr) | 123 if (list == nullptr) |
124 return true; | 124 return true; |
125 | 125 |
126 output->reserve(list->GetSize()); | 126 output->reserve(list->GetSize()); |
127 for (const auto& list_item : *list) { | 127 for (const auto& list_item : *list) { |
128 const base::DictionaryValue* item_values = nullptr; | 128 const base::DictionaryValue* item_values = nullptr; |
129 if (!list_item->GetAsDictionary(&item_values)) | 129 if (!list_item.GetAsDictionary(&item_values)) |
130 return false; | 130 return false; |
131 | 131 |
132 display::DisplayPlacement item; | 132 display::DisplayPlacement item; |
133 if (!UpdateFromDict(item_values, kOffsetKey, &item.offset) || | 133 if (!UpdateFromDict(item_values, kOffsetKey, &item.offset) || |
134 !UpdateFromDict(item_values, kPositionKey, &item.position) || | 134 !UpdateFromDict(item_values, kPositionKey, &item.position) || |
135 !UpdateFromDict(item_values, kDisplayPlacementDisplayIdKey, | 135 !UpdateFromDict(item_values, kDisplayPlacementDisplayIdKey, |
136 &item.display_id) || | 136 &item.display_id) || |
137 !UpdateFromDict(item_values, kDisplayPlacementParentDisplayIdKey, | 137 !UpdateFromDict(item_values, kDisplayPlacementParentDisplayIdKey, |
138 &item.parent_display_id)) { | 138 &item.parent_display_id)) { |
139 return false; | 139 return false; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 placement_value->SetString( | 192 placement_value->SetString( |
193 kDisplayPlacementParentDisplayIdKey, | 193 kDisplayPlacementParentDisplayIdKey, |
194 base::Int64ToString(placement.parent_display_id)); | 194 base::Int64ToString(placement.parent_display_id)); |
195 placement_list->Append(std::move(placement_value)); | 195 placement_list->Append(std::move(placement_value)); |
196 } | 196 } |
197 dict_value->Set(kDisplayPlacementKey, std::move(placement_list)); | 197 dict_value->Set(kDisplayPlacementKey, std::move(placement_list)); |
198 return true; | 198 return true; |
199 } | 199 } |
200 | 200 |
201 } // namespace ash | 201 } // namespace ash |
OLD | NEW |