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

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

Issue 193773003: Turn on and use the AppInfo data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Turn on app info: fix windows build Created 6 years, 9 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 | Annotate | Revision Log
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 GURL GetDefaultDestinationUrl() const; 67 GURL GetDefaultDestinationUrl() const;
68 std::string GetButtonTitle(unsigned int which_button) const; 68 std::string GetButtonTitle(unsigned int which_button) const;
69 GURL GetButtonIconUrl(unsigned int which_button) const; 69 GURL GetButtonIconUrl(unsigned int which_button) const;
70 GURL GetButtonUrl(unsigned int which_button) const; 70 GURL GetButtonUrl(unsigned int which_button) const;
71 GURL GetProfilePictureUrl(unsigned int which_url) const; 71 GURL GetProfilePictureUrl(unsigned int which_url) const;
72 size_t GetProfilePictureCount() const; 72 size_t GetProfilePictureCount() const;
73 size_t GetNotificationCount() const; 73 size_t GetNotificationCount() const;
74 size_t GetButtonCount() const; 74 size_t GetButtonCount() const;
75 std::string GetContainedNotificationTitle(int index) const; 75 std::string GetContainedNotificationTitle(int index) const;
76 std::string GetContainedNotificationMessage(int index) const; 76 std::string GetContainedNotificationMessage(int index) const;
77 std::string GetSendingServiceId() const;
78 const gfx::Image& GetAppIcon() const; 77 const gfx::Image& GetAppIcon() const;
79 78
80 // Use this to prevent toasting a notification. 79 // Use this to prevent toasting a notification.
81 void SetToastState(bool toast_state); 80 void SetToastState(bool toast_state);
82 81
83 bool EqualsIgnoringReadState(const SyncedNotification& other) const; 82 bool EqualsIgnoringReadState(const SyncedNotification& other) const;
84 83
85 void NotificationHasBeenRead(); 84 void NotificationHasBeenRead();
86 void NotificationHasBeenDismissed(); 85 void NotificationHasBeenDismissed();
87 86
88 // Fill up the queue of bitmaps to fetch. 87 // Fill up the queue of bitmaps to fetch.
89 void QueueBitmapFetchJobs(NotificationUIManager* notification_manager, 88 void QueueBitmapFetchJobs(NotificationUIManager* notification_manager,
90 ChromeNotifierService* notifier_service, 89 ChromeNotifierService* notifier_service,
91 Profile* profile); 90 Profile* profile);
92 91
93 // Start the bitmap fetching. When it is complete, the callback 92 // Start the bitmap fetching. When it is complete, the callback
94 // will call Show(). 93 // will call Show().
95 void StartBitmapFetch(); 94 void StartBitmapFetch();
96 95
97 // Display the notification in the notification center 96 // Display the notification in the notification center
98 void Show(NotificationUIManager* notification_manager, 97 void Show(NotificationUIManager* notification_manager,
99 ChromeNotifierService* notifier_service, 98 ChromeNotifierService* notifier_service,
100 Profile* profile); 99 Profile* profile);
101 100
101 // Display the notification if it has the specified app_id_name.
102 void ShowIfNewlyEnabled(NotificationUIManager* notification_manager,
dewittj 2014/03/17 21:43:43 Can you explain why you sometimes use the stored N
Pete Williamson 2014/03/21 01:22:31 It was to make the code easier to test by putting
103 ChromeNotifierService* notifier_service,
dewittj 2014/03/17 21:43:43 Same.
Pete Williamson 2014/03/21 01:22:31 Done.
104 Profile* profile,
105 std::string app_id_name);
106
107 // Remove the notification if it has the specified app_id_name.
108 void HideIfNewlyRemoved(NotificationUIManager* notification_manager,
dewittj 2014/03/17 21:43:43 Wouldn't this be better named HideAllForAppID?
Pete Williamson 2014/03/21 01:22:31 Done (also renamed ShowIfNewlyEnabled -> ShowAllFo
109 ChromeNotifierService* notifier_service,
dewittj 2014/03/17 21:43:43 Argument unused, please remove.
Pete Williamson 2014/03/21 01:22:31 Done.
110 Profile* profile,
dewittj 2014/03/17 21:43:43 Same.
Pete Williamson 2014/03/21 01:22:31 Done.
111 std::string app_id_name);
112
102 // This gets a pointer to the SyncedNotificationSpecifics part 113 // This gets a pointer to the SyncedNotificationSpecifics part
103 // of the sync data. 114 // of the sync data.
104 sync_pb::EntitySpecifics GetEntitySpecifics() const; 115 sync_pb::EntitySpecifics GetEntitySpecifics() const;
105 116
106 // Write a notification to the console log. 117 // Write a notification to the console log.
107 void LogNotification(); 118 void LogNotification();
108 119
109 private: 120 private:
110 // Helper function to mark a notification as read or dismissed. 121 // Helper function to mark a notification as read or dismissed.
111 void SetReadState(const ReadState& read_state); 122 void SetReadState(const ReadState& read_state);
(...skipping 15 matching lines...) Expand all
127 ScopedVector<chrome::BitmapFetcher> fetchers_; 138 ScopedVector<chrome::BitmapFetcher> fetchers_;
128 gfx::Image app_icon_bitmap_; 139 gfx::Image app_icon_bitmap_;
129 gfx::Image sender_bitmap_; 140 gfx::Image sender_bitmap_;
130 gfx::Image image_bitmap_; 141 gfx::Image image_bitmap_;
131 std::vector<gfx::Image> button_bitmaps_; 142 std::vector<gfx::Image> button_bitmaps_;
132 bool app_icon_bitmap_fetch_pending_; 143 bool app_icon_bitmap_fetch_pending_;
133 bool sender_bitmap_fetch_pending_; 144 bool sender_bitmap_fetch_pending_;
134 bool image_bitmap_fetch_pending_; 145 bool image_bitmap_fetch_pending_;
135 std::vector<bool> button_bitmaps_fetch_pending_; 146 std::vector<bool> button_bitmaps_fetch_pending_;
136 147
137
138 friend class SyncedNotificationTest; 148 friend class SyncedNotificationTest;
139 149
140 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, AddBitmapToFetchQueueTest); 150 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, AddBitmapToFetchQueueTest);
141 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, OnFetchCompleteTest); 151 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, OnFetchCompleteTest);
142 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, QueueBitmapFetchJobsTest); 152 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, QueueBitmapFetchJobsTest);
143 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, EmptyBitmapTest); 153 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, EmptyBitmapTest);
154 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, ShowIfNewlyEnabledTest);
155 FRIEND_TEST_ALL_PREFIXES(SyncedNotificationTest, HideIfNewlyRemovedTest);
144 156
145 DISALLOW_COPY_AND_ASSIGN(SyncedNotification); 157 DISALLOW_COPY_AND_ASSIGN(SyncedNotification);
146 }; 158 };
147 159
148 } // namespace notifier 160 } // namespace notifier
149 161
150 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_ 162 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698