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 8 #include "base/feature_list.h" 9 #include "chrome/browser/notifications/notification_handler.h" 10 #include "url/gurl.h" 11 12 class GURL; 13 class Profile; 14 15 // Shared functionality for both in page and persistent notification 16 class NotificationCommon { 17 public: 18 // Things as user can do to a notification. Keep in sync with the 19 // NotificationOperation enumeration in notification_response_builder_mac.h. 20 enum Operation { 21 OPERATION_CLICK = 0, 22 OPERATION_CLOSE = 1, 23 OPERATION_DISABLE_PERMISSION = 2, 24 OPERATION_SETTINGS = 3, 25 OPERATION_MAX = OPERATION_SETTINGS 26 }; 27 28 // A struct that contains extra data about a notification specific to one of 29 // the above types. 30 struct Metadata { 31 virtual ~Metadata(); 32 33 NotificationHandler::Type type; 34 }; 35 36 // Open the Notification settings screen when clicking the right button. 37 static void OpenNotificationSettings(Profile* profile, const GURL& origin); 38 }; 39 40 // Metadata for PERSISTENT notifications. 41 struct PersistentNotificationMetadata : public NotificationCommon::Metadata { 42 PersistentNotificationMetadata(); 43 ~PersistentNotificationMetadata() override; 44 45 static const PersistentNotificationMetadata* From(const Metadata* metadata); 46 47 GURL service_worker_scope; 48 }; 49 50 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_COMMON_H_ 51