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

Side by Side Diff: components/sync_driver/device_info_sync_service.cc

Issue 1408123003: [Sync] Initial USS service implementation for DeviceInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some stub imaginary methods for the ModelTypeService interface. Created 5 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_driver/device_info_sync_service.h" 5 #include "components/sync_driver/device_info_sync_service.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "components/sync_driver/local_device_info_provider.h" 9 #include "components/sync_driver/local_device_info_provider.h"
10 #include "sync/api/sync_change.h" 10 #include "sync/api/sync_change.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 const sync_pb::DeviceInfoSpecifics& specifics = entity.device_info(); 354 const sync_pb::DeviceInfoSpecifics& specifics = entity.device_info();
355 355
356 std::string local_device_tag = 356 std::string local_device_tag =
357 base::StringPrintf("DeviceInfo_%s", specifics.cache_guid().c_str()); 357 base::StringPrintf("DeviceInfo_%s", specifics.cache_guid().c_str());
358 358
359 return SyncData::CreateLocalData( 359 return SyncData::CreateLocalData(
360 local_device_tag, specifics.client_name(), entity); 360 local_device_tag, specifics.client_name(), entity);
361 } 361 }
362 362
363 DeviceInfo* DeviceInfoSyncService::CreateDeviceInfo( 363 DeviceInfo* DeviceInfoSyncService::CreateDeviceInfo(
364 const syncer::SyncData sync_data) { 364 const syncer::SyncData& sync_data) {
365 const sync_pb::DeviceInfoSpecifics& specifics = 365 const sync_pb::DeviceInfoSpecifics& specifics =
366 sync_data.GetSpecifics().device_info(); 366 sync_data.GetSpecifics().device_info();
367 367
368 return new DeviceInfo(specifics.cache_guid(), 368 return new DeviceInfo(specifics.cache_guid(),
369 specifics.client_name(), 369 specifics.client_name(),
370 specifics.chrome_version(), 370 specifics.chrome_version(),
371 specifics.sync_user_agent(), 371 specifics.sync_user_agent(),
372 specifics.device_type(), 372 specifics.device_type(),
373 specifics.signin_scoped_device_id()); 373 specifics.signin_scoped_device_id());
374 } 374 }
(...skipping 10 matching lines...) Expand all
385 SyncDataMap::iterator iter = all_data_.find(client_id); 385 SyncDataMap::iterator iter = all_data_.find(client_id);
386 if (iter != all_data_.end()) { 386 if (iter != all_data_.end()) {
387 DVLOG(1) << "Deleting DEVICE_INFO for " 387 DVLOG(1) << "Deleting DEVICE_INFO for "
388 << iter->second.GetSpecifics().device_info().client_name() 388 << iter->second.GetSpecifics().device_info().client_name()
389 << " with ID " << client_id; 389 << " with ID " << client_id;
390 all_data_.erase(iter); 390 all_data_.erase(iter);
391 } 391 }
392 } 392 }
393 393
394 } // namespace sync_driver 394 } // namespace sync_driver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698