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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_
6 #define COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_
7
8 #include <stdint.h>
9
10 #include <set>
11 #include <string>
erikwright (departed) 2014/11/17 20:18:58 not used
mukesh agrawal 2014/11/18 17:17:44 Done.
12 #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.
13 #include <vector>
14
15 #include "base/macros.h"
16 #include "base/threading/thread_checker.h"
17 #include "components/keyed_service/core/keyed_service.h"
18 #include "components/wifi_sync/wifi_security_class.h"
19 #include "sync/api/sync_data.h"
20 #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
21 #include "sync/api/sync_error_factory.h"
22 #include "sync/api/syncable_service.h"
23
24 namespace content {
25 class BrowserContext;
26 } // content
27
28 namespace wifi_sync {
29
30 // KeyedService that synchronizes WiFi credentials between local settings,
31 // and Chrome Sync.
32 //
33 // This service does not necessarily own the storage for WiFi
34 // credentials. In particular, on ChromeOS, WiFi credential storage is
35 // managed by the ChromeOS connection manager ("Shill").
36 class WifiCredentialSyncableService
37 : public syncer::SyncableService, public KeyedService {
38 public:
39 using SsidBytes = std::vector<uint8_t>;
40 using WifiSsidSecuritySet =
41 std::set<std::pair<SsidBytes, WifiSecurityClass>>;
42
43 // 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.
44 // be applied to the Chrome Sync data for the user associated with
45 // |context|. On ChromeOS, this class should only be instantiated
46 // for the primary user profile, as that is the only profile for
47 // which a Shill profile is loaded.
48 explicit WifiCredentialSyncableService(content::BrowserContext *context);
49 ~WifiCredentialSyncableService() override;
50
51 // syncer::SyncableService implementation.
52
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.
53 syncer::SyncMergeResult MergeDataAndStartSyncing(
54 syncer::ModelType type,
55 const syncer::SyncDataList& initial_sync_data,
56 scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
57 scoped_ptr<syncer::SyncErrorFactory> error_handler) override;
58
59 void StopSyncing(syncer::ModelType type) override;
60
61 // 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
62 // complete data list. In particular, the ChromeOS implementation
63 // will return an empty list.
64 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override;
65
66 syncer::SyncError ProcessSyncChanges(
67 const tracked_objects::Location& from_here,
68 const syncer::SyncChangeList& change_list) override;
69
70 // Test support.
71 WifiSsidSecuritySet GetWifiNetworksForTest() const;
72
73 private:
74 friend class WifiCredentialSyncableServiceTest;
75
76 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
77
78 // 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.
79 const content::BrowserContext* const browser_context_;
80 const base::ThreadChecker thread_checker_;
81
82 // Non-const members.
83 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.
84 scoped_ptr<syncer::SyncErrorFactory> sync_error_handler_;
85
86 DISALLOW_COPY_AND_ASSIGN(WifiCredentialSyncableService);
87 };
88
89 } // namespace wifi_sync
90
91 #endif // COMPONENTS_WIFI_SYNC_WIFI_CREDENTIAL_SYNCABLE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698