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

Unified Diff: chrome/browser/notifications/sync_notifier/synced_notification.cc

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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/sync_notifier/synced_notification.cc
diff --git a/chrome/browser/notifications/sync_notifier/synced_notification.cc b/chrome/browser/notifications/sync_notifier/synced_notification.cc
index cddced0d0dc35641cf3f0664cc7febacee87e3db..1b7d1c948e7497a2d4d4f1edb9e70d64afdc429e 100644
--- a/chrome/browser/notifications/sync_notifier/synced_notification.cc
+++ b/chrome/browser/notifications/sync_notifier/synced_notification.cc
@@ -120,8 +120,6 @@ bool SyncedNotification::AreAllBitmapsFetched() {
// dpi bitmap when appropriate.
void SyncedNotification::OnFetchComplete(const GURL url,
const SkBitmap* bitmap) {
- // TODO(petewil): Add timeout mechanism in case bitmaps take too long. Do we
- // already have one built into URLFetcher?
// Make sure we are on the thread we expect.
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
@@ -386,6 +384,27 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager,
return;
}
+// Display the notification if it has the specified app_id_name.
+void SyncedNotification::ShowIfNewlyEnabled(
+ NotificationUIManager* notification_manager,
+ ChromeNotifierService* notifier_service,
+ Profile* profile,
+ std::string app_id_name) {
+ if (app_id_name == GetAppId())
+ Show(notification_manager, notifier_service, profile);
+}
+
+// Remove the notification if it has the specified app_id_name.
+void SyncedNotification::HideIfNewlyRemoved(
+ NotificationUIManager* notification_manager,
+ ChromeNotifierService* notifier_service,
+ Profile* profile,
+ std::string app_id_name) {
+ if (app_id_name == GetAppId()) {
+ notification_manager->CancelById(GetKey());
+ }
+}
+
// This should detect even small changes in case the server updated the
// notification. We ignore the timestamp if other fields match.
bool SyncedNotification::EqualsIgnoringReadState(
@@ -746,14 +765,6 @@ std::string SyncedNotification::GetContainedNotificationMessage(
collapsed_info(index).simple_collapsed_layout().description();
}
-std::string SyncedNotification::GetSendingServiceId() const {
- // TODO(petewil): We are building a new protocol (a new sync datatype) to send
- // the service name and icon from the server. For now this method is
- // hardcoded to the name of our first service using synced notifications.
- // Once the new protocol is built, remove this hardcoding.
- return kFirstSyncedNotificationServiceId;
-}
-
const gfx::Image& SyncedNotification::GetAppIcon() const {
return app_icon_bitmap_;
}

Powered by Google App Engine
This is Rietveld 408576698