summaryrefslogtreecommitdiffstats
path: root/content/browser/notifications/notification_database_data.h
diff options
context:
space:
mode:
authorpeter <peter@chromium.org>2015-03-13 07:33:38 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-13 14:34:26 +0000
commit05cb4db3e707e8858588fdedeab831d91c5c7f5c (patch)
tree223374f23cf245dbb45bfe60ad215f50ae78366b /content/browser/notifications/notification_database_data.h
parent9f5893dca3b430f4c3edb64ca9019d45bdc1ddc2 (diff)
downloadchromium_src-05cb4db3e707e8858588fdedeab831d91c5c7f5c.zip
chromium_src-05cb4db3e707e8858588fdedeab831d91c5c7f5c.tar.gz
chromium_src-05cb4db3e707e8858588fdedeab831d91c5c7f5c.tar.bz2
Add the NotificationDatabaseData structure and protobuf
This represents the payload of notifications to be stored in the notification database. Included are two conversion functions in order to make sure that we can isolate that operation in one, tested location. Design document: http://goo.gl/TciXVp BUG=447628 Review URL: https://codereview.chromium.org/1003843002 Cr-Commit-Position: refs/heads/master@{#320497}
Diffstat (limited to 'content/browser/notifications/notification_database_data.h')
-rw-r--r--content/browser/notifications/notification_database_data.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/content/browser/notifications/notification_database_data.h b/content/browser/notifications/notification_database_data.h
new file mode 100644
index 0000000..ea4bf38
--- /dev/null
+++ b/content/browser/notifications/notification_database_data.h
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_DATA_H_
+#define CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_DATA_H_
+
+#include <stdint.h>
+
+#include "content/common/content_export.h"
+#include "content/public/common/platform_notification_data.h"
+#include "url/gurl.h"
+
+namespace content {
+
+// Stores information about a Web Notification as available in the notification
+// database. Beyond the notification's own data, its id and attribution need
+// to be available for users of the database as well.
+struct CONTENT_EXPORT NotificationDatabaseData {
+ NotificationDatabaseData();
+ ~NotificationDatabaseData();
+
+ // Parses the serialized notification database data |input| into this object.
+ bool ParseFromString(const std::string& input);
+
+ // Serializes the contents of this object to |output|. Returns if the data
+ // could be serialized successfully.
+ bool SerializeToString(std::string* output) const;
+
+ // Id of the notification as allocated by the NotificationDatabase.
+ int64_t notification_id;
+
+ // Origin of the website this notification is associated with.
+ GURL origin;
+
+ // Id of the Service Worker registration this notification is associated with.
+ int64_t service_worker_registration_id;
+
+ // Platform data of the notification that's being stored.
+ PlatformNotificationData notification_data;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_DATA_H_