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

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: 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 <string> 7 #include <string>
oshima 2016/04/08 07:09:40 include?
8 8
9 #include "ash/display/display_pref_util.h" 9 #include "ash/display/display_pref_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "ui/display/manager/display_layout.h" 13 #include "ui/display/manager/display_layout.h"
14 14
15 namespace ash { 15 namespace ash {
16 16
17 namespace { 17 namespace {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 bool DisplayLayoutToJson(const display::DisplayLayout& layout, 171 bool DisplayLayoutToJson(const display::DisplayLayout& layout,
172 base::Value* value) { 172 base::Value* value) {
173 base::DictionaryValue* dict_value = nullptr; 173 base::DictionaryValue* dict_value = nullptr;
174 if (!value->GetAsDictionary(&dict_value)) 174 if (!value->GetAsDictionary(&dict_value))
175 return false; 175 return false;
176 176
177 dict_value->SetBoolean(kMirroredKey, layout.mirrored); 177 dict_value->SetBoolean(kMirroredKey, layout.mirrored);
178 dict_value->SetBoolean(kDefaultUnifiedKey, layout.default_unified); 178 dict_value->SetBoolean(kDefaultUnifiedKey, layout.default_unified);
179 dict_value->SetString(kPrimaryIdKey, base::Int64ToString(layout.primary_id)); 179 dict_value->SetString(kPrimaryIdKey, base::Int64ToString(layout.primary_id));
180 180
181 scoped_ptr<base::ListValue> placement_list(new base::ListValue); 181 std::unique_ptr<base::ListValue> placement_list(new base::ListValue);
182 for (const auto& placement : layout.placement_list) { 182 for (const auto& placement : layout.placement_list) {
183 scoped_ptr<base::DictionaryValue> placement_value( 183 std::unique_ptr<base::DictionaryValue> placement_value(
184 new base::DictionaryValue); 184 new base::DictionaryValue);
185 placement_value->SetString( 185 placement_value->SetString(
186 kPositionKey, 186 kPositionKey,
187 display::DisplayPlacement::PositionToString(placement.position)); 187 display::DisplayPlacement::PositionToString(placement.position));
188 placement_value->SetInteger(kOffsetKey, placement.offset); 188 placement_value->SetInteger(kOffsetKey, placement.offset);
189 placement_value->SetString(kDisplayPlacementDisplayIdKey, 189 placement_value->SetString(kDisplayPlacementDisplayIdKey,
190 base::Int64ToString(placement.display_id)); 190 base::Int64ToString(placement.display_id));
191 placement_value->SetString( 191 placement_value->SetString(
192 kDisplayPlacementParentDisplayIdKey, 192 kDisplayPlacementParentDisplayIdKey,
193 base::Int64ToString(placement.parent_display_id)); 193 base::Int64ToString(placement.parent_display_id));
194 placement_list->Append(std::move(placement_value)); 194 placement_list->Append(std::move(placement_value));
195 } 195 }
196 dict_value->Set(kDisplayPlacementKey, std::move(placement_list)); 196 dict_value->Set(kDisplayPlacementKey, std::move(placement_list));
197 return true; 197 return true;
198 } 198 }
199 199
200 } // namespace ash 200 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698