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

Side by Side Diff: components/sync/syncable/syncable_id.cc

Issue 2889163002: Remove raw DictionaryValue::Set in //components (Closed)
Patch Set: Nits Created 3 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/sync/syncable/syncable_id.h" 5 #include "components/sync/syncable/syncable_id.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/values.h" 9 #include "base/values.h"
9 10
10 using std::ostream; 11 using std::ostream;
11 using std::string; 12 using std::string;
12 13
13 namespace syncer { 14 namespace syncer {
14 namespace syncable { 15 namespace syncable {
15 16
16 ostream& operator<<(ostream& out, const Id& id) { 17 ostream& operator<<(ostream& out, const Id& id) {
17 out << id.s_; 18 out << id.s_;
18 return out; 19 return out;
19 } 20 }
20 21
21 base::Value* Id::ToValue() const { 22 std::unique_ptr<base::Value> Id::ToValue() const {
22 return new base::Value(s_); 23 return base::MakeUnique<base::Value>(s_);
23 } 24 }
24 25
25 string Id::GetServerId() const { 26 string Id::GetServerId() const {
26 // Currently root is the string "0". We need to decide on a true value. 27 // Currently root is the string "0". We need to decide on a true value.
27 // "" would be convenient here, as the IsRoot call would not be needed. 28 // "" would be convenient here, as the IsRoot call would not be needed.
28 DCHECK(!IsNull()); 29 DCHECK(!IsNull());
29 if (IsRoot()) 30 if (IsRoot())
30 return "0"; 31 return "0";
31 return s_.substr(1); 32 return s_.substr(1);
32 } 33 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 70
70 // static 71 // static
71 Id Id::GetLeastIdForLexicographicComparison() { 72 Id Id::GetLeastIdForLexicographicComparison() {
72 Id id; 73 Id id;
73 id.s_.clear(); 74 id.s_.clear();
74 return id; 75 return id;
75 } 76 }
76 77
77 } // namespace syncable 78 } // namespace syncable
78 } // namespace syncer 79 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/syncable/syncable_id.h ('k') | components/sync/syncable/syncable_id_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698