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 <set> | |
9 #include <string> | |
10 #include <utility> // for std::pair | |
11 #include <vector> | |
12 | |
13 #include "base/macros.h" | |
14 #include "base/threading/thread_checker.h" | |
15 #include "components/keyed_service/core/keyed_service.h" | |
16 #include "components/wifi_sync/wifi_security_class.h" | |
17 #include "sync/api/sync_data.h" | |
18 #include "sync/api/sync_error.h" | |
19 #include "sync/api/sync_error_factory.h" | |
20 #include "sync/api/syncable_service.h" | |
21 | |
22 namespace content { | |
23 class BrowserContext; | |
24 } // content | |
25 | |
26 namespace wifi_sync { | |
27 | |
28 // KeyedService that synchronizes WiFi credentials between local settings, | |
29 // and Chrome Sync. | |
30 // | |
31 // This service does not necessarily own the storage for WiFi | |
32 // credentials. In particular, on ChromeOS, WiFi credential storage is | |
33 // managed by the ChromeOS connection manager ("Shill"). | |
34 class WifiCredentialSyncableService | |
35 : public syncer::SyncableService, public KeyedService { | |
36 public: | |
37 // Constructs a service for the given |context|. Local changes will | |
38 // be applied to the Chrome Sync data for the user associated with | |
39 // |context|. | |
stevenjb
2014/11/13 22:55:36
We should note that on Chrome OS this should only
mukesh agrawal
2014/11/14 02:14:54
Done.
| |
40 explicit WifiCredentialSyncableService(content::BrowserContext *context); | |
41 ~WifiCredentialSyncableService() override; | |
42 | |
43 // syncer::SyncableService implementation. | |
44 syncer::SyncMergeResult MergeDataAndStartSyncing( | |
45 syncer::ModelType type, | |
46 const syncer::SyncDataList& initial_sync_data, | |
47 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | |
48 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | |
49 void StopSyncing(syncer::ModelType type) override; | |
50 // The implementation of GetAllSyncData may not actually return the | |
51 // complete data list. In particular, the ChromeOS implementation | |
52 // will return an empty list. | |
53 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; | |
54 syncer::SyncError ProcessSyncChanges( | |
55 const tracked_objects::Location& from_here, | |
56 const syncer::SyncChangeList& change_list) override; | |
57 | |
58 // Test support. | |
59 std::set<std::pair<std::vector<char>, WifiSecurityClass>> | |
60 GetWifiNetworksForTest() const; | |
61 | |
62 private: | |
63 friend class WifiCredentialSyncableServiceTest; | |
64 | |
65 static const enum syncer::ModelType kModelType; | |
66 | |
67 // Const members. | |
68 const content::BrowserContext* const browser_context_; | |
69 const base::ThreadChecker thread_checker_; | |
70 | |
71 // Non-const members. | |
72 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | |
73 scoped_ptr<syncer::SyncErrorFactory> sync_error_handler_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableService); | |
76 }; | |
77 | |
78 } // namespace wifi_sync | |
79 | |
80 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ | |
OLD | NEW |