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 CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_ 6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_ 7 8 #include <string> 9 10 #include "base/basictypes.h" 11 #include "url/gurl.h" 12 13 namespace gcm { 14 15 // The prefix used for all push messaging application ids. 16 extern const char kPushMessagingApplicationIdPrefix[]; 17 18 // Type used to identify a web app from a Push API perspective. 19 struct PushMessagingApplicationId { 20 public: 21 static PushMessagingApplicationId Parse(const std::string& id); 22 23 PushMessagingApplicationId() 24 : origin(GURL::EmptyGURL()), service_worker_registration_id(-1) {} 25 PushMessagingApplicationId(const GURL& origin, 26 int64 service_worker_registration_id) 27 : origin(origin), 28 service_worker_registration_id(service_worker_registration_id) {} 29 30 bool IsValid(); 31 std::string ToString() const; 32 33 const GURL origin; 34 const int64 service_worker_registration_id; 35 }; 36 37 } // namespace gcm 38 39 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_ 40