miguelg | 3cc06ec | 2016-06-30 09:14:09 | [diff] [blame] | 1 | // Copyright 2016 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. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_COMMON_H_ |
| 6 | #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_COMMON_H_ |
| 7 | |
miguelg | 30dfc2e | 2017-06-14 18:18:09 | [diff] [blame] | 8 | #include "base/feature_list.h" |
Peter Beverloo | 6dba2e10 | 2017-11-23 17:46:33 | [diff] [blame^] | 9 | #include "chrome/browser/notifications/notification_handler.h" |
Evan Stade | 4ebefdf4 | 2017-09-21 23:50:18 | [diff] [blame] | 10 | #include "url/gurl.h" |
miguelg | 30dfc2e | 2017-06-14 18:18:09 | [diff] [blame] | 11 | |
miguelg | 3cc06ec | 2016-06-30 09:14:09 | [diff] [blame] | 12 | namespace content { |
| 13 | class BrowserContext; |
| 14 | } // namespace content |
| 15 | |
miguelg | 30dfc2e | 2017-06-14 18:18:09 | [diff] [blame] | 16 | class GURL; |
| 17 | class Profile; |
| 18 | |
miguelg | 3cc06ec | 2016-06-30 09:14:09 | [diff] [blame] | 19 | // Shared functionality for both in page and persistent notification |
| 20 | class NotificationCommon { |
| 21 | public: |
| 22 | // Things as user can do to a notification. |
peter | 28d8b73 | 2017-04-11 17:36:17 | [diff] [blame] | 23 | // TODO(peter): Prefix these options with OPERATION_. |
miguelg | 3cc06ec | 2016-06-30 09:14:09 | [diff] [blame] | 24 | enum Operation { |
| 25 | CLICK = 0, |
| 26 | CLOSE = 1, |
miguelg | 4ca5df8 | 2016-07-04 16:08:36 | [diff] [blame] | 27 | SETTINGS = 2, |
| 28 | OPERATION_MAX = SETTINGS |
miguelg | 3cc06ec | 2016-06-30 09:14:09 | [diff] [blame] | 29 | }; |
| 30 | |
Evan Stade | 4ebefdf4 | 2017-09-21 23:50:18 | [diff] [blame] | 31 | // A struct that contains extra data about a notification specific to one of |
| 32 | // the above types. |
| 33 | struct Metadata { |
| 34 | virtual ~Metadata(); |
| 35 | |
Peter Beverloo | 6dba2e10 | 2017-11-23 17:46:33 | [diff] [blame^] | 36 | NotificationHandler::Type type; |
Evan Stade | 4ebefdf4 | 2017-09-21 23:50:18 | [diff] [blame] | 37 | }; |
| 38 | |
miguelg | 3cc06ec | 2016-06-30 09:14:09 | [diff] [blame] | 39 | // Open the Notification settings screen when clicking the right button. |
| 40 | // TODO(miguelg) have it take a Profile instead once NotificationObjectProxy |
| 41 | // is updated. |
| 42 | static void OpenNotificationSettings( |
| 43 | content::BrowserContext* browser_context); |
miguelg | 3cc06ec | 2016-06-30 09:14:09 | [diff] [blame] | 44 | }; |
| 45 | |
Evan Stade | 4ebefdf4 | 2017-09-21 23:50:18 | [diff] [blame] | 46 | // Metadata for PERSISTENT notifications. |
| 47 | struct PersistentNotificationMetadata : public NotificationCommon::Metadata { |
| 48 | PersistentNotificationMetadata(); |
| 49 | ~PersistentNotificationMetadata() override; |
| 50 | |
| 51 | static const PersistentNotificationMetadata* From(const Metadata* metadata); |
| 52 | |
| 53 | GURL service_worker_scope; |
| 54 | }; |
| 55 | |
miguelg | 3cc06ec | 2016-06-30 09:14:09 | [diff] [blame] | 56 | #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_COMMON_H_ |