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

Side by Side Diff: chrome/browser/notifications/sync_notifier/synced_notification.h

Issue 12717010: Widen Data Pipes and newer protobufs (Closed) Base URL: http://git.chromium.org/chromium/src.git@newProtobufs
Patch Set: Synced Notifications newer protobufs - fix mac and linux unit tests Created 7 years, 8 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
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 // 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 16 matching lines...) Expand all
27 explicit SyncedNotification(const syncer::SyncData& sync_data); 27 explicit SyncedNotification(const syncer::SyncData& sync_data);
28 28
29 ~SyncedNotification(); 29 ~SyncedNotification();
30 30
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 static const int kUndefinedPriority = 65535;
38
37 void Update(const syncer::SyncData& sync_data); 39 void Update(const syncer::SyncData& sync_data);
38 40
39 // Here are some helper functions to get individual data parts out of a 41 // Here are some helper functions to get individual data parts out of a
40 // SyncedNotification. 42 // SyncedNotification.
41 // TODO(petewil): Add more types as we expand support for the protobuf. 43 std::string GetTitle() const;
42 std::string title() const; 44 std::string GetHeading() const;
43 std::string heading() const; 45 std::string GetDescription() const;
44 std::string description() const; 46 std::string GetAppId() const;
45 std::string app_id() const; 47 std::string GetKey() const;
46 std::string key() const; 48 GURL GetOriginUrl() const;
47 GURL origin_url() const; 49 GURL GetAppIconUrl() const;
48 GURL app_icon_url() const; 50 GURL GetImageUrl() const;
49 GURL image_url() const; 51 std::string GetText() const;
50 std::string first_external_id() const; 52 ReadState GetReadState() const;
51 std::string notification_id() const; 53 uint64 GetCreationTime() const;
52 std::string text() const; 54 int GetPriority() const;
53 ReadState read_state() const; 55 std::string GetDefaultDestinationTitle() const;
56 std::string GetDefaultDestinationIconUrl() const;
57 std::string GetDefaultDestinationUrl() const;
58 std::string GetButtonOneTitle() const;
59 std::string GetButtonOneIconUrl() const;
60 std::string GetButtonOneUrl() const;
61 std::string GetButtonTwoTitle() const;
62 std::string GetButtonTwoIconUrl() const;
63 std::string GetButtonTwoUrl() const;
64 int GetNotificationCount() const;
65 int GetButtonCount() const;
66 std::string GetContainedNotificationTitle(int index) const;
67 std::string GetContainedNotificationMessage(int index) const;
68
54 69
55 bool EqualsIgnoringReadState(const SyncedNotification& other) const; 70 bool EqualsIgnoringReadState(const SyncedNotification& other) const;
56 bool IdMatches(const SyncedNotification& other) const;
57 71
58 void NotificationHasBeenRead();
59 void NotificationHasBeenDismissed(); 72 void NotificationHasBeenDismissed();
60 73
61 // This gets a pointer to the SyncedNotificationSpecifics part 74 // This gets a pointer to the SyncedNotificationSpecifics part
62 // of the sync data. 75 // of the sync data.
63 sync_pb::EntitySpecifics GetEntitySpecifics() const; 76 sync_pb::EntitySpecifics GetEntitySpecifics() const;
64 77
65 private: 78 private:
66 // Helper function to mark a notification as read or dismissed. 79 // Helper function to mark a notification as read or dismissed.
67 void SetReadState(const ReadState& read_state); 80 void SetReadState(const ReadState& read_state);
68 81
69 // Parsing functions to get this information out of the sync_data and into 82 // Parsing functions to get this information out of the sync_data and into
70 // our local variables. 83 // 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 84
84 sync_pb::SyncedNotificationSpecifics specifics_; 85 sync_pb::SyncedNotificationSpecifics specifics_;
85 86
86 DISALLOW_COPY_AND_ASSIGN(SyncedNotification); 87 DISALLOW_COPY_AND_ASSIGN(SyncedNotification);
87 }; 88 };
88 89
89 } // namespace notifier 90 } // namespace notifier
90 91
91 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_ 92 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698