Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // This class represents the data for a single Synced Notification. | 5 // This class represents the data for a single Synced Notification. |
| 6 // It should map 1-1 to all the data in synced_notification_sepcifics.proto, | 6 // It should map 1-1 to all the data in synced_notification_sepcifics.proto, |
| 7 // and the data and render protobufs that the specifics protobuf contains. | 7 // and the data and render protobufs that the specifics protobuf contains. |
| 8 | 8 |
| 9 #ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_ | 9 #ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_ |
| 10 #define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_ | 10 #define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_ |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 enum ReadState { | 31 enum ReadState { |
| 32 kUnread = 1, | 32 kUnread = 1, |
| 33 kRead = 2, | 33 kRead = 2, |
| 34 kDismissed = 3, | 34 kDismissed = 3, |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 void Update(const syncer::SyncData& sync_data); | 37 void Update(const syncer::SyncData& sync_data); |
| 38 | 38 |
| 39 // Here are some helper functions to get individual data parts out of a | 39 // Here are some helper functions to get individual data parts out of a |
| 40 // SyncedNotification. | 40 // SyncedNotification. |
| 41 // TODO(petewil): Add more types as we expand support for the protobuf. | 41 std::string GetTitle() const; |
| 42 std::string title() const; | 42 std::string GetHeading() const; |
| 43 std::string heading() const; | 43 std::string GetDescription() const; |
| 44 std::string description() const; | 44 std::string GetAppId() const; |
| 45 std::string app_id() const; | 45 std::string GetKey() const; |
| 46 std::string key() const; | 46 GURL GetOriginUrl() const; |
| 47 GURL origin_url() const; | 47 GURL GetAppIconUrl() const; |
| 48 GURL app_icon_url() const; | 48 GURL GetImageUrl() const; |
| 49 GURL image_url() const; | 49 std::string GetText() const; |
| 50 std::string first_external_id() const; | 50 ReadState GetReadState() const; |
| 51 std::string notification_id() const; | 51 uint64 GetCreationTime() const; |
| 52 std::string text() const; | 52 int GetPriority() const; |
| 53 ReadState read_state() const; | 53 std::string GetDefaultDestinationTitle() const; |
| 54 std::string GetDefaultDestinationIconUrl() const; | |
| 55 std::string GetDefaultDestinationUrl() const; | |
| 56 std::string GetButtonOneTitle() const; | |
|
miket_OOO
2013/03/28 01:03:52
Same comments as before on array vs. fixed-size fi
Pete Williamson
2013/03/28 17:16:12
Same answer, let's fix both this and the API in an
| |
| 57 std::string GetButtonOneIconUrl() const; | |
| 58 std::string GetButtonOneUrl() const; | |
| 59 std::string GetButtonTwoTitle() const; | |
| 60 std::string GetButtonTwoIconUrl() const; | |
| 61 std::string GetButtonTwoUrl() const; | |
| 62 int GetNotificationCount() const; | |
| 63 int GetButtonCount() const; | |
| 64 std::string GetContainedNotificationTitle(int index) const; | |
| 65 std::string GetContainedNotificationMessage(int index) const; | |
| 66 | |
| 54 | 67 |
| 55 bool EqualsIgnoringReadState(const SyncedNotification& other) const; | 68 bool EqualsIgnoringReadState(const SyncedNotification& other) const; |
| 56 bool IdMatches(const SyncedNotification& other) const; | |
| 57 | 69 |
| 58 void NotificationHasBeenRead(); | |
| 59 void NotificationHasBeenDismissed(); | 70 void NotificationHasBeenDismissed(); |
| 60 | 71 |
| 61 // This gets a pointer to the SyncedNotificationSpecifics part | 72 // This gets a pointer to the SyncedNotificationSpecifics part |
| 62 // of the sync data. | 73 // of the sync data. |
| 63 sync_pb::EntitySpecifics GetEntitySpecifics() const; | 74 sync_pb::EntitySpecifics GetEntitySpecifics() const; |
| 64 | 75 |
| 65 private: | 76 private: |
| 66 // Helper function to mark a notification as read or dismissed. | 77 // Helper function to mark a notification as read or dismissed. |
| 67 void SetReadState(const ReadState& read_state); | 78 void SetReadState(const ReadState& read_state); |
| 68 | 79 |
| 69 // Parsing functions to get this information out of the sync_data and into | 80 // Parsing functions to get this information out of the sync_data and into |
| 70 // our local variables. | 81 // our local variables. |
| 71 std::string ExtractTitle() const; | |
| 72 std::string ExtractHeading() const; | |
| 73 std::string ExtractDescription() const; | |
| 74 std::string ExtractAppId() const; | |
| 75 std::string ExtractKey() const; | |
| 76 GURL ExtractOriginUrl() const; | |
| 77 GURL ExtractAppIconUrl() const; | |
| 78 GURL ExtractImageUrl() const; | |
| 79 std::string ExtractFirstExternalId() const; | |
| 80 std::string ExtractNotificationId() const; | |
| 81 std::string ExtractText() const; | |
| 82 ReadState ExtractReadState() const; | |
| 83 | 82 |
| 84 sync_pb::SyncedNotificationSpecifics specifics_; | 83 sync_pb::SyncedNotificationSpecifics specifics_; |
| 85 | 84 |
| 86 DISALLOW_COPY_AND_ASSIGN(SyncedNotification); | 85 DISALLOW_COPY_AND_ASSIGN(SyncedNotification); |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 } // namespace notifier | 88 } // namespace notifier |
| 90 | 89 |
| 91 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_ | 90 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_ |
| OLD | NEW |