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

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 BUILD.gn and 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..b06f74b32b3b150e93506f134c4e69f4f7789f0f
--- /dev/null
+++ b/components/wifi_sync/wifi_credential_syncable_service.h
@@ -0,0 +1,89 @@
+// 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 <stdint.h>
+
+#include <set>
+#include <utility>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.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_change_processor.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:
+ using SsidBytes = std::vector<uint8_t>;
mukesh agrawal 2014/12/03 01:44:43 No longer needed, after removal of GetWifiNetworks
+ using WifiSsidSecuritySet =
mukesh agrawal 2014/12/03 01:44:43 As above.
+ std::set<std::pair<SsidBytes, WifiSecurityClass>>;
+
+ // Constructs a service for |context|. Local changes will be applied
+ // to the Chrome Sync data for the user associated with
+ // |context|. 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.
+ explicit WifiCredentialSyncableService(content::BrowserContext *context);
mukesh agrawal 2014/12/03 01:44:43 Removed |context| argument, as it wasn't actually
+ ~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;
+ 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.
mukesh agrawal 2014/12/03 01:44:43 Removed in favor of testing integration with chrom
+ WifiSsidSecuritySet GetWifiNetworksForTest() const;
+
+ private:
+ // The syncer::ModelType that this SyncableService process and
+ // generates updates for.
+ static const syncer::ModelType kModelType;
+
+ // The BrowserContext that this SyncableService processes and
mukesh agrawal 2014/12/03 01:44:43 Removed since it wasn't actually used.
+ // generates updates for. See ctor documentation for additional
+ // information.
+ const content::BrowserContext* const browser_context_;
+ // Our ThreadChecker instance. Used to ensure that all calls to an
+ // instance of this class are made from the same thread.
+ const base::ThreadChecker thread_checker_;
+ // Our SyncChangeProcessor instance. Used to push changes into
+ // Chrome Sync.
+ scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
+ // Our SyncErrorFactory instance. Used to report an error condition
mukesh agrawal 2014/12/03 01:44:43 Removed since it wasn't actually used.
+ // which should cause syncing to stop.
+ 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