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

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

Issue 10920017: [Sync] Generalize StringOrdinal to handle ordinal_in_parent field (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Relax tests Created 8 years, 3 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_APP_SYNC_DATA_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_
6 #define CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ 6 #define CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_
7 7
8 #include "chrome/browser/extensions/extension_sync_data.h" 8 #include "chrome/browser/extensions/extension_sync_data.h"
9 #include "chrome/common/string_ordinal.h" 9 #include "sync/api/string_ordinal.h"
10 #include "sync/api/sync_change.h" 10 #include "sync/api/sync_change.h"
11 11
12 namespace syncer { 12 namespace syncer {
13 class SyncData; 13 class SyncData;
14 } 14 }
15 15
16 namespace sync_pb { 16 namespace sync_pb {
17 class AppSpecifics; 17 class AppSpecifics;
18 } 18 }
19 19
20 namespace extensions { 20 namespace extensions {
21 21
22 class Extension; 22 class Extension;
23 class ExtensionSyncData; 23 class ExtensionSyncData;
24 24
25 // A class that encapsulates the synced properties of an Application. 25 // A class that encapsulates the synced properties of an Application.
26 class AppSyncData { 26 class AppSyncData {
27 public: 27 public:
28 AppSyncData(); 28 AppSyncData();
29 explicit AppSyncData(const syncer::SyncData& sync_data); 29 explicit AppSyncData(const syncer::SyncData& sync_data);
30 explicit AppSyncData(const syncer::SyncChange& sync_change); 30 explicit AppSyncData(const syncer::SyncChange& sync_change);
31 AppSyncData(const Extension& extension, 31 AppSyncData(const Extension& extension,
32 bool enabled, 32 bool enabled,
33 bool incognito_enabled, 33 bool incognito_enabled,
34 const std::string& notifications_client_id, 34 const std::string& notifications_client_id,
35 bool notifications_disabled, 35 bool notifications_disabled,
36 const StringOrdinal& app_launch_ordinal, 36 const syncer::StringOrdinal& app_launch_ordinal,
37 const StringOrdinal& page_ordinal); 37 const syncer::StringOrdinal& page_ordinal);
38 ~AppSyncData(); 38 ~AppSyncData();
39 39
40 // Retrive sync data from this class. 40 // Retrive sync data from this class.
41 syncer::SyncData GetSyncData() const; 41 syncer::SyncData GetSyncData() const;
42 syncer::SyncChange GetSyncChange( 42 syncer::SyncChange GetSyncChange(
43 syncer::SyncChange::SyncChangeType change_type) const; 43 syncer::SyncChange::SyncChangeType change_type) const;
44 44
45 const std::string& id() const { return extension_sync_data_.id(); } 45 const std::string& id() const { return extension_sync_data_.id(); }
46 46
47 bool uninstalled() const { return extension_sync_data_.uninstalled(); } 47 bool uninstalled() const { return extension_sync_data_.uninstalled(); }
48 48
49 const std::string& notifications_client_id() const { 49 const std::string& notifications_client_id() const {
50 return notifications_client_id_; 50 return notifications_client_id_;
51 } 51 }
52 52
53 bool notifications_disabled() const { 53 bool notifications_disabled() const {
54 return notifications_disabled_; 54 return notifications_disabled_;
55 } 55 }
56 56
57 // These ordinals aren't necessarily valid. Some applications don't have 57 // These ordinals aren't necessarily valid. Some applications don't have
58 // valid ordinals because they don't appear on the new tab page. 58 // valid ordinals because they don't appear on the new tab page.
59 const StringOrdinal& app_launch_ordinal() const { 59 const syncer::StringOrdinal& app_launch_ordinal() const {
60 return app_launch_ordinal_; 60 return app_launch_ordinal_;
61 } 61 }
62 const StringOrdinal& page_ordinal() const { return page_ordinal_; } 62 const syncer::StringOrdinal& page_ordinal() const { return page_ordinal_; }
63 63
64 const ExtensionSyncData& extension_sync_data() const { 64 const ExtensionSyncData& extension_sync_data() const {
65 return extension_sync_data_; 65 return extension_sync_data_;
66 } 66 }
67 67
68 private: 68 private:
69 // Convert an AppSyncData back out to a sync structure. 69 // Convert an AppSyncData back out to a sync structure.
70 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; 70 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const;
71 71
72 // Populate this class from sync inputs. 72 // Populate this class from sync inputs.
73 void PopulateFromAppSpecifics( 73 void PopulateFromAppSpecifics(
74 const sync_pb::AppSpecifics& specifics); 74 const sync_pb::AppSpecifics& specifics);
75 void PopulateFromSyncData(const syncer::SyncData& sync_data); 75 void PopulateFromSyncData(const syncer::SyncData& sync_data);
76 76
77 ExtensionSyncData extension_sync_data_; 77 ExtensionSyncData extension_sync_data_;
78 std::string notifications_client_id_; 78 std::string notifications_client_id_;
79 bool notifications_disabled_; 79 bool notifications_disabled_;
80 StringOrdinal app_launch_ordinal_; 80 syncer::StringOrdinal app_launch_ordinal_;
81 StringOrdinal page_ordinal_; 81 syncer::StringOrdinal page_ordinal_;
82 }; 82 };
83 83
84 } // namespace extensions 84 } // namespace extensions
85 85
86 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ 86 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_process_apitest.cc ('k') | chrome/browser/extensions/app_sync_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698