Chromium Code Reviews| Index: components/wifi_sync/wifi_credential_syncable_service.h |
| diff --git a/components/wifi_sync/wifi_credential_syncable_service.h b/components/wifi_sync/wifi_credential_syncable_service.h |
| index fbd82f4bf1fbe1b79251302789b8ab73b0e83e53..370c7c529244ff4fc487063893bf2ab894c3af5c 100644 |
| --- a/components/wifi_sync/wifi_credential_syncable_service.h |
| +++ b/components/wifi_sync/wifi_credential_syncable_service.h |
| @@ -5,13 +5,17 @@ |
| #ifndef COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
| #define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_ |
| +#include <string> |
| + |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| +#include "components/wifi_sync/wifi_config_delegate.h" |
| #include "sync/api/sync_change_processor.h" |
| #include "sync/api/syncable_service.h" |
| namespace wifi_sync { |
| +class WifiCredential; |
| // KeyedService that synchronizes WiFi credentials between local settings, |
| // and Chrome Sync. |
| @@ -19,10 +23,19 @@ namespace wifi_sync { |
| // This service does not necessarily own the storage for WiFi |
| // credentials. In particular, on ChromeOS, WiFi credential storage is |
| // managed by the ChromeOS connection manager ("Shill"). |
| +// |
| +// On ChromeOS, this class should only be instantiated |
| +// for the primary user profile, as that is the only profile for |
| +// which a Shill profile is loaded. |
| class WifiCredentialSyncableService |
| : public syncer::SyncableService, public KeyedService { |
| public: |
| - WifiCredentialSyncableService(); |
| + // Constructs a syncable service. Changes from Chrome Sync will be |
| + // applied locally by |network_config_delegate|. Local changes will |
| + // be propagated to Chrome Sync using the |sync_processor| provided |
| + // in the call to MergeDataAndStartSyncing. |
| + WifiCredentialSyncableService( |
|
stevenjb
2015/01/14 00:12:48
explicit
mukesh agrawal
2015/01/20 21:13:15
Done.
|
| + scoped_ptr<WifiConfigDelegate> network_config_delegate); |
| ~WifiCredentialSyncableService() override; |
| // syncer::SyncableService implementation. |
| @@ -37,11 +50,21 @@ class WifiCredentialSyncableService |
| const tracked_objects::Location& caller_location, |
| const syncer::SyncChangeList& change_list) override; |
| + // Adds a WiFiCredential to Chrome Sync. |item_id| is a persistent |
| + // identifier which can be used to later remove the credential. It |
| + // is permitted to change an existing network by adding it again. It |
| + // is an error to call this method before |
| + // MergeDataAndStartSyncing(), or after StopSyncing(). |
| + bool AddToSyncedNetworks( |
| + const std::string& item_id, const WifiCredential& credential); |
| + |
| private: |
| // The syncer::ModelType that this SyncableService processes and |
| // generates updates for. |
| static const syncer::ModelType kModelType; |
| + // The object we use to change local network configuration. |
| + const scoped_ptr<WifiConfigDelegate> network_config_delegate_; |
|
stevenjb
2015/01/14 00:12:48
nit: WS
mukesh agrawal
2015/01/20 21:13:15
Done.
|
| // Our SyncChangeProcessor instance. Used to push changes into |
| // Chrome Sync. |
| scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; |