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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_app_identifier.h

Issue 2697793004: Push API: Validate storage before returning cached subscriptions (Closed)
Patch Set: Fix include Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/push_messaging/push_messaging_app_identifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_APP_IDENTIFIER_H_ 5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_APP_IDENTIFIER_H_
6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_APP_IDENTIFIER_H_ 6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_APP_IDENTIFIER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <string> 10 #include <string>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return origin_; 92 return origin_;
93 } 93 }
94 94
95 int64_t service_worker_registration_id() const { 95 int64_t service_worker_registration_id() const {
96 DCHECK(!is_null()); 96 DCHECK(!is_null());
97 return service_worker_registration_id_; 97 return service_worker_registration_id_;
98 } 98 }
99 99
100 private: 100 private:
101 friend class PushMessagingAppIdentifierTest; 101 friend class PushMessagingAppIdentifierTest;
102 friend class PushMessagingBrowserTest;
102 FRIEND_TEST_ALL_PREFIXES(PushMessagingAppIdentifierTest, FindLegacy); 103 FRIEND_TEST_ALL_PREFIXES(PushMessagingAppIdentifierTest, FindLegacy);
103 104
105 // Generates a new app identifier for legacy GCM (not modern InstanceID).
106 static PushMessagingAppIdentifier LegacyGenerateForTesting(
107 const GURL& origin,
108 int64_t service_worker_registration_id);
109
110 static PushMessagingAppIdentifier GenerateInternal(
111 const GURL& origin,
112 int64_t service_worker_registration_id,
113 bool use_instance_id);
114
104 // Constructs an invalid app identifier. 115 // Constructs an invalid app identifier.
105 PushMessagingAppIdentifier(); 116 PushMessagingAppIdentifier();
106 // Constructs a valid app identifier. 117 // Constructs a valid app identifier.
107 PushMessagingAppIdentifier(const std::string& app_id, 118 PushMessagingAppIdentifier(const std::string& app_id,
108 const GURL& origin, 119 const GURL& origin,
109 int64_t service_worker_registration_id); 120 int64_t service_worker_registration_id);
110 121
111 // Validates that all the fields contain valid values. 122 // Validates that all the fields contain valid values.
112 void DCheckValid() const; 123 void DCheckValid() const;
113 124
114 std::string app_id_; 125 std::string app_id_;
115 GURL origin_; 126 GURL origin_;
116 int64_t service_worker_registration_id_; 127 int64_t service_worker_registration_id_;
117 }; 128 };
118 129
119 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_APP_IDENTIFIER_H_ 130 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_APP_IDENTIFIER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/push_messaging/push_messaging_app_identifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698