Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: chrome/browser/push_messaging/push_messaging_notification_manager.h

Issue 2151993002: [WebAPKs] Plumb service worker scope to notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into notification_scope Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_NOTIFICATION_MANAGER_H_ 5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_NOTIFICATION_MANAGER_H_
6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_NOTIFICATION_MANAGER_H_ 6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_NOTIFICATION_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "content/common/service_worker/service_worker_status_code.h"
15 16
16 class GURL; 17 class GURL;
17 class Profile; 18 class Profile;
18 19
19 namespace content { 20 namespace content {
20 struct NotificationDatabaseData; 21 struct NotificationDatabaseData;
21 struct PlatformNotificationData; 22 struct PlatformNotificationData;
23 class ServiceWorkerRegistration;
22 class WebContents; 24 class WebContents;
23 } 25 }
24 26
25 // Developers may be required to display a Web Notification in response to an 27 // Developers may be required to display a Web Notification in response to an
26 // incoming push message in order to clarify to the user that something has 28 // incoming push message in order to clarify to the user that something has
27 // happened in the background. When they forget to do so, a default notification 29 // happened in the background. When they forget to do so, a default notification
28 // has to be displayed on their behalf. 30 // has to be displayed on their behalf.
29 // 31 //
30 // This class implements the heuristics for determining whether the default 32 // This class implements the heuristics for determining whether the default
31 // notification is necessary, as well as the functionality of displaying the 33 // notification is necessary, as well as the functionality of displaying the
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 const GURL& origin); 76 const GURL& origin);
75 77
76 void CheckForMissedNotification(const GURL& origin, 78 void CheckForMissedNotification(const GURL& origin,
77 int64_t service_worker_registration_id, 79 int64_t service_worker_registration_id,
78 const base::Closure& message_handled_closure, 80 const base::Closure& message_handled_closure,
79 const double budget); 81 const double budget);
80 82
81 static void DidWriteNotificationDataIOProxy( 83 static void DidWriteNotificationDataIOProxy(
82 const base::WeakPtr<PushMessagingNotificationManager>& ui_weak_ptr, 84 const base::WeakPtr<PushMessagingNotificationManager>& ui_weak_ptr,
83 const GURL& origin, 85 const GURL& origin,
86 int service_worker_id,
84 const content::PlatformNotificationData& notification_data, 87 const content::PlatformNotificationData& notification_data,
85 const base::Closure& message_handled_closure, 88 const base::Closure& message_handled_closure,
86 bool success, 89 bool success,
87 int64_t persistent_notification_id); 90 int64_t persistent_notification_id);
88 91
89 void DidWriteNotificationData( 92 void DidWriteNotificationData(
90 const GURL& origin, 93 const GURL& origin,
94 int service_worker_registration_id,
91 const content::PlatformNotificationData& notification_data, 95 const content::PlatformNotificationData& notification_data,
92 const base::Closure& message_handled_closure, 96 const base::Closure& message_handled_closure,
93 bool success, 97 bool success,
94 int64_t persistent_notification_id); 98 int64_t persistent_notification_id);
95 99
100 static void FindServiceWorkerRegistrationCallbackIOProxy(
101 const base::WeakPtr<PushMessagingNotificationManager>& ui_weak_ptr,
102 const GURL& origin,
103 const content::PlatformNotificationData& notification_data,
104 const base::Closure& message_handled_closure,
105 int64_t persistent_notification_id,
106 content::ServiceWorkerStatusCode service_worker_status,
107 const scoped_refptr<content::ServiceWorkerRegistration>& registration);
108
109 void FindServiceWorkerRegistrationCallback(
110 const GURL& origin,
111 const content::PlatformNotificationData& notification_data,
112 const base::Closure& message_handled_closure,
113 int64_t persistent_notification_id,
114 content::ServiceWorkerStatusCode service_worker_status,
115 const scoped_refptr<content::ServiceWorkerRegistration>& registration);
116
96 void DidGetBudget(const GURL& origin, 117 void DidGetBudget(const GURL& origin,
97 int64_t service_worker_registration_id, 118 int64_t service_worker_registration_id,
98 const base::Closure& message_handled_closure, 119 const base::Closure& message_handled_closure,
99 bool notification_needed, 120 bool notification_needed,
100 bool notification_shown, 121 bool notification_shown,
101 double budget); 122 double budget);
102 123
103 // Weak. This manager is owned by a keyed service on this profile. 124 // Weak. This manager is owned by a keyed service on this profile.
104 Profile* profile_; 125 Profile* profile_;
105 126
106 base::WeakPtrFactory<PushMessagingNotificationManager> weak_factory_; 127 base::WeakPtrFactory<PushMessagingNotificationManager> weak_factory_;
107 128
108 DISALLOW_COPY_AND_ASSIGN(PushMessagingNotificationManager); 129 DISALLOW_COPY_AND_ASSIGN(PushMessagingNotificationManager);
109 }; 130 };
110 131
111 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_NOTIFICATION_MANAGER_H_ 132 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_NOTIFICATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698