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

Unified Diff: chrome/browser/notifications/platform_notification_service_impl.h

Issue 784383002: Support persistent notifications in the PlatformNotificationServiceImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-chrome-base
Patch Set: adds browser tests Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/platform_notification_service_impl.h
diff --git a/chrome/browser/notifications/platform_notification_service_impl.h b/chrome/browser/notifications/platform_notification_service_impl.h
index 9a801cfc952811771a0d33af0c87dc4645f7cdaf..c19954787723fa4c5497b79268fa1a8d8b5d54f4 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.h
+++ b/chrome/browser/notifications/platform_notification_service_impl.h
@@ -7,8 +7,11 @@
#include "base/gtest_prod_util.h"
#include "base/memory/singleton.h"
+#include "chrome/browser/notifications/notification.h"
#include "content/public/browser/platform_notification_service.h"
+#include "content/public/common/persistent_notification_status.h"
+class NotificationDelegate;
class NotificationUIManager;
class Profile;
@@ -21,6 +24,17 @@ class PlatformNotificationServiceImpl
// be called from any thread.
static PlatformNotificationServiceImpl* GetInstance();
+ // To be called when a persistent notification has been clicked on. The
+ // Service Worker associated with the registration will be started if
+ // needed, on which the event will be fired. Must be called on the UI thread.
+ void OnPersistentNotificationClick(
+ content::BrowserContext* browser_context,
+ int64 service_worker_registration_id,
+ const std::string& notification_id,
+ const content::ShowDesktopNotificationHostMsgParams& params,
+ const base::Callback<void(content::PersistentNotificationStatus)>&
+ callback) const;
+
// Returns the Notification UI Manager through which notifications can be
// displayed to the user. Can be overridden for testing.
NotificationUIManager* GetNotificationUIManager() const;
@@ -47,6 +61,7 @@ class PlatformNotificationServiceImpl
private:
friend struct DefaultSingletonTraits<PlatformNotificationServiceImpl>;
+ friend class PlatformNotificationServiceBrowserTest;
friend class PlatformNotificationServiceTest;
FRIEND_TEST_ALL_PREFIXES(
PlatformNotificationServiceTest, DisplayNameForOrigin);
@@ -54,6 +69,15 @@ class PlatformNotificationServiceImpl
PlatformNotificationServiceImpl();
~PlatformNotificationServiceImpl() override;
+ // Creates a new Web Notification-based Notification object.
+ // TODO(peter): |delegate| can be a scoped_refptr, but properly passing this
+ // through requires changing a whole lot of Notification constructor calls.
+ Notification CreateNotificationFromData(
+ Profile* profile,
+ const content::ShowDesktopNotificationHostMsgParams& params,
+ NotificationDelegate* delegate,
+ int render_process_id) const;
+
// Overrides the Notification UI Manager to use to |manager|. Only to be
// used by tests. Tests are responsible for cleaning up after themselves.
void SetNotificationUIManagerForTesting(NotificationUIManager* manager);
@@ -63,7 +87,7 @@ class PlatformNotificationServiceImpl
// from the origin itself when dealing with extensions.
base::string16 DisplayNameForOriginInProcessId(Profile* profile,
const GURL& origin,
- int process_id);
+ int process_id) const;
// Weak reference. Ownership maintains with the test.
NotificationUIManager* notification_ui_manager_for_tests_;

Powered by Google App Engine
This is Rietveld 408576698