Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: components/wifi_sync/wifi_credential_syncable_service.h

Issue 709683004: components: add wifi_sync component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit-1-security-class
Patch Set: update commit message Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
new file mode 100644
index 0000000000000000000000000000000000000000..dea909e65df00e33614fa061b8022578a367e8aa
--- /dev/null
+++ b/components/wifi_sync/wifi_credential_syncable_service.h
@@ -0,0 +1,80 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_
+#define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_
+
+#include <set>
+#include <string>
+#include <utility> // for std::pair
+#include <vector>
+
+#include "base/macros.h"
+#include "base/threading/thread_checker.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "components/wifi_sync/wifi_security_class.h"
+#include "sync/api/sync_data.h"
+#include "sync/api/sync_error.h"
+#include "sync/api/sync_error_factory.h"
+#include "sync/api/syncable_service.h"
+
+namespace content {
+class BrowserContext;
+} // content
+
+namespace wifi_sync {
+
+// KeyedService that synchronizes WiFi credentials between local settings,
+// and Chrome 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").
+class WifiCredentialSyncableService
+ : public syncer::SyncableService, public KeyedService {
+ public:
+ // Constructs a service for the given |context|. Local changes will
+ // be applied to the Chrome Sync data for the user associated with
+ // |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.
+ explicit WifiCredentialSyncableService(content::BrowserContext *context);
+ ~WifiCredentialSyncableService() override;
+
+ // syncer::SyncableService implementation.
+ syncer::SyncMergeResult MergeDataAndStartSyncing(
+ syncer::ModelType type,
+ const syncer::SyncDataList& initial_sync_data,
+ scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
+ scoped_ptr<syncer::SyncErrorFactory> error_handler) override;
+ void StopSyncing(syncer::ModelType type) override;
+ // The implementation of GetAllSyncData may not actually return the
+ // complete data list. In particular, the ChromeOS implementation
+ // will return an empty list.
+ syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override;
+ syncer::SyncError ProcessSyncChanges(
+ const tracked_objects::Location& from_here,
+ const syncer::SyncChangeList& change_list) override;
+
+ // Test support.
+ std::set<std::pair<std::vector<char>, WifiSecurityClass>>
+ GetWifiNetworksForTest() const;
+
+ private:
+ friend class WifiCredentialSyncableServiceTest;
+
+ static const enum syncer::ModelType kModelType;
+
+ // Const members.
+ const content::BrowserContext* const browser_context_;
+ const base::ThreadChecker thread_checker_;
+
+ // Non-const members.
+ scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
+ scoped_ptr<syncer::SyncErrorFactory> sync_error_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableService);
+};
+
+} // namespace wifi_sync
+
+#endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698