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

Side by Side Diff: components/sync/protocol/sync_protocol_error.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
« no previous file with comments | « components/sync/protocol/sync_protocol_error.h ('k') | components/sync/syncable/base_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/protocol/sync_protocol_error.h" 5 #include "components/sync/protocol/sync_protocol_error.h"
6 6
7 #include <utility>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h"
8 11
9 namespace syncer { 12 namespace syncer {
10 #define ENUM_CASE(x) \ 13 #define ENUM_CASE(x) \
11 case x: \ 14 case x: \
12 return #x; \ 15 return #x; \
13 break; 16 break;
14 17
15 const char* GetSyncErrorTypeString(SyncProtocolErrorType type) { 18 const char* GetSyncErrorTypeString(SyncProtocolErrorType type) {
16 switch (type) { 19 switch (type) {
17 ENUM_CASE(SYNC_SUCCESS); 20 ENUM_CASE(SYNC_SUCCESS);
(...skipping 27 matching lines...) Expand all
45 return ""; 48 return "";
46 } 49 }
47 50
48 SyncProtocolError::SyncProtocolError() 51 SyncProtocolError::SyncProtocolError()
49 : error_type(UNKNOWN_ERROR), action(UNKNOWN_ACTION) {} 52 : error_type(UNKNOWN_ERROR), action(UNKNOWN_ACTION) {}
50 53
51 SyncProtocolError::SyncProtocolError(const SyncProtocolError& other) = default; 54 SyncProtocolError::SyncProtocolError(const SyncProtocolError& other) = default;
52 55
53 SyncProtocolError::~SyncProtocolError() {} 56 SyncProtocolError::~SyncProtocolError() {}
54 57
55 base::DictionaryValue* SyncProtocolError::ToValue() const { 58 std::unique_ptr<base::DictionaryValue> SyncProtocolError::ToValue() const {
56 base::DictionaryValue* value = new base::DictionaryValue(); 59 auto value = base::MakeUnique<base::DictionaryValue>();
57 value->SetString("ErrorType", GetSyncErrorTypeString(error_type)); 60 value->SetString("ErrorType", GetSyncErrorTypeString(error_type));
58 value->SetString("ErrorDescription", error_description); 61 value->SetString("ErrorDescription", error_description);
59 value->SetString("url", url); 62 value->SetString("url", url);
60 value->SetString("action", GetClientActionString(action)); 63 value->SetString("action", GetClientActionString(action));
61 return value; 64 return value;
62 } 65 }
63 66
64 } // namespace syncer 67 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/protocol/sync_protocol_error.h ('k') | components/sync/syncable/base_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698