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

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

Issue 612103005: Device info datatype should be moved to components/sync_driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « components/sync_driver/local_device_info_provider_mock.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/sync/glue/local_device_info_provider_mock.h" 5 #include "components/sync_driver/local_device_info_provider_mock.h"
6 6
7 namespace browser_sync { 7 namespace sync_driver {
8 8
9 LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock() 9 LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock()
10 : is_initialized_(false) {} 10 : is_initialized_(false) {}
11 11
12 LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock( 12 LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock(
13 const std::string& guid, 13 const std::string& guid,
14 const std::string& client_name, 14 const std::string& client_name,
15 const std::string& chrome_version, 15 const std::string& chrome_version,
16 const std::string& sync_user_agent, 16 const std::string& sync_user_agent,
17 const sync_pb::SyncEnums::DeviceType device_type, 17 const sync_pb::SyncEnums::DeviceType device_type,
18 const std::string& signin_scoped_device_id) 18 const std::string& signin_scoped_device_id)
19 : is_initialized_(true) { 19 : is_initialized_(true) {
20 local_device_info_.reset( 20 local_device_info_.reset(
21 new sync_driver::DeviceInfo( 21 new DeviceInfo(
22 guid, 22 guid,
23 client_name, 23 client_name,
24 chrome_version, 24 chrome_version,
25 sync_user_agent, 25 sync_user_agent,
26 device_type, 26 device_type,
27 signin_scoped_device_id)); 27 signin_scoped_device_id));
28 } 28 }
29 29
30 LocalDeviceInfoProviderMock::~LocalDeviceInfoProviderMock() {} 30 LocalDeviceInfoProviderMock::~LocalDeviceInfoProviderMock() {}
31 31
32 const sync_driver::DeviceInfo* 32 const DeviceInfo* LocalDeviceInfoProviderMock::GetLocalDeviceInfo() const {
33 LocalDeviceInfoProviderMock::GetLocalDeviceInfo() const {
34 return is_initialized_ ? local_device_info_.get() : NULL; 33 return is_initialized_ ? local_device_info_.get() : NULL;
35 } 34 }
36 35
37 std::string LocalDeviceInfoProviderMock::GetLocalSyncCacheGUID() const { 36 std::string LocalDeviceInfoProviderMock::GetLocalSyncCacheGUID() const {
38 return local_device_info_.get() ? local_device_info_->guid() : ""; 37 return local_device_info_.get() ? local_device_info_->guid() : "";
39 } 38 }
40 39
41 void LocalDeviceInfoProviderMock::Initialize( 40 void LocalDeviceInfoProviderMock::Initialize(
42 const std::string& cache_guid, const std::string& signin_scoped_device_id) { 41 const std::string& cache_guid, const std::string& signin_scoped_device_id) {
43 // Ignored for the mock provider. 42 // Ignored for the mock provider.
44 } 43 }
45 44
46 scoped_ptr<sync_driver::LocalDeviceInfoProvider::Subscription> 45 scoped_ptr<LocalDeviceInfoProvider::Subscription>
47 LocalDeviceInfoProviderMock::RegisterOnInitializedCallback( 46 LocalDeviceInfoProviderMock::RegisterOnInitializedCallback(
48 const base::Closure& callback) { 47 const base::Closure& callback) {
49 DCHECK(!is_initialized_); 48 DCHECK(!is_initialized_);
50 return callback_list_.Add(callback); 49 return callback_list_.Add(callback);
51 } 50 }
52 51
53 void LocalDeviceInfoProviderMock::SetInitialized(bool is_initialized) { 52 void LocalDeviceInfoProviderMock::SetInitialized(bool is_initialized) {
54 is_initialized_ = is_initialized; 53 is_initialized_ = is_initialized;
55 if (is_initialized_) { 54 if (is_initialized_) {
56 callback_list_.Notify(); 55 callback_list_.Notify();
57 } 56 }
58 } 57 }
59 58
60 } // namespace browser_sync 59 } // namespace sync_driver
61 60
OLDNEW
« no previous file with comments | « components/sync_driver/local_device_info_provider_mock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698