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_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
6 #define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ | 6 #define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
7 | 7 |
8 #include <string> | |
9 | |
10 #include "components/keyed_service/core/keyed_service.h" | 8 #include "components/keyed_service/core/keyed_service.h" |
11 #include "sync/api/syncable_service.h" | 9 #include "sync/api/syncable_service.h" |
12 | 10 |
13 namespace wifi_sync { | 11 namespace wifi_sync { |
14 | 12 |
15 class WifiCredential; | 13 class WifiCredential; |
16 | 14 |
17 // KeyedService that synchronizes WiFi credentials between local settings, | 15 // KeyedService that synchronizes WiFi credentials between local settings, |
18 // and Chrome Sync. | 16 // and Chrome Sync. |
19 class WifiCredentialSyncableService | 17 class WifiCredentialSyncableService |
20 : public syncer::SyncableService, public KeyedService { | 18 : public syncer::SyncableService, public KeyedService { |
21 public: | 19 public: |
22 // Adds a WiFiCredential to Chrome Sync. |item_id| is a persistent | 20 // Adds a WiFiCredential to Chrome Sync. It is an error to add a |
23 // identifier which can be used to later remove the credential. It | 21 // network that already exists. It is also an error to call this |
24 // is an error to add a network that already exists. It is also an | 22 // method before MergeDataAndStartSyncing(), or after StopSyncing(). |
25 // error to call this method before MergeDataAndStartSyncing(), or | |
26 // after StopSyncing(). | |
27 // | 23 // |
28 // TODO(quiche): Allow changing a credential, by addding it again. | 24 // TODO(quiche): Allow changing a credential, by addding it again. |
29 // crbug.com/431436 | 25 // crbug.com/431436 |
30 virtual bool AddToSyncedNetworks(const std::string& item_id, | 26 virtual bool AddToSyncedNetworks(const WifiCredential& credential) = 0; |
31 const WifiCredential& credential) = 0; | |
32 }; | 27 }; |
33 | 28 |
34 } // namespace wifi_sync | 29 } // namespace wifi_sync |
35 | 30 |
36 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ | 31 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
OLD | NEW |