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

Side by Side Diff: chrome/browser/extensions/settings/settings_sync_processor.h

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_PROCESSOR_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_PROCESSOR_H_
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_PROCESSOR_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_PROCESSOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "chrome/browser/value_store/value_store_change.h" 12 #include "chrome/browser/value_store/value_store_change.h"
13 #include "sync/api/sync_error.h" 13 #include "sync/api/sync_error.h"
14 14
15 namespace csync { 15 namespace syncer {
16 class SyncChangeProcessor; 16 class SyncChangeProcessor;
17 } // namespace csync 17 } // namespace syncer
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 // A wrapper for a SyncChangeProcessor that deals specifically with the syncing 21 // A wrapper for a SyncChangeProcessor that deals specifically with the syncing
22 // of a single extension's settings. Handles: 22 // of a single extension's settings. Handles:
23 // - translating SettingChanges into calls into the Sync API. 23 // - translating SettingChanges into calls into the Sync API.
24 // - deciding whether to ADD/REMOVE/SET depending on the current state of 24 // - deciding whether to ADD/REMOVE/SET depending on the current state of
25 // settings. 25 // settings.
26 // - rate limiting (inherently per-extension, which is what we want). 26 // - rate limiting (inherently per-extension, which is what we want).
27 class SettingsSyncProcessor { 27 class SettingsSyncProcessor {
28 public: 28 public:
29 SettingsSyncProcessor(const std::string& extension_id, 29 SettingsSyncProcessor(const std::string& extension_id,
30 syncable::ModelType type, 30 syncable::ModelType type,
31 csync::SyncChangeProcessor* sync_processor); 31 syncer::SyncChangeProcessor* sync_processor);
32 ~SettingsSyncProcessor(); 32 ~SettingsSyncProcessor();
33 33
34 // Initializes this with the initial state of sync. 34 // Initializes this with the initial state of sync.
35 void Init(const DictionaryValue& initial_state); 35 void Init(const DictionaryValue& initial_state);
36 36
37 // Sends |changes| to sync. 37 // Sends |changes| to sync.
38 csync::SyncError SendChanges(const ValueStoreChangeList& changes); 38 syncer::SyncError SendChanges(const ValueStoreChangeList& changes);
39 39
40 // Informs this that |changes| have been receieved from sync. No action will 40 // Informs this that |changes| have been receieved from sync. No action will
41 // be taken, but this must be notified for internal bookkeeping. 41 // be taken, but this must be notified for internal bookkeeping.
42 void NotifyChanges(const ValueStoreChangeList& changes); 42 void NotifyChanges(const ValueStoreChangeList& changes);
43 43
44 syncable::ModelType type() { return type_; } 44 syncable::ModelType type() { return type_; }
45 45
46 private: 46 private:
47 // ID of the extension the changes are for. 47 // ID of the extension the changes are for.
48 const std::string extension_id_; 48 const std::string extension_id_;
49 49
50 // Sync model type. Either EXTENSION_SETTING or APP_SETTING. 50 // Sync model type. Either EXTENSION_SETTING or APP_SETTING.
51 const syncable::ModelType type_; 51 const syncable::ModelType type_;
52 52
53 // The sync processor used to send changes to sync. 53 // The sync processor used to send changes to sync.
54 csync::SyncChangeProcessor* const sync_processor_; 54 syncer::SyncChangeProcessor* const sync_processor_;
55 55
56 // Whether Init() has been called. 56 // Whether Init() has been called.
57 bool initialized_; 57 bool initialized_;
58 58
59 // Keys of the settings that are currently being synced. Used to decide what 59 // Keys of the settings that are currently being synced. Used to decide what
60 // kind of action (ADD, UPDATE, REMOVE) to send to sync. 60 // kind of action (ADD, UPDATE, REMOVE) to send to sync.
61 std::set<std::string> synced_keys_; 61 std::set<std::string> synced_keys_;
62 62
63 DISALLOW_COPY_AND_ASSIGN(SettingsSyncProcessor); 63 DISALLOW_COPY_AND_ASSIGN(SettingsSyncProcessor);
64 }; 64 };
65 65
66 } // namespace extensions 66 } // namespace extensions
67 67
68 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_PROCESSOR_H_ 68 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_PROCESSOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/settings/settings_frontend.cc ('k') | chrome/browser/extensions/settings/settings_sync_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698