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

Side by Side Diff: sync/internal_api/public/engine/model_safe_worker.cc

Issue 10795018: [Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fiix indent Created 8 years, 5 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 | Annotate | Revision Log
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 "sync/internal_api/public/engine/model_safe_worker.h" 5 #include "sync/internal_api/public/engine/model_safe_worker.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
11 namespace syncer { 11 namespace syncer {
12 12
13 base::DictionaryValue* ModelSafeRoutingInfoToValue( 13 base::DictionaryValue* ModelSafeRoutingInfoToValue(
14 const ModelSafeRoutingInfo& routing_info) { 14 const ModelSafeRoutingInfo& routing_info) {
15 base::DictionaryValue* dict = new base::DictionaryValue(); 15 base::DictionaryValue* dict = new base::DictionaryValue();
16 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); 16 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin();
17 it != routing_info.end(); ++it) { 17 it != routing_info.end(); ++it) {
18 dict->SetString(syncer::ModelTypeToString(it->first), 18 dict->SetString(ModelTypeToString(it->first),
19 ModelSafeGroupToString(it->second)); 19 ModelSafeGroupToString(it->second));
20 } 20 }
21 return dict; 21 return dict;
22 } 22 }
23 23
24 std::string ModelSafeRoutingInfoToString( 24 std::string ModelSafeRoutingInfoToString(
25 const ModelSafeRoutingInfo& routing_info) { 25 const ModelSafeRoutingInfo& routing_info) {
26 scoped_ptr<DictionaryValue> dict(ModelSafeRoutingInfoToValue(routing_info)); 26 scoped_ptr<DictionaryValue> dict(ModelSafeRoutingInfoToValue(routing_info));
27 std::string json; 27 std::string json;
28 base::JSONWriter::Write(dict.get(), &json); 28 base::JSONWriter::Write(dict.get(), &json);
29 return json; 29 return json;
30 } 30 }
31 31
32 syncer::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( 32 ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap(
33 const ModelSafeRoutingInfo& routes, 33 const ModelSafeRoutingInfo& routes,
34 const std::string& payload) { 34 const std::string& payload) {
35 syncer::ModelTypePayloadMap types_with_payloads; 35 ModelTypePayloadMap types_with_payloads;
36 for (ModelSafeRoutingInfo::const_iterator i = routes.begin(); 36 for (ModelSafeRoutingInfo::const_iterator i = routes.begin();
37 i != routes.end(); ++i) { 37 i != routes.end(); ++i) {
38 types_with_payloads[i->first] = payload; 38 types_with_payloads[i->first] = payload;
39 } 39 }
40 return types_with_payloads; 40 return types_with_payloads;
41 } 41 }
42 42
43 syncer::ModelTypeSet GetRoutingInfoTypes( 43 ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info) {
44 const ModelSafeRoutingInfo& routing_info) { 44 ModelTypeSet types;
45 syncer::ModelTypeSet types;
46 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); 45 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin();
47 it != routing_info.end(); ++it) { 46 it != routing_info.end(); ++it) {
48 types.Put(it->first); 47 types.Put(it->first);
49 } 48 }
50 return types; 49 return types;
51 } 50 }
52 51
53 ModelSafeGroup GetGroupForModelType(const syncer::ModelType type, 52 ModelSafeGroup GetGroupForModelType(const ModelType type,
54 const ModelSafeRoutingInfo& routes) { 53 const ModelSafeRoutingInfo& routes) {
55 ModelSafeRoutingInfo::const_iterator it = routes.find(type); 54 ModelSafeRoutingInfo::const_iterator it = routes.find(type);
56 if (it == routes.end()) { 55 if (it == routes.end()) {
57 if (type != syncer::UNSPECIFIED && type != syncer::TOP_LEVEL_FOLDER) 56 if (type != UNSPECIFIED && type != TOP_LEVEL_FOLDER)
58 LOG(WARNING) << "Entry does not belong to active ModelSafeGroup!"; 57 LOG(WARNING) << "Entry does not belong to active ModelSafeGroup!";
59 return GROUP_PASSIVE; 58 return GROUP_PASSIVE;
60 } 59 }
61 return it->second; 60 return it->second;
62 } 61 }
63 62
64 std::string ModelSafeGroupToString(ModelSafeGroup group) { 63 std::string ModelSafeGroupToString(ModelSafeGroup group) {
65 switch (group) { 64 switch (group) {
66 case GROUP_UI: 65 case GROUP_UI:
67 return "GROUP_UI"; 66 return "GROUP_UI";
68 case GROUP_DB: 67 case GROUP_DB:
69 return "GROUP_DB"; 68 return "GROUP_DB";
70 case GROUP_FILE: 69 case GROUP_FILE:
71 return "GROUP_FILE"; 70 return "GROUP_FILE";
72 case GROUP_HISTORY: 71 case GROUP_HISTORY:
73 return "GROUP_HISTORY"; 72 return "GROUP_HISTORY";
74 case GROUP_PASSIVE: 73 case GROUP_PASSIVE:
75 return "GROUP_PASSIVE"; 74 return "GROUP_PASSIVE";
76 case GROUP_PASSWORD: 75 case GROUP_PASSWORD:
77 return "GROUP_PASSWORD"; 76 return "GROUP_PASSWORD";
78 default: 77 default:
79 NOTREACHED(); 78 NOTREACHED();
80 return "INVALID"; 79 return "INVALID";
81 } 80 }
82 } 81 }
83 82
84 ModelSafeWorker::~ModelSafeWorker() {} 83 ModelSafeWorker::~ModelSafeWorker() {}
85 84
86 } // namespace syncer 85 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/engine/model_safe_worker.h ('k') | sync/internal_api/public/engine/model_safe_worker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698