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

Unified Diff: content/public/common/push_event_payload.h

Issue 1636483002: Update the PushEvent to have a nullable PushMessageData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/public/common/push_event_payload.h
diff --git a/content/public/common/push_event_payload.h b/content/public/common/push_event_payload.h
new file mode 100644
index 0000000000000000000000000000000000000000..143bf4750ab48d4cfa266ecfc8c1e22574e987f4
--- /dev/null
+++ b/content/public/common/push_event_payload.h
@@ -0,0 +1,46 @@
+// Copyright 2016 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_PUBLIC_COMMON_PUSH_EVENT_PAYLOAD_H_
+#define CONTENT_PUBLIC_COMMON_PUSH_EVENT_PAYLOAD_H_
+
+#include <stddef.h>
+
+#include "content/common/content_export.h"
+
+namespace content {
+
+// Structure representing the payload delivered as part of a push message.
+// This struct contains the decrypted information sent from the push
+// service as part of a PushEvent.
Peter Beverloo 2016/01/25 17:39:07 Another thing that would be worthwhile to document
harkness 2016/01/26 12:07:19 I've added a brief description of the fact that we
+
Peter Beverloo 2016/01/25 17:39:06 micro nit: no need for the blank line I think you
harkness 2016/01/26 12:07:20 Interestingly, I tried a cl format on this file an
+struct CONTENT_EXPORT PushEventPayload {
Peter Beverloo 2016/01/25 17:39:06 An alternative name for this structure could be "P
harkness 2016/01/26 12:07:20 My goal for the structure was for it to be a possi
+public:
Peter Beverloo 2016/01/25 17:39:07 micro nit: one space indent for the visibility ide
harkness 2016/01/26 12:07:20 Removed, as it was no longer necessary.
+ PushEventPayload() :
+ m_isNull(true)
Peter Beverloo 2016/01/25 17:39:06 naming: Blink style prefixes members with "m_", an
Peter Beverloo 2016/01/25 17:39:07 micro nit: format the constructor like this: clas
harkness 2016/01/26 12:07:20 Done.
harkness 2016/01/26 12:07:20 This is actually counter to the Google coding styl
+ {}
+ PushEventPayload(const std::string& data) :
Peter Beverloo 2016/01/25 17:39:07 We only use this constructor for the service_worke
harkness 2016/01/26 12:07:20 Removed it and updated the test file.
+ m_data(data),
+ m_isNull(false)
+ {}
+
+ ~PushEventPayload() {}
+
+ void setData(const std::string& data) {
+ m_data = data;
+ m_isNull = false;
+ }
+ const std::string& getData() const { return m_data; }
Peter Beverloo 2016/01/25 17:39:06 micro nit: blank line above here
harkness 2016/01/26 12:07:20 Done.
+
+ bool isNull() const { return m_isNull; }
+
+ // Data contained in the payload
Peter Beverloo 2016/01/25 17:39:07 I don't mind too strongly, but given that this str
harkness 2016/01/26 12:07:20 Unfortunately, using private members makes IPC una
+ std::string m_data;
+ bool m_isNull;
+
Peter Beverloo 2016/01/25 17:39:07 micro nit: no blank line
harkness 2016/01/26 12:07:20 Done.
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_PUSH_EVENT_PAYLOAD_H_

Powered by Google App Engine
This is Rietveld 408576698