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

Unified Diff: chrome/browser/services/gcm/push_messaging_application_id.h

Issue 404353003: Define PushMessagingApplicationId and replace ad-hoc code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments from jam and fgorski. Created 6 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/services/gcm/push_messaging_application_id.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/services/gcm/push_messaging_application_id.h
diff --git a/chrome/browser/services/gcm/push_messaging_application_id.h b/chrome/browser/services/gcm/push_messaging_application_id.h
new file mode 100644
index 0000000000000000000000000000000000000000..777eaf2debeea764aa010b8ff594608a2ff66d6f
--- /dev/null
+++ b/chrome/browser/services/gcm/push_messaging_application_id.h
@@ -0,0 +1,39 @@
+// Copyright 2014 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 CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_
+#define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "url/gurl.h"
+
+namespace gcm {
+
+// The prefix used for all push messaging application ids.
+extern const char kPushMessagingApplicationIdPrefix[];
+
+// Type used to identify a web app from a Push API perspective.
+struct PushMessagingApplicationId {
+ public:
+ static PushMessagingApplicationId Parse(const std::string& id);
+
+ PushMessagingApplicationId()
+ : origin(GURL::EmptyGURL()), service_worker_registration_id(-1) {}
+ PushMessagingApplicationId(const GURL& origin,
+ int64 service_worker_registration_id)
+ : origin(origin),
+ service_worker_registration_id(service_worker_registration_id) {}
+
+ bool IsValid();
+ std::string ToString() const;
+
+ const GURL origin;
+ const int64 service_worker_registration_id;
+};
+
+} // namespace gcm
+
+#endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_
« no previous file with comments | « no previous file | chrome/browser/services/gcm/push_messaging_application_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698