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

Side by Side Diff: chrome/browser/notifications/platform_notification_service_impl.h

Issue 2093953002: Introduce a new API to handle native notification clicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits 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 2014 The Chromium Authors. All rights reserved. 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 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_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 29 matching lines...) Expand all
40 40
41 // The platform notification service is the profile-agnostic entry point through 41 // The platform notification service is the profile-agnostic entry point through
42 // which Web Notifications can be controlled. 42 // which Web Notifications can be controlled.
43 class PlatformNotificationServiceImpl 43 class PlatformNotificationServiceImpl
44 : public content::PlatformNotificationService { 44 : public content::PlatformNotificationService {
45 public: 45 public:
46 // Returns the active instance of the service in the browser process. Safe to 46 // Returns the active instance of the service in the browser process. Safe to
47 // be called from any thread. 47 // be called from any thread.
48 static PlatformNotificationServiceImpl* GetInstance(); 48 static PlatformNotificationServiceImpl* GetInstance();
49 49
50 // Load the profile corresponding to |profile_id| and perform the
51 // |operation| on the given notification once it has been loaded.
52 void ProcessPersistentNotificationOperation(
53 NotificationCommon::Operation operation,
54 const std::string& profile_id,
55 bool incognito,
56 const GURL& origin,
57 int64_t persistent_notification_id,
58 int action_index);
59
60 // To be called when a persistent notification has been clicked on. The 50 // To be called when a persistent notification has been clicked on. The
61 // Service Worker associated with the registration will be started if 51 // Service Worker associated with the registration will be started if
62 // needed, on which the event will be fired. Must be called on the UI thread. 52 // needed, on which the event will be fired. Must be called on the UI thread.
63 void OnPersistentNotificationClick( 53 void OnPersistentNotificationClick(
64 content::BrowserContext* browser_context, 54 content::BrowserContext* browser_context,
65 int64_t persistent_notification_id, 55 int64_t persistent_notification_id,
66 const GURL& origin, 56 const GURL& origin,
67 int action_index); 57 int action_index);
68 58
69 // To be called when a persistent notification has been closed. The data 59 // To be called when a persistent notification has been closed. The data
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // programmatically to avoid dispatching close events for them. 155 // programmatically to avoid dispatching close events for them.
166 std::unordered_set<int64_t> closed_notifications_; 156 std::unordered_set<int64_t> closed_notifications_;
167 157
168 // Only set and used for tests, owned by the caller in that case. 158 // Only set and used for tests, owned by the caller in that case.
169 NotificationDisplayService* test_display_service_; 159 NotificationDisplayService* test_display_service_;
170 160
171 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); 161 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl);
172 }; 162 };
173 163
174 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ 164 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698