Index: chrome/browser/notifier/synced_notification.h |
diff --git a/chrome/browser/notifier/synced_notification.h b/chrome/browser/notifier/synced_notification.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ec2e33c6b1c3e9cf7708b96cabc2bf188addb073 |
--- /dev/null |
+++ b/chrome/browser/notifier/synced_notification.h |
@@ -0,0 +1,74 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// This class represents the data for a single Synced Notification. |
+// It should map 1-1 to all the data in synced_notification_sepcifics.proto, |
+// and the data and render protobufs that the specifics protobuf contains. |
+ |
+#ifndef CHROME_BROWSER_NOTIFIER_SYNCED_NOTIFICATION_H_ |
+#define CHROME_BROWSER_NOTIFIER_SYNCED_NOTIFICATION_H_ |
+ |
+#include "googleurl/src/gurl.h" |
+#include "sync/api/sync_data.h" |
+#include "sync/protocol/sync.pb.h" |
+#include "sync/protocol/synced_notification_specifics.pb.h" |
+ |
+namespace notifier { |
+ |
+class SyncedNotification { |
+ public: |
+ explicit SyncedNotification(const syncer::SyncData& sync_data); |
+ |
+ ~SyncedNotification(); |
+ |
+ // Here are some helper functions to get individual data parts out of a |
+ // syncedNotification protobuf. |
+ std::string GetTitle() const; |
+ std::string GetAppId() const; |
+ std::string GetCoalescingKey() const; |
+ GURL GetOriginUrl() const; |
+ GURL GetIconUrl() const; |
+ std::string GetFirstExternalId() const; |
+ std::string GetNotificationId() const; |
+ std::string GetBody() const; |
+ |
+ bool Equals(const SyncedNotification& other) const; |
+ |
+ void set_has_local_changes(bool has_local_changes) { |
+ has_local_changes_ = has_local_changes; |
+ } |
+ |
+ bool has_local_changes() const { |
+ return has_local_changes_; |
+ } |
+ |
+ syncer::SyncData* mutable_sync_data() { |
+ return &sync_data_; |
+ } |
+ |
+ void NotificationHasBeenRead(); |
+ |
+ void NotificationHasBeenDeleted(); |
+ |
+ // This gets a pointer to the SyncedNotificationSpecifics part |
+ // of the sync data. This is owned by the SyncedNotification class |
+ // (actually refcounted, so it is jointly owned with sync). |
+ // Don't free this pointer! |
+ const sync_pb::SyncedNotificationSpecifics* GetSyncedNotificationSpecifics(); |
+ |
+ private: |
+ // helper function to mark a notification as read or dismissed. |
+ bool SetReadState( |
+ sync_pb::SyncedNotificationCoalesced_ReadState readState); |
+ syncer::SyncData sync_data_; |
+ // Set this to true if we make any changes to the client data. |
+ bool has_local_changes_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SyncedNotification); |
+}; |
+ |
dcheng
2013/01/23 18:39:43
Extra newlines.
Pete Williamson
2013/01/24 01:48:11
Done.
|
+ |
+} // namespace notifier |
+ |
+#endif // CHROME_BROWSER_NOTIFIER_SYNCED_NOTIFICATION_H_ |