| 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 #ifndef CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_ | 5 #ifndef CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_ |
| 6 #define CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_ | 6 #define CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "content/public/renderer/render_frame_observer.h" | 9 #include "content/public/renderer/render_frame_observer.h" |
| 10 #include "content/renderer/active_notification_tracker.h" | 10 #include "content/renderer/active_notification_tracker.h" |
| 11 #include "third_party/WebKit/public/web/WebNotification.h" | 11 #include "third_party/WebKit/public/web/WebNotification.h" |
| 12 #include "third_party/WebKit/public/web/WebNotificationPresenter.h" | 12 #include "third_party/WebKit/public/web/WebNotificationPresenter.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 class NotificationIconLoader; | 18 class NotificationIconLoader; |
| 19 | 19 |
| 20 // NotificationProvider class is owned by the RenderFrame. Only to be used on | 20 // NotificationProvider class is owned by the RenderFrame. Only to be used on |
| 21 // the main thread. | 21 // the main thread. |
| 22 class NotificationProvider : public RenderFrameObserver, | 22 class NotificationProvider : public RenderFrameObserver, |
| 23 public blink::WebNotificationPresenter { | 23 public blink::WebNotificationPresenter { |
| 24 public: | 24 public: |
| 25 explicit NotificationProvider(RenderFrame* render_frame); | 25 explicit NotificationProvider(RenderFrame* render_frame); |
| 26 virtual ~NotificationProvider(); | 26 ~NotificationProvider() override; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // RenderFrameObserver implementation. | 29 // RenderFrameObserver implementation. |
| 30 virtual bool OnMessageReceived(const IPC::Message& message) override; | 30 bool OnMessageReceived(const IPC::Message& message) override; |
| 31 | 31 |
| 32 // blink::WebNotificationPresenter implementation. | 32 // blink::WebNotificationPresenter implementation. |
| 33 virtual bool show(const blink::WebNotification& proxy); | 33 virtual bool show(const blink::WebNotification& proxy); |
| 34 virtual void cancel(const blink::WebNotification& proxy); | 34 virtual void cancel(const blink::WebNotification& proxy); |
| 35 virtual void objectDestroyed(const blink::WebNotification& proxy); | 35 virtual void objectDestroyed(const blink::WebNotification& proxy); |
| 36 virtual blink::WebNotificationPresenter::Permission checkPermission( | 36 virtual blink::WebNotificationPresenter::Permission checkPermission( |
| 37 const blink::WebSecurityOrigin& origin); | 37 const blink::WebSecurityOrigin& origin); |
| 38 | 38 |
| 39 // Sends an IPC to the browser process to display the notification identified | 39 // Sends an IPC to the browser process to display the notification identified |
| 40 // by |notification|, accompanied by the downloaded icon. | 40 // by |notification|, accompanied by the downloaded icon. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 58 // A tracker object which manages the active notifications and the IDs | 58 // A tracker object which manages the active notifications and the IDs |
| 59 // that are used to refer to them over IPC. | 59 // that are used to refer to them over IPC. |
| 60 ActiveNotificationTracker manager_; | 60 ActiveNotificationTracker manager_; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(NotificationProvider); | 62 DISALLOW_COPY_AND_ASSIGN(NotificationProvider); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace content | 65 } // namespace content |
| 66 | 66 |
| 67 #endif // CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_ | 67 #endif // CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_ |
| OLD | NEW |