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

Side by Side Diff: chrome/browser/sync/glue/local_device_info_provider_impl.cc

Issue 398423002: Sync: Refactoring of DEVICE_INFO syncable type - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed wrong signin_scoped_device_id assert from LocalDeviceInfoProvider. Created 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h"
6
7 namespace browser_sync {
8
9 LocalDeviceInfoProviderImpl::LocalDeviceInfoProviderImpl()
10 : weak_factory_(this) {
11 }
12
13 LocalDeviceInfoProviderImpl::~LocalDeviceInfoProviderImpl() {
14 }
15
16 const DeviceInfo*
17 LocalDeviceInfoProviderImpl::GetLocalDeviceInfo() const {
18 return local_device_info_.get();
19 }
20
21 std::string LocalDeviceInfoProviderImpl::GetLocalSyncCacheGUID() const {
22 return cache_guid_;
23 }
24
25 scoped_ptr<LocalDeviceInfoProvider::Subscription>
26 LocalDeviceInfoProviderImpl::RegisterOnInitializedCallback(
27 const base::Closure& callback) {
28 DCHECK(!local_device_info_.get());
29 return callback_list_.Add(callback);
30 }
31
32 void LocalDeviceInfoProviderImpl::Initialize(
33 const std::string& cache_guid, const std::string& signin_scoped_device_id) {
34 DCHECK(!cache_guid.empty());
35 cache_guid_ = cache_guid;
36 DeviceInfo::CreateLocalDeviceInfo(
37 cache_guid_,
38 signin_scoped_device_id,
39 base::Bind(&LocalDeviceInfoProviderImpl::InitializeContinuation,
40 weak_factory_.GetWeakPtr()));
41 }
42
43 void LocalDeviceInfoProviderImpl::InitializeContinuation(
44 const DeviceInfo& local_info) {
45 // Copy constructor is disallowed in DeviceInfo, construct a new one from
46 // the fields passed in local_info.
47 local_device_info_.reset(
48 new DeviceInfo(
49 local_info.guid(),
50 local_info.client_name(),
51 local_info.chrome_version(),
52 local_info.sync_user_agent(),
53 local_info.device_type(),
54 local_info.signin_scoped_device_id()));
55
56 // Notify observers.
57 callback_list_.Notify();
58 }
59
60 } // namespace browser_sync
61
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/local_device_info_provider_impl.h ('k') | chrome/browser/sync/glue/local_device_info_provider_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698