OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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 GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ | |
6 #define GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ | |
7 | |
8 #include <map> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/callback.h" | |
13 #include "google_apis/gcm/base/gcm_export.h" | |
14 #include "net/url_request/url_fetcher_delegate.h" | |
15 | |
16 namespace net { | |
17 class URLRequestContextGetter; | |
18 } | |
19 | |
20 namespace gcm { | |
21 | |
22 class GCM_EXPORT RegistrationRequest : public net::URLFetcherDelegate { | |
23 public: | |
24 // Callback completing the registration request. | |
25 typedef base::Callback<void(const std::string& registration_id)> | |
26 RegistrationCallback; | |
27 | |
28 RegistrationRequest( | |
29 const RegistrationCallback& callback, | |
30 uint64 android_id, | |
Nicolas Zea
2014/01/10 19:45:12
this list of params is getting pretty long, encaps
fgorski
2014/01/10 22:46:58
Done.
| |
31 uint64 security_token, | |
32 uint64 user_android_id, | |
33 int64 user_serial_number, | |
34 const std::string& package_id, | |
35 const std::string& cert, | |
36 const std::vector<std::string>& sender_ids, | |
37 const std::map<std::string, std::string>& extras, | |
38 scoped_refptr<net::URLRequestContextGetter> request_context_getter); | |
39 virtual ~RegistrationRequest(); | |
40 | |
41 void Start(); | |
42 | |
43 // URLFetcherDelegate implementation. | |
44 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | |
45 | |
46 private: | |
47 RegistrationCallback callback_; | |
48 // Android ID of the device. | |
49 uint64 android_id_; | |
50 // Security token of the device. | |
51 uint64 security_token_; | |
52 // Application ID. | |
53 std::string package_id_; | |
54 // List of IDs of senders. Allowed up to 100. | |
55 std::vector<std::string> sender_ids_; | |
56 // Certificate of the application. | |
57 std::string cert_; | |
58 // Serial number of the user. | |
59 int64 user_serial_number_; | |
60 // Android ID the user. | |
61 uint64 user_android_id_; | |
62 | |
63 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | |
64 scoped_ptr<net::URLFetcher> url_fetcher_; | |
jianli
2014/01/10 20:17:43
nit: better to add explicit includes for scoped_re
fgorski
2014/01/10 22:46:58
Done.
| |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(RegistrationRequest); | |
67 }; | |
68 | |
69 } // namespace gcm | |
70 | |
71 #endif // GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ | |
OLD | NEW |