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

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

Issue 10662035: [Sync] Put everything in sync/api into csync namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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_EXTENSION_SYNC_DATA_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/version.h" 11 #include "base/version.h"
12 #include "chrome/common/string_ordinal.h" 12 #include "chrome/common/string_ordinal.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "sync/api/sync_change.h" 14 #include "sync/api/sync_change.h"
15 15
16 namespace csync {
16 class SyncData; 17 class SyncData;
18 }
17 19
18 namespace sync_pb { 20 namespace sync_pb {
19 class ExtensionSpecifics; 21 class ExtensionSpecifics;
20 } 22 }
21 23
22 namespace extensions { 24 namespace extensions {
23 25
24 class Extension; 26 class Extension;
25 27
26 // A class that encapsulates the synced properties of an Extension. 28 // A class that encapsulates the synced properties of an Extension.
27 class ExtensionSyncData { 29 class ExtensionSyncData {
asargent_no_longer_on_chrome 2012/06/26 18:08:17 nit: double space
akalin 2012/06/26 20:28:28 Done.
28 public: 30 public:
29 ExtensionSyncData(); 31 ExtensionSyncData();
30 explicit ExtensionSyncData(const SyncData& sync_data); 32 explicit ExtensionSyncData(const csync::SyncData& sync_data);
31 explicit ExtensionSyncData(const SyncChange& sync_change); 33 explicit ExtensionSyncData(const csync::SyncChange& sync_change);
32 ExtensionSyncData(const Extension& extension, 34 ExtensionSyncData(const Extension& extension,
33 bool enabled, 35 bool enabled,
34 bool incognito_enabled); 36 bool incognito_enabled);
35 ~ExtensionSyncData(); 37 ~ExtensionSyncData();
36 38
37 // Retrieve sync data from this class. 39 // Retrieve sync data from this class.
38 SyncData GetSyncData() const; 40 csync::SyncData GetSyncData() const;
39 SyncChange GetSyncChange(SyncChange::SyncChangeType change_type) const; 41 csync::SyncChange GetSyncChange(
42 csync::SyncChange::SyncChangeType change_type) const;
40 43
41 // Convert an ExtensionSyncData back out to a sync structure. 44 // Convert an ExtensionSyncData back out to a sync structure.
asargent_no_longer_on_chrome 2012/06/26 18:08:17 nit: double space
akalin 2012/06/26 20:28:28 Done.
42 void PopulateExtensionSpecifics(sync_pb::ExtensionSpecifics* specifics) const; 45 void PopulateExtensionSpecifics(sync_pb::ExtensionSpecifics* specifics) const;
43 46
44 // Populate this class from sync inputs. 47 // Populate this class from sync inputs.
45 void PopulateFromExtensionSpecifics( 48 void PopulateFromExtensionSpecifics(
46 const sync_pb::ExtensionSpecifics& specifics); 49 const sync_pb::ExtensionSpecifics& specifics);
47 50
48 void set_uninstalled(bool uninstalled); 51 void set_uninstalled(bool uninstalled);
49 52
50 const std::string& id() const { return id_; } 53 const std::string& id() const { return id_; }
51 54
52 // Version-independent properties (i.e., used even when the 55 // Version-independent properties (i.e., used even when the
53 // version of the currently-installed extension doesn't match 56 // version of the currently-installed extension doesn't match
54 // |version|). 57 // |version|).
55 bool uninstalled() const { return uninstalled_; } 58 bool uninstalled() const { return uninstalled_; }
56 bool enabled() const { return enabled_; } 59 bool enabled() const { return enabled_; }
57 bool incognito_enabled() const { return incognito_enabled_; } 60 bool incognito_enabled() const { return incognito_enabled_; }
58 61
59 // Version-dependent properties (i.e., should be used only when the 62 // Version-dependent properties (i.e., should be used only when the
60 // version of the currenty-installed extension matches |version|). 63 // version of the currenty-installed extension matches |version|).
61 const Version& version() const { return version_; } 64 const Version& version() const { return version_; }
62 const GURL& update_url() const { return update_url_; } 65 const GURL& update_url() const { return update_url_; }
63 // Used only for debugging. 66 // Used only for debugging.
64 const std::string& name() const { return name_; } 67 const std::string& name() const { return name_; }
65 68
66 private: 69 private:
67 // Populate this class from sync inputs. 70 // Populate this class from sync inputs.
68 void PopulateFromSyncData(const SyncData& sync_data); 71 void PopulateFromSyncData(const csync::SyncData& sync_data);
69 72
70 std::string id_; 73 std::string id_;
71 bool uninstalled_; 74 bool uninstalled_;
72 bool enabled_; 75 bool enabled_;
73 bool incognito_enabled_; 76 bool incognito_enabled_;
74 Version version_; 77 Version version_;
75 GURL update_url_; 78 GURL update_url_;
76 std::string name_; 79 std::string name_;
77 }; 80 };
78 81
79 } // namespace extensions 82 } // namespace extensions
80 83
81 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ 84 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698