Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / renderer / notification_provider.h
blobab49b073cfbf5ab4a6bb57d19d31bf0942fd7065
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_frame_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 content {
15 // NotificationProvider class is owned by the RenderFrame. Only to be used on
16 // the main thread.
17 class NotificationProvider : public RenderFrameObserver,
18 public blink::WebNotificationPresenter {
19 public:
20 explicit NotificationProvider(RenderFrame* render_frame);
21 virtual ~NotificationProvider();
23 private:
24 // RenderFrameObserver implementation.
25 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
27 // blink::WebNotificationPresenter interface.
28 virtual bool show(const blink::WebNotification& proxy);
29 virtual void cancel(const blink::WebNotification& proxy);
30 virtual void objectDestroyed(const blink::WebNotification& proxy);
31 virtual blink::WebNotificationPresenter::Permission checkPermission(
32 const blink::WebSecurityOrigin& origin);
34 // IPC handlers.
35 void OnDisplay(int id);
36 void OnError(int id);
37 void OnClose(int id, bool by_user);
38 void OnClick(int id);
39 void OnNavigate();
41 // A tracker object which manages the active notifications and the IDs
42 // that are used to refer to them over IPC.
43 ActiveNotificationTracker manager_;
45 DISALLOW_COPY_AND_ASSIGN(NotificationProvider);
48 } // namespace content
50 #endif // CONTENT_RENDERER_NOTIFICATION_PROVIDER_H_