OLD | NEW |
(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 "components/wifi_sync/wifi_credential_syncable_service.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "sync/api/sync_data.h" |
| 9 #include "sync/api/sync_error.h" |
| 10 #include "sync/api/sync_merge_result.h" |
| 11 |
| 12 namespace wifi_sync { |
| 13 |
| 14 // static |
| 15 const syncer::ModelType WifiCredentialSyncableService::kModelType = |
| 16 syncer::WIFI_CREDENTIALS; |
| 17 |
| 18 WifiCredentialSyncableService::WifiCredentialSyncableService( |
| 19 content::BrowserContext *context) : |
| 20 browser_context_(context), |
| 21 thread_checker_() { |
| 22 } |
| 23 |
| 24 WifiCredentialSyncableService::~WifiCredentialSyncableService() { |
| 25 DCHECK(thread_checker_.CalledOnValidThread()); |
| 26 } |
| 27 |
| 28 // Implementation of syncer::SyncableService API. |
| 29 syncer::SyncMergeResult WifiCredentialSyncableService::MergeDataAndStartSyncing( |
| 30 syncer::ModelType type, |
| 31 const syncer::SyncDataList& initial_sync_data, |
| 32 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 33 scoped_ptr<syncer::SyncErrorFactory> error_handler) { |
| 34 DCHECK(thread_checker_.CalledOnValidThread()); |
| 35 DCHECK(!sync_processor_.get()); |
| 36 DCHECK(sync_processor.get()); |
| 37 DCHECK(error_handler.get()); |
| 38 DCHECK_EQ(kModelType, type); |
| 39 |
| 40 sync_processor_ = sync_processor.Pass(); |
| 41 sync_error_handler_ = error_handler.Pass(); |
| 42 |
| 43 return syncer::SyncMergeResult(type); |
| 44 } |
| 45 |
| 46 void WifiCredentialSyncableService::StopSyncing(syncer::ModelType type) { |
| 47 DCHECK(thread_checker_.CalledOnValidThread()); |
| 48 DCHECK_EQ(kModelType, type); |
| 49 sync_processor_.reset(); |
| 50 sync_error_handler_.reset(); |
| 51 } |
| 52 |
| 53 syncer::SyncDataList WifiCredentialSyncableService::GetAllSyncData( |
| 54 syncer::ModelType type) const { |
| 55 DCHECK(thread_checker_.CalledOnValidThread()); |
| 56 DCHECK_EQ(kModelType, type); |
| 57 NOTIMPLEMENTED(); |
| 58 return syncer::SyncDataList(); |
| 59 } |
| 60 |
| 61 syncer::SyncError WifiCredentialSyncableService::ProcessSyncChanges( |
| 62 const tracked_objects::Location& from_here, |
| 63 const syncer::SyncChangeList& change_list) { |
| 64 DCHECK(thread_checker_.CalledOnValidThread()); |
| 65 NOTIMPLEMENTED(); |
| 66 return syncer::SyncError(); |
| 67 } |
| 68 |
| 69 // Test support. |
| 70 WifiCredentialSyncableService::WifiSsidSecuritySet |
| 71 WifiCredentialSyncableService::GetWifiNetworksForTest() const { |
| 72 DCHECK(thread_checker_.CalledOnValidThread()); |
| 73 return WifiSsidSecuritySet(); |
| 74 } |
| 75 |
| 76 } // namespace wifi_sync |
OLD | NEW |