OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ |
6 #define GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ |
7 | 7 |
8 #include <string> | |
9 #include <vector> | |
10 | |
8 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
9 #include "base/callback.h" | 12 #include "base/callback.h" |
10 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
11 #include "google_apis/gcm/base/gcm_export.h" | 14 #include "google_apis/gcm/base/gcm_export.h" |
12 #include "google_apis/gcm/protocol/android_checkin.pb.h" | 15 #include "google_apis/gcm/protocol/android_checkin.pb.h" |
13 #include "net/base/backoff_entry.h" | 16 #include "net/base/backoff_entry.h" |
14 #include "net/url_request/url_fetcher_delegate.h" | 17 #include "net/url_request/url_fetcher_delegate.h" |
15 | 18 |
16 namespace net { | 19 namespace net { |
17 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
(...skipping 10 matching lines...) Expand all Loading... | |
28 // A callback function for the checkin request, accepting |android_id| and | 31 // A callback function for the checkin request, accepting |android_id| and |
29 // |security_token|. | 32 // |security_token|. |
30 typedef base::Callback<void(uint64 android_id, uint64 security_token)> | 33 typedef base::Callback<void(uint64 android_id, uint64 security_token)> |
31 CheckinRequestCallback; | 34 CheckinRequestCallback; |
32 | 35 |
33 CheckinRequest(const CheckinRequestCallback& callback, | 36 CheckinRequest(const CheckinRequestCallback& callback, |
34 const net::BackoffEntry::Policy& backoff_policy, | 37 const net::BackoffEntry::Policy& backoff_policy, |
35 const checkin_proto::ChromeBuildProto& chrome_build_proto, | 38 const checkin_proto::ChromeBuildProto& chrome_build_proto, |
36 uint64 android_id, | 39 uint64 android_id, |
37 uint64 security_token, | 40 uint64 security_token, |
41 const std::vector<std::string>& account_ids, | |
38 net::URLRequestContextGetter* request_context_getter); | 42 net::URLRequestContextGetter* request_context_getter); |
39 virtual ~CheckinRequest(); | 43 virtual ~CheckinRequest(); |
40 | 44 |
41 void Start(); | 45 void Start(); |
42 | 46 |
43 // URLFetcherDelegate implementation. | 47 // URLFetcherDelegate implementation. |
44 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 48 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
45 | 49 |
46 private: | 50 private: |
47 // Schedules a retry attempt, informs the backoff of a previous request's | 51 // Schedules a retry attempt, informs the backoff of a previous request's |
48 // failure when |update_backoff| is true. | 52 // failure when |update_backoff| is true. |
49 void RetryWithBackoff(bool update_backoff); | 53 void RetryWithBackoff(bool update_backoff); |
50 | 54 |
51 net::URLRequestContextGetter* request_context_getter_; | 55 net::URLRequestContextGetter* request_context_getter_; |
52 CheckinRequestCallback callback_; | 56 CheckinRequestCallback callback_; |
53 | 57 |
54 net::BackoffEntry backoff_entry_; | 58 net::BackoffEntry backoff_entry_; |
55 scoped_ptr<net::URLFetcher> url_fetcher_; | 59 scoped_ptr<net::URLFetcher> url_fetcher_; |
56 checkin_proto::ChromeBuildProto chrome_build_proto_; | 60 checkin_proto::ChromeBuildProto chrome_build_proto_; |
57 uint64 android_id_; | 61 uint64 android_id_; |
58 uint64 security_token_; | 62 uint64 security_token_; |
63 std::vector<std::string> account_ids_; | |
Nicolas Zea
2014/02/19 22:23:36
nit: make const (this applies to all of these vari
fgorski
2014/02/19 23:08:49
Done.
| |
59 | 64 |
60 base::WeakPtrFactory<CheckinRequest> weak_ptr_factory_; | 65 base::WeakPtrFactory<CheckinRequest> weak_ptr_factory_; |
61 | 66 |
62 DISALLOW_COPY_AND_ASSIGN(CheckinRequest); | 67 DISALLOW_COPY_AND_ASSIGN(CheckinRequest); |
63 }; | 68 }; |
64 | 69 |
65 } // namespace gcm | 70 } // namespace gcm |
66 | 71 |
67 #endif // GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ | 72 #endif // GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ |
OLD | NEW |