Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: ash/display/json_converter.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string> 8 #include <string>
8 9
9 #include "ash/display/display_pref_util.h" 10 #include "ash/display/display_pref_util.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "ui/display/manager/display_layout.h" 14 #include "ui/display/manager/display_layout.h"
14 15
15 namespace ash { 16 namespace ash {
16 17
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 bool DisplayLayoutToJson(const display::DisplayLayout& layout, 172 bool DisplayLayoutToJson(const display::DisplayLayout& layout,
172 base::Value* value) { 173 base::Value* value) {
173 base::DictionaryValue* dict_value = nullptr; 174 base::DictionaryValue* dict_value = nullptr;
174 if (!value->GetAsDictionary(&dict_value)) 175 if (!value->GetAsDictionary(&dict_value))
175 return false; 176 return false;
176 177
177 dict_value->SetBoolean(kMirroredKey, layout.mirrored); 178 dict_value->SetBoolean(kMirroredKey, layout.mirrored);
178 dict_value->SetBoolean(kDefaultUnifiedKey, layout.default_unified); 179 dict_value->SetBoolean(kDefaultUnifiedKey, layout.default_unified);
179 dict_value->SetString(kPrimaryIdKey, base::Int64ToString(layout.primary_id)); 180 dict_value->SetString(kPrimaryIdKey, base::Int64ToString(layout.primary_id));
180 181
181 scoped_ptr<base::ListValue> placement_list(new base::ListValue); 182 std::unique_ptr<base::ListValue> placement_list(new base::ListValue);
182 for (const auto& placement : layout.placement_list) { 183 for (const auto& placement : layout.placement_list) {
183 scoped_ptr<base::DictionaryValue> placement_value( 184 std::unique_ptr<base::DictionaryValue> placement_value(
184 new base::DictionaryValue); 185 new base::DictionaryValue);
185 placement_value->SetString( 186 placement_value->SetString(
186 kPositionKey, 187 kPositionKey,
187 display::DisplayPlacement::PositionToString(placement.position)); 188 display::DisplayPlacement::PositionToString(placement.position));
188 placement_value->SetInteger(kOffsetKey, placement.offset); 189 placement_value->SetInteger(kOffsetKey, placement.offset);
189 placement_value->SetString(kDisplayPlacementDisplayIdKey, 190 placement_value->SetString(kDisplayPlacementDisplayIdKey,
190 base::Int64ToString(placement.display_id)); 191 base::Int64ToString(placement.display_id));
191 placement_value->SetString( 192 placement_value->SetString(
192 kDisplayPlacementParentDisplayIdKey, 193 kDisplayPlacementParentDisplayIdKey,
193 base::Int64ToString(placement.parent_display_id)); 194 base::Int64ToString(placement.parent_display_id));
194 placement_list->Append(std::move(placement_value)); 195 placement_list->Append(std::move(placement_value));
195 } 196 }
196 dict_value->Set(kDisplayPlacementKey, std::move(placement_list)); 197 dict_value->Set(kDisplayPlacementKey, std::move(placement_list));
197 return true; 198 return true;
198 } 199 }
199 200
200 } // namespace ash 201 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/extended_mouse_warp_controller_unittest.cc ('k') | ash/display/json_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698