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

Side by Side Diff: chrome/browser/extensions/extension_settings_sync_data.h

Issue 7747043: WORK IN PROGRESS. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Small change Created 9 years, 4 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
(Empty)
1 // Copyright (c) 2011 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_SYNC_DATA_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_SYNC_DATA_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h"
12 #include "chrome/browser/sync/api/sync_data.h"
13 #include "chrome/browser/sync/api/sync_change.h"
14
15 // Container for data interpreted from sync data/changes. Safe and efficient
16 // to copy.
17 // XXX rename this to ExtensionSettingSyncData (*not plural*)
18 class ExtensionSettingsSyncData {
19 public:
20 // Creates from a sync change.
21 explicit ExtensionSettingsSyncData(const SyncChange& sync_change);
22
23 // Creates from sync data. change_type will be ACTION_INVALID.
24 explicit ExtensionSettingsSyncData(const SyncData& sync_data);
25
26 // Construct manually.
27 explicit ExtensionSettingsSyncData(
28 SyncChange::SyncChangeType change_type,
29 const std::string& extension_id,
30 const std::string& key,
31 // May be NULL. Ownership taken if not.
32 Value* value);
33
34 // Returns the type of the sync change; may be INVALID if this is not
35 // constructed from a SyncChange.
36 SyncChange::SyncChangeType change_type() const;
37
38 // Returns the extension id the setting is for.
39 const std::string& extension_id() const;
40
41 // Returns the settings key.
42 const std::string& key() const;
43
44 // Returns the value of the setting, possibly NULL.
45 // Ownership NOT given up.
46 const Value* value() const;
47
48 // Returns a string representation of the data.
49 std::string ToString() const;
50
51 private:
52 // Ref-counted container for the data.
53 class Internal : public base::RefCountedThreadSafe<Internal> {
54 public:
55 explicit Internal(
56 SyncChange::SyncChangeType change_type,
57 const std::string& extension_id,
58 const std::string& key,
59 Value* value);
60
61 SyncChange::SyncChangeType change_type_;
62 std::string extension_id_;
63 std::string key_;
64 scoped_ptr<Value> value_;
65
66 private:
67 friend class base::RefCountedThreadSafe<Internal>;
68 ~Internal();
69 DISALLOW_COPY_AND_ASSIGN(Internal);
70 };
71
72 scoped_refptr<Internal> internal_;
73 };
74
75 typedef std::vector<ExtensionSettingsSyncData> ExtensionSettingsSyncDataList;
76
77 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_SYNC_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698