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/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/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 10 matching lines...) Expand all Loading... |
21 // Return the DeviceInfo UNIQUE_CLIENT_TAG value for the given sync cache_guid. | 21 // Return the DeviceInfo UNIQUE_CLIENT_TAG value for the given sync cache_guid. |
22 std::string DeviceInfoLookupString(const std::string& cache_guid) { | 22 std::string DeviceInfoLookupString(const std::string& cache_guid) { |
23 return base::StringPrintf("DeviceInfo_%s", cache_guid.c_str()); | 23 return base::StringPrintf("DeviceInfo_%s", cache_guid.c_str()); |
24 } | 24 } |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 SyncedDeviceTracker::SyncedDeviceTracker(syncer::UserShare* user_share, | 28 SyncedDeviceTracker::SyncedDeviceTracker(syncer::UserShare* user_share, |
29 const std::string& cache_guid) | 29 const std::string& cache_guid) |
30 : ChangeProcessor(NULL), | 30 : ChangeProcessor(NULL), |
31 weak_factory_(this), | |
32 user_share_(user_share), | 31 user_share_(user_share), |
33 cache_guid_(cache_guid), | 32 cache_guid_(cache_guid), |
34 local_device_info_tag_(DeviceInfoLookupString(cache_guid)) { | 33 local_device_info_tag_(DeviceInfoLookupString(cache_guid)), |
| 34 weak_factory_(this) { |
35 observers_ = new ObserverListThreadSafe<Observer>; | 35 observers_ = new ObserverListThreadSafe<Observer>; |
36 } | 36 } |
37 | 37 |
38 SyncedDeviceTracker::~SyncedDeviceTracker() { | 38 SyncedDeviceTracker::~SyncedDeviceTracker() { |
39 } | 39 } |
40 | 40 |
41 void SyncedDeviceTracker::StartImpl(Profile* profile) { } | 41 void SyncedDeviceTracker::StartImpl(Profile* profile) { } |
42 | 42 |
43 void SyncedDeviceTracker::ApplyChangesFromSyncModel( | 43 void SyncedDeviceTracker::ApplyChangesFromSyncModel( |
44 const syncer::BaseTransaction* trans, | 44 const syncer::BaseTransaction* trans, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 new_node.InitUniqueByCreation(syncer::DEVICE_INFO, | 191 new_node.InitUniqueByCreation(syncer::DEVICE_INFO, |
192 type_root, | 192 type_root, |
193 tag); | 193 tag); |
194 DCHECK_EQ(syncer::WriteNode::INIT_SUCCESS, create_result); | 194 DCHECK_EQ(syncer::WriteNode::INIT_SUCCESS, create_result); |
195 new_node.SetDeviceInfoSpecifics(specifics); | 195 new_node.SetDeviceInfoSpecifics(specifics); |
196 new_node.SetTitle(UTF8ToWide(specifics.client_name())); | 196 new_node.SetTitle(UTF8ToWide(specifics.client_name())); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 } // namespace browser_sync | 200 } // namespace browser_sync |
OLD | NEW |