ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / extensions / app_sync_data.h
blobbdbb1641f3608d4491f87f45eb4b24bc7743e3dd
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 "extensions/common/constants.h"
10 #include "sync/api/string_ordinal.h"
11 #include "sync/api/sync_change.h"
12 #include "third_party/skia/include/core/SkColor.h"
14 namespace syncer {
15 class SyncData;
18 namespace sync_pb {
19 class AppSpecifics;
22 namespace extensions {
24 class Extension;
25 class ExtensionSyncData;
27 // A class that encapsulates the synced properties of an Application.
28 class AppSyncData {
29 public:
30 AppSyncData();
31 explicit AppSyncData(const syncer::SyncData& sync_data);
32 explicit AppSyncData(const syncer::SyncChange& sync_change);
33 AppSyncData(const Extension& extension,
34 bool enabled,
35 bool incognito_enabled,
36 bool remote_install,
37 ExtensionSyncData::OptionalBoolean all_urls_enabled,
38 const syncer::StringOrdinal& app_launch_ordinal,
39 const syncer::StringOrdinal& page_ordinal,
40 extensions::LaunchType launch_type);
41 ~AppSyncData();
43 // Retrive sync data from this class.
44 syncer::SyncData GetSyncData() const;
45 syncer::SyncChange GetSyncChange(
46 syncer::SyncChange::SyncChangeType change_type) const;
48 const std::string& id() const { return extension_sync_data_.id(); }
50 bool uninstalled() const { return extension_sync_data_.uninstalled(); }
52 // These ordinals aren't necessarily valid. Some applications don't have
53 // valid ordinals because they don't appear on the new tab page.
54 const syncer::StringOrdinal& app_launch_ordinal() const {
55 return app_launch_ordinal_;
57 const syncer::StringOrdinal& page_ordinal() const { return page_ordinal_; }
59 const ExtensionSyncData& extension_sync_data() const {
60 return extension_sync_data_;
63 extensions::LaunchType launch_type() const {
64 return launch_type_;
67 const std::string& bookmark_app_url() const {
68 return bookmark_app_url_;
71 const std::string& bookmark_app_description() const {
72 return bookmark_app_description_;
75 const std::string& bookmark_app_icon_color() const {
76 return bookmark_app_icon_color_;
79 private:
80 // Convert an AppSyncData back out to a sync structure.
81 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const;
83 // Populate this class from sync inputs.
84 void PopulateFromAppSpecifics(
85 const sync_pb::AppSpecifics& specifics);
86 void PopulateFromSyncData(const syncer::SyncData& sync_data);
88 ExtensionSyncData extension_sync_data_;
89 syncer::StringOrdinal app_launch_ordinal_;
90 syncer::StringOrdinal page_ordinal_;
91 extensions::LaunchType launch_type_;
92 std::string bookmark_app_url_;
93 std::string bookmark_app_description_;
94 std::string bookmark_app_icon_color_;
97 } // namespace extensions
99 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_