Index: google_apis/gcm/engine/registration_request.h |
diff --git a/google_apis/gcm/engine/registration_request.h b/google_apis/gcm/engine/registration_request.h |
index 1f707b9dd9ee276fd6ddb34609f8f4ddc9fb9595..a86df7cbdcec3e507780cfb2272968668b47a9f5 100644 |
--- a/google_apis/gcm/engine/registration_request.h |
+++ b/google_apis/gcm/engine/registration_request.h |
@@ -59,31 +59,56 @@ class GCM_EXPORT RegistrationRequest : public net::URLFetcherDelegate { |
const std::string& registration_id)> |
RegistrationCallback; |
- // Details of the of the Registration Request. Only user's android ID and |
- // its serial number are optional and can be set to 0. All other parameters |
- // have to be specified to successfully complete the call. |
+ // Encapsulates the common info about a registration/token request. |
struct GCM_EXPORT RequestInfo { |
- RequestInfo(uint64 android_id, |
- uint64 security_token, |
- const std::string& app_id, |
- const std::vector<std::string>& sender_ids); |
- ~RequestInfo(); |
+ RequestInfo(); |
+ virtual ~RequestInfo(); |
+ virtual void BuildRequestHeaders(std::string* extra_headers); |
+ virtual void BuildRequestBody(std::string* body); |
+ virtual std::string GetSenders() const = 0; |
+ |
+ // Version to pass. |
+ std::string chrome_version; |
// Android ID of the device. |
uint64 android_id; |
// Security token of the device. |
uint64 security_token; |
// Application ID. |
std::string app_id; |
- // Certificate of the application. |
- std::string cert; |
+ }; |
+ |
+ // GCM registration request. |
+ struct GCM_EXPORT GCMRequestInfo : public RequestInfo { |
+ GCMRequestInfo(); |
+ ~GCMRequestInfo() override; |
+ |
+ // RequestInfo overrides: |
+ void BuildRequestBody(std::string* body) override; |
+ std::string GetSenders() const override; |
+ |
// List of IDs of senders. Allowed up to 100. |
std::vector<std::string> sender_ids; |
}; |
+ // GCM token request. |
fgorski
2015/05/13 18:32:41
Instance ID token request
jianli
2015/05/13 22:42:56
Done.
|
+ struct GCM_EXPORT InstanceIDRequestInfo : public RequestInfo { |
+ InstanceIDRequestInfo(); |
+ ~InstanceIDRequestInfo() override; |
+ |
+ // RequestInfo overrides: |
+ void BuildRequestBody(std::string* body) override; |
+ std::string GetSenders() const override; |
+ |
+ std::string instance_id; |
+ std::string authorized_entity; |
+ std::string scope; |
+ std::map<std::string, std::string> options; |
+ }; |
+ |
RegistrationRequest( |
const GURL& registration_url, |
- const RequestInfo& request_info, |
+ scoped_ptr<RequestInfo> request_info, |
const net::BackoffEntry::Policy& backoff_policy, |
const RegistrationCallback& callback, |
int max_retry_count, |
@@ -106,7 +131,7 @@ class GCM_EXPORT RegistrationRequest : public net::URLFetcherDelegate { |
Status ParseResponse(const net::URLFetcher* source, std::string* token); |
RegistrationCallback callback_; |
- RequestInfo request_info_; |
+ scoped_ptr<RequestInfo> request_info_; |
GURL registration_url_; |
net::BackoffEntry backoff_entry_; |