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

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: fix nits (round 2), and remove dependency from component to chrome 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..bfe463c267abb30babb498178946b70e234d2998
--- /dev/null
+++ b/components/wifi_sync/wifi_credential_syncable_service.h
@@ -0,0 +1,91 @@
+// 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 <string>
erikwright (departed) 2014/11/17 20:18:58 not used
mukesh agrawal 2014/11/18 17:17:44 Done.
+#include <utility> // for std::pair
erikwright (departed) 2014/11/17 20:18:58 This comment is unnecessary.
mukesh agrawal 2014/11/18 17:17:44 Done.
+#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"
erikwright (departed) 2014/11/17 20:18:57 Not required (you only use it as part of declaring
mukesh agrawal 2014/11/18 17:17:43 Done. (Also removed sync_data, for the same reason
+#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>;
+ using WifiSsidSecuritySet =
+ std::set<std::pair<SsidBytes, WifiSecurityClass>>;
+
+ // Constructs a service for the given |context|. Local changes will
erikwright (departed) 2014/11/17 20:18:57 either "for |context|" or "for the given BrowserCo
mukesh agrawal 2014/11/18 17:17:44 Done.
+ // 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);
+ ~WifiCredentialSyncableService() override;
+
+ // syncer::SyncableService implementation.
+
erikwright (departed) 2014/11/17 20:18:57 remove the blank lines 52,58,60,65
mukesh agrawal 2014/11/18 17:17:44 Done.
+ 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
erikwright (departed) 2014/11/17 20:18:57 There should not be a reason to add comments to an
mukesh agrawal 2014/11/18 17:17:44 Done. (Removed, as I couldn't find a reason to kee
+ // 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.
+ WifiSsidSecuritySet GetWifiNetworksForTest() const;
+
+ private:
+ friend class WifiCredentialSyncableServiceTest;
+
+ static const enum syncer::ModelType kModelType;
erikwright (departed) 2014/11/17 20:18:57 I think you are using this include transitively. Y
erikwright (departed) 2014/11/17 20:18:58 I'm not used to seeing 'enum' somewhere like this.
mukesh agrawal 2014/11/18 17:17:43 Done.
mukesh agrawal 2014/11/18 17:17:44 You are correct that this is included transitively
+
+ // Const members.
erikwright (departed) 2014/11/17 20:18:58 I don't think the section headings here are requir
mukesh agrawal 2014/11/18 17:17:44 Done.
+ const content::BrowserContext* const browser_context_;
+ const base::ThreadChecker thread_checker_;
+
+ // Non-const members.
+ scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
erikwright (departed) 2014/11/17 20:18:57 Requires an include?
erikwright (departed) 2014/11/17 20:18:57 include base/memory/scoped_ptr.h
mukesh agrawal 2014/11/18 17:17:43 Done.
mukesh agrawal 2014/11/18 17:17:43 Done.
+ 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