OLD | NEW |
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 #ifndef COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ | 5 #ifndef COMPONENTS_SYNC_WIFI_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
6 #define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ | 6 #define COMPONENTS_SYNC_WIFI_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "components/keyed_service/core/keyed_service.h" | 14 #include "components/keyed_service/core/keyed_service.h" |
15 #include "components/sync/model/sync_change_processor.h" | 15 #include "components/sync/model/sync_change_processor.h" |
16 #include "components/sync/model/syncable_service.h" | 16 #include "components/sync/model/syncable_service.h" |
17 #include "components/wifi_sync/wifi_config_delegate.h" | 17 #include "components/sync_wifi/wifi_config_delegate.h" |
18 #include "components/wifi_sync/wifi_credential.h" | 18 #include "components/sync_wifi/wifi_credential.h" |
19 #include "components/wifi_sync/wifi_security_class.h" | 19 #include "components/sync_wifi/wifi_security_class.h" |
20 | 20 |
21 namespace wifi_sync { | 21 namespace sync_wifi { |
22 | 22 |
23 // KeyedService that synchronizes WiFi credentials between local settings, | 23 // KeyedService that synchronizes WiFi credentials between local settings, |
24 // and Chrome Sync. | 24 // and Chrome Sync. |
25 // | 25 // |
26 // This service does not necessarily own the storage for WiFi | 26 // This service does not necessarily own the storage for WiFi |
27 // credentials. In particular, on ChromeOS, WiFi credential storage is | 27 // credentials. In particular, on ChromeOS, WiFi credential storage is |
28 // managed by the ChromeOS connection manager ("Shill"). | 28 // managed by the ChromeOS connection manager ("Shill"). |
29 // | 29 // |
30 // On ChromeOS, this class should only be instantiated | 30 // On ChromeOS, this class should only be instantiated |
31 // for the primary user profile, as that is the only profile for | 31 // for the primary user profile, as that is the only profile for |
32 // which a Shill profile is loaded. | 32 // which a Shill profile is loaded. |
33 class WifiCredentialSyncableService | 33 class WifiCredentialSyncableService : public syncer::SyncableService, |
34 : public syncer::SyncableService, public KeyedService { | 34 public KeyedService { |
35 public: | 35 public: |
36 // Constructs a syncable service. Changes from Chrome Sync will be | 36 // Constructs a syncable service. Changes from Chrome Sync will be |
37 // applied locally by |network_config_delegate|. Local changes will | 37 // applied locally by |network_config_delegate|. Local changes will |
38 // be propagated to Chrome Sync using the |sync_processor| provided | 38 // be propagated to Chrome Sync using the |sync_processor| provided |
39 // in the call to MergeDataAndStartSyncing. | 39 // in the call to MergeDataAndStartSyncing. |
40 explicit WifiCredentialSyncableService( | 40 explicit WifiCredentialSyncableService( |
41 std::unique_ptr<WifiConfigDelegate> network_config_delegate); | 41 std::unique_ptr<WifiConfigDelegate> network_config_delegate); |
42 ~WifiCredentialSyncableService() override; | 42 ~WifiCredentialSyncableService() override; |
43 | 43 |
44 // syncer::SyncableService implementation. | 44 // syncer::SyncableService implementation. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; | 82 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; |
83 | 83 |
84 // The networks and passphrases that are already known by Chrome | 84 // The networks and passphrases that are already known by Chrome |
85 // Sync. All synced networks must be included in this map, even if | 85 // Sync. All synced networks must be included in this map, even if |
86 // they do not use passphrases. | 86 // they do not use passphrases. |
87 SsidAndSecurityClassToPassphrase synced_networks_and_passphrases_; | 87 SsidAndSecurityClassToPassphrase synced_networks_and_passphrases_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableService); | 89 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableService); |
90 }; | 90 }; |
91 | 91 |
92 } // namespace wifi_sync | 92 } // namespace sync_wifi |
93 | 93 |
94 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ | 94 #endif // COMPONENTS_SYNC_WIFI_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
OLD | NEW |