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

Side by Side Diff: chrome/browser/extensions/settings/setting_sync_data.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_SETTING_SYNC_DATA_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTING_SYNC_DATA_H_
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTING_SYNC_DATA_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTING_SYNC_DATA_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "sync/api/sync_change.h" 12 #include "sync/api/sync_change.h"
13 13
14 namespace csync { 14 namespace syncer {
15 class SyncData; 15 class SyncData;
16 } 16 }
17 17
18 namespace sync_pb { 18 namespace sync_pb {
19 class ExtensionSettingSpecifics; 19 class ExtensionSettingSpecifics;
20 } 20 }
21 21
22 namespace extensions { 22 namespace extensions {
23 23
24 // Container for data interpreted from sync data/changes for an extension or 24 // Container for data interpreted from sync data/changes for an extension or
25 // app setting. Safe and efficient to copy. 25 // app setting. Safe and efficient to copy.
26 class SettingSyncData { 26 class SettingSyncData {
27 public: 27 public:
28 // Creates from a sync change. 28 // Creates from a sync change.
29 explicit SettingSyncData(const csync::SyncChange& sync_change); 29 explicit SettingSyncData(const syncer::SyncChange& sync_change);
30 30
31 // Creates from sync data. |change_type| will be ACTION_INVALID. 31 // Creates from sync data. |change_type| will be ACTION_INVALID.
32 explicit SettingSyncData(const csync::SyncData& sync_data); 32 explicit SettingSyncData(const syncer::SyncData& sync_data);
33 33
34 // Creates explicitly. 34 // Creates explicitly.
35 SettingSyncData( 35 SettingSyncData(
36 csync::SyncChange::SyncChangeType change_type, 36 syncer::SyncChange::SyncChangeType change_type,
37 const std::string& extension_id, 37 const std::string& extension_id,
38 const std::string& key, 38 const std::string& key,
39 scoped_ptr<Value> value); 39 scoped_ptr<Value> value);
40 40
41 ~SettingSyncData(); 41 ~SettingSyncData();
42 42
43 // Returns the type of the sync change; may be ACTION_INVALID. 43 // Returns the type of the sync change; may be ACTION_INVALID.
44 csync::SyncChange::SyncChangeType change_type() const; 44 syncer::SyncChange::SyncChangeType change_type() const;
45 45
46 // Returns the extension id the setting is for. 46 // Returns the extension id the setting is for.
47 const std::string& extension_id() const; 47 const std::string& extension_id() const;
48 48
49 // Returns the settings key. 49 // Returns the settings key.
50 const std::string& key() const; 50 const std::string& key() const;
51 51
52 // Returns the value of the setting. 52 // Returns the value of the setting.
53 const Value& value() const; 53 const Value& value() const;
54 54
55 private: 55 private:
56 // Ref-counted container for the data. 56 // Ref-counted container for the data.
57 // TODO(kalman): Use browser_sync::Immutable<Internal>. 57 // TODO(kalman): Use browser_sync::Immutable<Internal>.
58 class Internal : public base::RefCountedThreadSafe<Internal> { 58 class Internal : public base::RefCountedThreadSafe<Internal> {
59 public: 59 public:
60 Internal( 60 Internal(
61 csync::SyncChange::SyncChangeType change_type, 61 syncer::SyncChange::SyncChangeType change_type,
62 const std::string& extension_id, 62 const std::string& extension_id,
63 const std::string& key, 63 const std::string& key,
64 scoped_ptr<Value> value); 64 scoped_ptr<Value> value);
65 65
66 csync::SyncChange::SyncChangeType change_type_; 66 syncer::SyncChange::SyncChangeType change_type_;
67 std::string extension_id_; 67 std::string extension_id_;
68 std::string key_; 68 std::string key_;
69 scoped_ptr<Value> value_; 69 scoped_ptr<Value> value_;
70 70
71 private: 71 private:
72 friend class base::RefCountedThreadSafe<Internal>; 72 friend class base::RefCountedThreadSafe<Internal>;
73 ~Internal(); 73 ~Internal();
74 }; 74 };
75 75
76 // Initializes internal_ from sync data for an extension or app setting. 76 // Initializes internal_ from sync data for an extension or app setting.
77 void Init(csync::SyncChange::SyncChangeType change_type, 77 void Init(syncer::SyncChange::SyncChangeType change_type,
78 const csync::SyncData& sync_data); 78 const syncer::SyncData& sync_data);
79 79
80 // Initializes internal_ from extension specifics. 80 // Initializes internal_ from extension specifics.
81 void InitFromExtensionSettingSpecifics( 81 void InitFromExtensionSettingSpecifics(
82 csync::SyncChange::SyncChangeType change_type, 82 syncer::SyncChange::SyncChangeType change_type,
83 const sync_pb::ExtensionSettingSpecifics& specifics); 83 const sync_pb::ExtensionSettingSpecifics& specifics);
84 84
85 scoped_refptr<Internal> internal_; 85 scoped_refptr<Internal> internal_;
86 }; 86 };
87 87
88 typedef std::vector<SettingSyncData> SettingSyncDataList; 88 typedef std::vector<SettingSyncData> SettingSyncDataList;
89 89
90 } // namespace extensions 90 } // namespace extensions
91 91
92 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTING_SYNC_DATA_H_ 92 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTING_SYNC_DATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_sync_data_unittest.cc ('k') | chrome/browser/extensions/settings/setting_sync_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698