IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / renderer / notification_provider.h
blob8abafb1caf7d60a057843edc7d32e206e129e9d7
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_
6 #define CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_
8 #include "content/public/renderer/render_view_observer.h"
9 #include "content/renderer/active_notification_tracker.h"
10 #include "third_party/WebKit/public/web/WebNotification.h"
11 #include "third_party/WebKit/public/web/WebNotificationPresenter.h"
13 namespace blink {
14 class WebNotificationPermissionCallback;
17 namespace content {
18 class RenderViewImpl;
20 // NotificationProvider class is owned by the RenderView. Only
21 // to be used on the main thread.
22 class NotificationProvider : public RenderViewObserver,
23 public blink::WebNotificationPresenter {
24 public:
25 explicit NotificationProvider(RenderViewImpl* render_view);
26 virtual ~NotificationProvider();
28 private:
29 // RenderView::Observer implementation.
30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
32 // blink::WebNotificationPresenter interface.
33 virtual bool show(const blink::WebNotification& proxy);
34 virtual void cancel(const blink::WebNotification& proxy);
35 virtual void objectDestroyed(const blink::WebNotification& proxy);
36 virtual blink::WebNotificationPresenter::Permission checkPermission(
37 const blink::WebSecurityOrigin& origin);
38 virtual void requestPermission(const blink::WebSecurityOrigin& origin,
39 blink::WebNotificationPermissionCallback* callback);
41 // IPC handlers.
42 void OnDisplay(int id);
43 void OnError(int id, const blink::WebString& message);
44 void OnClose(int id, bool by_user);
45 void OnClick(int id);
46 void OnPermissionRequestComplete(int id);
47 void OnNavigate();
49 // A tracker object which manages the active notifications and the IDs
50 // that are used to refer to them over IPC.
51 ActiveNotificationTracker manager_;
53 DISALLOW_COPY_AND_ASSIGN(NotificationProvider);
56 } // namespace content
58 #endif // CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_