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 7bdbb2cfcc317319aa21b06543a7c506c9f36b5c..93665fdef7b931a0bd1680654004d70594c258ef 100644 |
--- a/content/browser/notifications/notification_id_generator.cc |
+++ b/content/browser/notifications/notification_id_generator.cc |
@@ -19,8 +19,8 @@ |
namespace content { |
namespace { |
-const char kPersistentPrefix[] = "p:"; |
-const char kNonPersistentPrefix[] = "n:"; |
+const char kPersistentNotificationPrefix[] = "p:"; |
+const char kNonPersistentNotificationPrefix[] = "n:"; |
const char kSeparator = '#'; |
@@ -42,23 +42,21 @@ std::string ComputeBrowserContextHash(BrowserContext* browser_context) { |
} // namespace |
NotificationIdGenerator::NotificationIdGenerator( |
- BrowserContext* browser_context, |
- int render_process_id) |
- : browser_context_(browser_context), |
- render_process_id_(render_process_id) {} |
+ BrowserContext* browser_context) |
+ : browser_context_(browser_context) {} |
NotificationIdGenerator::~NotificationIdGenerator() {} |
// static |
bool NotificationIdGenerator::IsPersistentNotification( |
const base::StringPiece& notification_id) { |
- return notification_id.starts_with(kPersistentPrefix); |
+ return notification_id.starts_with(kPersistentNotificationPrefix); |
} |
// static |
bool NotificationIdGenerator::IsNonPersistentNotification( |
const base::StringPiece& notification_id) { |
- return notification_id.starts_with(kNonPersistentPrefix); |
+ return notification_id.starts_with(kNonPersistentNotificationPrefix); |
} |
std::string NotificationIdGenerator::GenerateForPersistentNotification( |
@@ -70,14 +68,11 @@ std::string NotificationIdGenerator::GenerateForPersistentNotification( |
std::stringstream stream; |
- stream << kPersistentPrefix; |
+ stream << kPersistentNotificationPrefix; |
stream << ComputeBrowserContextHash(browser_context_); |
stream << base::IntToString(browser_context_->IsOffTheRecord()); |
stream << origin; |
- // Persistent notification ids are unique for the lifetime of the notification |
- // database, orthogonal to the renderer that created the notification. |
- |
stream << base::IntToString(!tag.empty()); |
if (tag.size()) |
stream << tag; |
@@ -90,23 +85,21 @@ std::string NotificationIdGenerator::GenerateForPersistentNotification( |
std::string NotificationIdGenerator::GenerateForNonPersistentNotification( |
const GURL& origin, |
const std::string& tag, |
- int non_persistent_notification_id) const { |
+ int non_persistent_notification_id, |
+ int render_process_id) const { |
DCHECK(origin.is_valid()); |
DCHECK_EQ(origin, origin.GetOrigin()); |
std::stringstream stream; |
- stream << kNonPersistentPrefix; |
+ stream << kNonPersistentNotificationPrefix; |
stream << ComputeBrowserContextHash(browser_context_); |
stream << base::IntToString(browser_context_->IsOffTheRecord()); |
stream << origin; |
- // Non-persistent notification ids are unique per renderer process when no |
- // tag is being used. Tags still identify uniqueness for the given origin. |
- |
stream << base::IntToString(!tag.empty()); |
if (tag.empty()) { |
- stream << base::IntToString(render_process_id_); |
+ stream << base::IntToString(render_process_id); |
stream << kSeparator; |
stream << base::IntToString(non_persistent_notification_id); |