OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_APPLICATION_ID_H_ | |
6 #define CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_APPLICATION_ID_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "content/common/content_export.h" | |
12 #include "url/gurl.h" | |
13 | |
14 namespace content { | |
15 | |
16 // The prefix used for all push messaging application ids. | |
17 CONTENT_EXPORT extern const char kPushMessagingApplicationIdPrefix[]; | |
18 | |
19 // Type used to identify an "application" from a Push API perspective. | |
johnme
2014/07/23 12:36:57
Nit: s/an "application"/a web app/ ?
Michael van Ouwerkerk
2014/07/23 15:05:14
Done.
| |
20 struct CONTENT_EXPORT PushMessagingApplicationId { | |
21 public: | |
22 static PushMessagingApplicationId Parse(const std::string& id); | |
23 | |
24 PushMessagingApplicationId() | |
25 : origin(GURL::EmptyGURL()), service_worker_registration_id(-1) {} | |
26 PushMessagingApplicationId(const GURL& origin, | |
27 int64 service_worker_registration_id) | |
28 : origin(origin), | |
29 service_worker_registration_id(service_worker_registration_id) {} | |
30 | |
31 bool is_valid() { | |
johnme
2014/07/23 12:36:57
Nit: this isn't a simple getter, so IIRC the defin
Michael van Ouwerkerk
2014/07/23 15:05:14
Done.
| |
32 return origin.is_valid() && origin.GetOrigin() == origin && | |
33 service_worker_registration_id >= 0; | |
34 } | |
35 | |
36 std::string ToString(); | |
37 | |
38 GURL origin; | |
johnme
2014/07/23 12:36:57
Perhaps these should be immutable? You might even
Michael van Ouwerkerk
2014/07/23 15:05:14
Ok they're const now.
| |
39 int64 service_worker_registration_id; | |
40 }; | |
41 | |
42 } // namespace content | |
43 | |
44 #endif // CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_APPLICATION_ID_H_ | |
OLD | NEW |