NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / extensions / app_sync_data.h
blob2e34460a19247b835f69e6b995cc96fba2cadb8f
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_
6 #define CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_
8 #include "chrome/browser/extensions/extension_sync_data.h"
9 #include "chrome/common/extensions/extension_constants.h"
10 #include "sync/api/string_ordinal.h"
11 #include "sync/api/sync_change.h"
13 namespace syncer {
14 class SyncData;
17 namespace sync_pb {
18 class AppSpecifics;
21 namespace extensions {
23 class Extension;
24 class ExtensionSyncData;
26 // A class that encapsulates the synced properties of an Application.
27 class AppSyncData {
28 public:
29 AppSyncData();
30 explicit AppSyncData(const syncer::SyncData& sync_data);
31 explicit AppSyncData(const syncer::SyncChange& sync_change);
32 AppSyncData(const Extension& extension,
33 bool enabled,
34 bool incognito_enabled,
35 const syncer::StringOrdinal& app_launch_ordinal,
36 const syncer::StringOrdinal& page_ordinal,
37 extensions::LaunchType launch_type);
38 ~AppSyncData();
40 // Retrive sync data from this class.
41 syncer::SyncData GetSyncData() const;
42 syncer::SyncChange GetSyncChange(
43 syncer::SyncChange::SyncChangeType change_type) const;
45 const std::string& id() const { return extension_sync_data_.id(); }
47 bool uninstalled() const { return extension_sync_data_.uninstalled(); }
49 // These ordinals aren't necessarily valid. Some applications don't have
50 // valid ordinals because they don't appear on the new tab page.
51 const syncer::StringOrdinal& app_launch_ordinal() const {
52 return app_launch_ordinal_;
54 const syncer::StringOrdinal& page_ordinal() const { return page_ordinal_; }
56 const ExtensionSyncData& extension_sync_data() const {
57 return extension_sync_data_;
60 extensions::LaunchType launch_type() const {
61 return launch_type_;
64 private:
65 // Convert an AppSyncData back out to a sync structure.
66 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const;
68 // Populate this class from sync inputs.
69 void PopulateFromAppSpecifics(
70 const sync_pb::AppSpecifics& specifics);
71 void PopulateFromSyncData(const syncer::SyncData& sync_data);
73 ExtensionSyncData extension_sync_data_;
74 syncer::StringOrdinal app_launch_ordinal_;
75 syncer::StringOrdinal page_ordinal_;
76 extensions::LaunchType launch_type_;
79 } // namespace extensions
81 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_