Update ASan/Android runtime and setup script to LLVM r200682.
[chromium-blink-merge.git] / google_apis / gcm / engine / registration_request.h
blob47cce76912cdd0a4023f8a25f847cebea0a7a8a2
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.
5 #ifndef GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_
6 #define GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_
8 #include <map>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "google_apis/gcm/base/gcm_export.h"
16 #include "net/url_request/url_fetcher_delegate.h"
18 namespace net {
19 class URLRequestContextGetter;
22 namespace gcm {
24 // Registration request is used to obtain registration IDs for applications that
25 // want to use GCM. It requires a set of parameters to be specified to identify
26 // the Chrome instance, the user, the application and a set of senders that will
27 // be authorized to address the application using it's assigned registration ID.
28 class GCM_EXPORT RegistrationRequest : public net::URLFetcherDelegate {
29 public:
30 // Callback completing the registration request.
31 typedef base::Callback<void(const std::string& registration_id)>
32 RegistrationCallback;
34 // Details of the of the Registration Request. Only user's android ID and
35 // its serial number are optional and can be set to 0. All other parameters
36 // have to be specified to successfully complete the call.
37 struct GCM_EXPORT RequestInfo {
38 RequestInfo(uint64 android_id,
39 uint64 security_token,
40 uint64 user_android_id,
41 int64 user_serial_number,
42 const std::string& app_id,
43 const std::string& cert,
44 const std::vector<std::string>& sender_ids);
45 ~RequestInfo();
47 // Android ID of the device.
48 uint64 android_id;
49 // Security token of the device.
50 uint64 security_token;
51 // User's android ID. (Can be omitted in a single user scenario.)
52 uint64 user_android_id;
53 // User's serial number. (Can be omitted in a single user scenario.)
54 int64 user_serial_number;
55 // Application ID.
56 std::string app_id;
57 // Certificate of the application.
58 std::string cert;
59 // List of IDs of senders. Allowed up to 100.
60 std::vector<std::string> sender_ids;
63 RegistrationRequest(
64 const RequestInfo& request_info,
65 const RegistrationCallback& callback,
66 scoped_refptr<net::URLRequestContextGetter> request_context_getter);
67 virtual ~RegistrationRequest();
69 void Start();
71 // URLFetcherDelegate implementation.
72 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
74 private:
75 RegistrationCallback callback_;
76 RequestInfo request_info_;
78 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
79 scoped_ptr<net::URLFetcher> url_fetcher_;
81 DISALLOW_COPY_AND_ASSIGN(RegistrationRequest);
84 } // namespace gcm
86 #endif // GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_