Chromium Code Reviews| 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 "components/wifi_sync/wifi_security_class.h" | |
| 19 #include "sync/api/sync_change_processor.h" | |
| 20 #include "sync/api/sync_error_factory.h" | |
| 21 #include "sync/api/syncable_service.h" | |
| 22 | |
| 23 namespace content { | |
| 24 class BrowserContext; | |
| 25 } // content | |
| 26 | |
| 27 namespace wifi_sync { | |
| 28 | |
| 29 // KeyedService that synchronizes WiFi credentials between local settings, | |
| 30 // and Chrome Sync. | |
| 31 // | |
| 32 // This service does not necessarily own the storage for WiFi | |
| 33 // credentials. In particular, on ChromeOS, WiFi credential storage is | |
| 34 // managed by the ChromeOS connection manager ("Shill"). | |
| 35 class WifiCredentialSyncableService | |
| 36 : public syncer::SyncableService, public KeyedService { | |
| 37 public: | |
| 38 using SsidBytes = std::vector<uint8_t>; | |
|
mukesh agrawal
2014/12/03 01:44:43
No longer needed, after removal of GetWifiNetworks
| |
| 39 using WifiSsidSecuritySet = | |
|
mukesh agrawal
2014/12/03 01:44:43
As above.
| |
| 40 std::set<std::pair<SsidBytes, WifiSecurityClass>>; | |
| 41 | |
| 42 // Constructs a service for |context|. Local changes will be applied | |
| 43 // to the Chrome Sync data for the user associated with | |
| 44 // |context|. On ChromeOS, this class should only be instantiated | |
| 45 // for the primary user profile, as that is the only profile for | |
| 46 // which a Shill profile is loaded. | |
| 47 explicit WifiCredentialSyncableService(content::BrowserContext *context); | |
|
mukesh agrawal
2014/12/03 01:44:43
Removed |context| argument, as it wasn't actually
| |
| 48 ~WifiCredentialSyncableService() override; | |
| 49 | |
| 50 // syncer::SyncableService implementation. | |
| 51 syncer::SyncMergeResult MergeDataAndStartSyncing( | |
| 52 syncer::ModelType type, | |
| 53 const syncer::SyncDataList& initial_sync_data, | |
| 54 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | |
| 55 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | |
| 56 void StopSyncing(syncer::ModelType type) override; | |
| 57 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; | |
| 58 syncer::SyncError ProcessSyncChanges( | |
| 59 const tracked_objects::Location& from_here, | |
| 60 const syncer::SyncChangeList& change_list) override; | |
| 61 | |
| 62 // Test support. | |
|
mukesh agrawal
2014/12/03 01:44:43
Removed in favor of testing integration with chrom
| |
| 63 WifiSsidSecuritySet GetWifiNetworksForTest() const; | |
| 64 | |
| 65 private: | |
| 66 // The syncer::ModelType that this SyncableService process and | |
| 67 // generates updates for. | |
| 68 static const syncer::ModelType kModelType; | |
| 69 | |
| 70 // The BrowserContext that this SyncableService processes and | |
|
mukesh agrawal
2014/12/03 01:44:43
Removed since it wasn't actually used.
| |
| 71 // generates updates for. See ctor documentation for additional | |
| 72 // information. | |
| 73 const content::BrowserContext* const browser_context_; | |
| 74 // Our ThreadChecker instance. Used to ensure that all calls to an | |
| 75 // instance of this class are made from the same thread. | |
| 76 const base::ThreadChecker thread_checker_; | |
| 77 // Our SyncChangeProcessor instance. Used to push changes into | |
| 78 // Chrome Sync. | |
| 79 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | |
| 80 // Our SyncErrorFactory instance. Used to report an error condition | |
|
mukesh agrawal
2014/12/03 01:44:43
Removed since it wasn't actually used.
| |
| 81 // which should cause syncing to stop. | |
| 82 scoped_ptr<syncer::SyncErrorFactory> sync_error_handler_; | |
| 83 | |
| 84 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableService); | |
| 85 }; | |
| 86 | |
| 87 } // namespace wifi_sync | |
| 88 | |
| 89 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ | |
| OLD | NEW |