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

Unified Diff: google_apis/gcm/engine/registration_request.h

Issue 1137463003: Support getting and deleting token for Instance ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass InstanceID to requests Created 5 years, 7 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
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..6dbc0402507174fda38bde03398ba6c36adcaf0a 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 {
Nicolas Zea 2015/05/14 05:02:47 style: Structs should only be for passive data con
jianli 2015/05/14 19:18:14 I think virtual methods are better to understand a
- 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;
};
+ // Instance ID token request.
+ 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_;

Powered by Google App Engine
This is Rietveld 408576698