Index: content/renderer/notification_provider.h |
diff --git a/content/renderer/notification_provider.h b/content/renderer/notification_provider.h |
index 44b913ba5e31c7b0d49a888ecb76f2086b681294..ea31a608b33a9dd0aa609aabf11d48c0e1d3e0b1 100644 |
--- a/content/renderer/notification_provider.h |
+++ b/content/renderer/notification_provider.h |
@@ -5,13 +5,18 @@ |
#ifndef CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_ |
#define CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_ |
+#include "base/memory/scoped_vector.h" |
#include "content/public/renderer/render_frame_observer.h" |
#include "content/renderer/active_notification_tracker.h" |
#include "third_party/WebKit/public/web/WebNotification.h" |
#include "third_party/WebKit/public/web/WebNotificationPresenter.h" |
+class SkBitmap; |
+ |
namespace content { |
+class NotificationIconLoader; |
+ |
// NotificationProvider class is owned by the RenderFrame. Only to be used on |
// the main thread. |
class NotificationProvider : public RenderFrameObserver, |
@@ -24,13 +29,21 @@ class NotificationProvider : public RenderFrameObserver, |
// RenderFrameObserver implementation. |
virtual bool OnMessageReceived(const IPC::Message& message) override; |
- // blink::WebNotificationPresenter interface. |
+ // blink::WebNotificationPresenter implementation. |
virtual bool show(const blink::WebNotification& proxy); |
virtual void cancel(const blink::WebNotification& proxy); |
virtual void objectDestroyed(const blink::WebNotification& proxy); |
virtual blink::WebNotificationPresenter::Permission checkPermission( |
const blink::WebSecurityOrigin& origin); |
+ // Sends an IPC to the browser process to display the notification identified |
+ // by |notification|, accompanied by the downloaded icon. |
+ void DisplayNotification(int notification_id, const SkBitmap& icon); |
+ |
+ // Removes the IconDownload object associated with |notification_id|, stopping |
+ // any in-progress download. Returns whether the notification was removed. |
+ bool RemovePendingNotification(int notification_id); |
+ |
// IPC handlers. |
void OnDisplay(int id); |
void OnError(int id); |
@@ -38,6 +51,10 @@ class NotificationProvider : public RenderFrameObserver, |
void OnClick(int id); |
void OnNavigate(); |
+ // A vector tracking notifications whose icon is still being downloaded. |
+ typedef ScopedVector<NotificationIconLoader> PendingNotifications; |
+ PendingNotifications pending_notifications_; |
+ |
// A tracker object which manages the active notifications and the IDs |
// that are used to refer to them over IPC. |
ActiveNotificationTracker manager_; |