Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / notifications / persistent_notification_delegate.h
blobd32b0cc613d26b21392c20149ab4190be417dcc5
1 // Copyright 2014 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 CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_
8 #include <stdint.h>
9 #include <string>
11 #include "base/macros.h"
12 #include "chrome/browser/notifications/notification_delegate.h"
13 #include "url/gurl.h"
15 namespace content {
16 class BrowserContext;
19 // Delegate responsible for listening to the click event on persistent
20 // notifications, to forward them to the PlatformNotificationService so that
21 // JavaScript events can be fired on the associated Service Worker.
22 class PersistentNotificationDelegate : public NotificationDelegate {
23 public:
24 PersistentNotificationDelegate(content::BrowserContext* browser_context,
25 int64_t persistent_notification_id,
26 const GURL& origin,
27 int notification_settings_index);
29 // Persistent id of this notification in the notification database. To be
30 // used when retrieving all information associated with it.
31 int64_t persistent_notification_id() const {
32 return persistent_notification_id_;
35 // NotificationDelegate implementation.
36 void Display() override;
37 void Close(bool by_user) override;
38 void Click() override;
39 void ButtonClick(int button_index) override;
40 std::string id() const override;
42 protected:
43 ~PersistentNotificationDelegate() override;
45 private:
46 content::BrowserContext* browser_context_;
47 int64_t persistent_notification_id_;
48 GURL origin_;
49 std::string id_;
50 int notification_settings_index_;
52 DISALLOW_COPY_AND_ASSIGN(PersistentNotificationDelegate);
55 #endif // CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_