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 #ifndef COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
| 6 #define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <set> |
| 11 #include <utility> |
| 12 #include <vector> |
| 13 |
| 14 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/threading/thread_checker.h" |
| 17 #include "components/keyed_service/core/keyed_service.h" |
| 18 #include "sync/api/sync_change_processor.h" |
| 19 #include "sync/api/sync_error_factory.h" |
| 20 #include "sync/api/syncable_service.h" |
| 21 |
| 22 namespace wifi_sync { |
| 23 |
| 24 // KeyedService that synchronizes WiFi credentials between local settings, |
| 25 // and Chrome Sync. |
| 26 // |
| 27 // This service does not necessarily own the storage for WiFi |
| 28 // credentials. In particular, on ChromeOS, WiFi credential storage is |
| 29 // managed by the ChromeOS connection manager ("Shill"). |
| 30 class WifiCredentialSyncableService |
| 31 : public syncer::SyncableService, public KeyedService { |
| 32 public: |
| 33 WifiCredentialSyncableService(); |
| 34 ~WifiCredentialSyncableService() override; |
| 35 |
| 36 // syncer::SyncableService implementation. |
| 37 syncer::SyncMergeResult MergeDataAndStartSyncing( |
| 38 syncer::ModelType type, |
| 39 const syncer::SyncDataList& initial_sync_data, |
| 40 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 41 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; |
| 42 void StopSyncing(syncer::ModelType type) override; |
| 43 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
| 44 syncer::SyncError ProcessSyncChanges( |
| 45 const tracked_objects::Location& caller_location, |
| 46 const syncer::SyncChangeList& change_list) override; |
| 47 |
| 48 private: |
| 49 // The syncer::ModelType that this SyncableService processes and |
| 50 // generates updates for. |
| 51 static const syncer::ModelType kModelType; |
| 52 |
| 53 // Our ThreadChecker instance. Used to ensure that all calls to an |
| 54 // instance of this class are made from the same thread. |
| 55 const base::ThreadChecker thread_checker_; |
| 56 // Our SyncChangeProcessor instance. Used to push changes into |
| 57 // Chrome Sync. |
| 58 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableService); |
| 61 }; |
| 62 |
| 63 } // namespace wifi_sync |
| 64 |
| 65 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
OLD | NEW |