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