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

Unified Diff: content/browser/notifications/notification_id_generator.cc

Issue 2534443002: Use notification display service to collect persistent notifications. (Closed)
Patch Set: revert unit test Created 4 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: content/browser/notifications/notification_id_generator.cc
diff --git a/content/browser/notifications/notification_id_generator.cc b/content/browser/notifications/notification_id_generator.cc
index 93665fdef7b931a0bd1680654004d70594c258ef..57c703a3a0af46bf6811536e907e3855160aa125 100644
--- a/content/browser/notifications/notification_id_generator.cc
+++ b/content/browser/notifications/notification_id_generator.cc
@@ -14,14 +14,15 @@
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/notification_id_verifier.h"
#include "url/gurl.h"
namespace content {
-namespace {
const char kPersistentNotificationPrefix[] = "p:";
const char kNonPersistentNotificationPrefix[] = "n:";
+namespace {
const char kSeparator = '#';
// Computes a hash based on the path in which the |browser_context| is stored.
@@ -41,24 +42,26 @@ std::string ComputeBrowserContextHash(BrowserContext* browser_context) {
} // namespace
-NotificationIdGenerator::NotificationIdGenerator(
- BrowserContext* browser_context)
- : browser_context_(browser_context) {}
-
-NotificationIdGenerator::~NotificationIdGenerator() {}
+// NotificationIdVerifier implementation
// static
-bool NotificationIdGenerator::IsPersistentNotification(
+bool NotificationIdVerifier::IsPersistentNotification(
const base::StringPiece& notification_id) {
return notification_id.starts_with(kPersistentNotificationPrefix);
}
// static
-bool NotificationIdGenerator::IsNonPersistentNotification(
+bool NotificationIdVerifier::IsNonPersistentNotification(
const base::StringPiece& notification_id) {
return notification_id.starts_with(kNonPersistentNotificationPrefix);
}
+NotificationIdGenerator::NotificationIdGenerator(
+ BrowserContext* browser_context)
+ : browser_context_(browser_context) {}
+
+NotificationIdGenerator::~NotificationIdGenerator() {}
+
std::string NotificationIdGenerator::GenerateForPersistentNotification(
const GURL& origin,
const std::string& tag,

Powered by Google App Engine
This is Rietveld 408576698