OLD | NEW |
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 "chrome/browser/sync/glue/synced_device_tracker.h" | 5 #include "chrome/browser/sync/glue/synced_device_tracker.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/sync/glue/device_info.h" | 9 #include "chrome/browser/sync/glue/device_info.h" |
10 #include "sync/internal_api/public/base/model_type.h" | 10 #include "sync/internal_api/public/base/model_type.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 specifics.set_chrome_version(info.chrome_version()); | 92 specifics.set_chrome_version(info.chrome_version()); |
93 specifics.set_sync_user_agent(info.sync_user_agent()); | 93 specifics.set_sync_user_agent(info.sync_user_agent()); |
94 specifics.set_device_type(info.device_type()); | 94 specifics.set_device_type(info.device_type()); |
95 | 95 |
96 syncer::WriteTransaction trans(FROM_HERE, user_share_); | 96 syncer::WriteTransaction trans(FROM_HERE, user_share_); |
97 syncer::WriteNode node(&trans); | 97 syncer::WriteNode node(&trans); |
98 | 98 |
99 if (node.InitByClientTagLookup(syncer::DEVICE_INFO, local_device_info_tag_) == | 99 if (node.InitByClientTagLookup(syncer::DEVICE_INFO, local_device_info_tag_) == |
100 syncer::BaseNode::INIT_OK) { | 100 syncer::BaseNode::INIT_OK) { |
101 node.SetDeviceInfoSpecifics(specifics); | 101 node.SetDeviceInfoSpecifics(specifics); |
102 node.SetTitle(ASCIIToWide(specifics.client_name())); | 102 node.SetTitle(base::ASCIIToWide(specifics.client_name())); |
103 } else { | 103 } else { |
104 syncer::ReadNode type_root(&trans); | 104 syncer::ReadNode type_root(&trans); |
105 syncer::BaseNode::InitByLookupResult type_root_lookup_result = | 105 syncer::BaseNode::InitByLookupResult type_root_lookup_result = |
106 type_root.InitByTagLookup(ModelTypeToRootTag(syncer::DEVICE_INFO)); | 106 type_root.InitByTagLookup(ModelTypeToRootTag(syncer::DEVICE_INFO)); |
107 DCHECK_EQ(syncer::BaseNode::INIT_OK, type_root_lookup_result); | 107 DCHECK_EQ(syncer::BaseNode::INIT_OK, type_root_lookup_result); |
108 | 108 |
109 syncer::WriteNode new_node(&trans); | 109 syncer::WriteNode new_node(&trans); |
110 syncer::WriteNode::InitUniqueByCreationResult create_result = | 110 syncer::WriteNode::InitUniqueByCreationResult create_result = |
111 new_node.InitUniqueByCreation(syncer::DEVICE_INFO, | 111 new_node.InitUniqueByCreation(syncer::DEVICE_INFO, |
112 type_root, | 112 type_root, |
113 local_device_info_tag_); | 113 local_device_info_tag_); |
114 DCHECK_EQ(syncer::WriteNode::INIT_SUCCESS, create_result); | 114 DCHECK_EQ(syncer::WriteNode::INIT_SUCCESS, create_result); |
115 new_node.SetDeviceInfoSpecifics(specifics); | 115 new_node.SetDeviceInfoSpecifics(specifics); |
116 new_node.SetTitle(ASCIIToWide(specifics.client_name())); | 116 new_node.SetTitle(base::ASCIIToWide(specifics.client_name())); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 } // namespace browser_sync | 120 } // namespace browser_sync |
OLD | NEW |