| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "google_apis/gcm/base/gcm_export.h" | 16 #include "google_apis/gcm/base/gcm_export.h" |
| 17 #include "google_apis/gcm/protocol/android_checkin.pb.h" | 17 #include "google_apis/gcm/protocol/android_checkin.pb.h" |
| 18 #include "google_apis/gcm/protocol/checkin.pb.h" | 18 #include "google_apis/gcm/protocol/checkin.pb.h" |
| 19 #include "net/base/backoff_entry.h" | 19 #include "net/base/backoff_entry.h" |
| 20 #include "net/http/http_status_code.h" |
| 20 #include "net/url_request/url_fetcher_delegate.h" | 21 #include "net/url_request/url_fetcher_delegate.h" |
| 21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 class URLRequestContextGetter; | 25 class URLRequestContextGetter; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace gcm { | 28 namespace gcm { |
| 28 | 29 |
| 29 class GCMStatsRecorder; | 30 class GCMStatsRecorder; |
| 30 | 31 |
| 31 // Enables making check-in requests with the GCM infrastructure. When called | 32 // Enables making check-in requests with the GCM infrastructure. When called |
| 32 // with android_id and security_token both set to 0 it is an initial check-in | 33 // with android_id and security_token both set to 0 it is an initial check-in |
| 33 // used to obtain credentials. These should be persisted and used for subsequent | 34 // used to obtain credentials. These should be persisted and used for subsequent |
| 34 // check-ins. | 35 // check-ins. |
| 35 class GCM_EXPORT CheckinRequest : public net::URLFetcherDelegate { | 36 class GCM_EXPORT CheckinRequest : public net::URLFetcherDelegate { |
| 36 public: | 37 public: |
| 37 // A callback function for the checkin request, accepting |checkin_response| | 38 // A callback function for the checkin request, accepting |checkin_response| |
| 38 // protobuf. | 39 // protobuf. |
| 39 typedef base::Callback<void(const checkin_proto::AndroidCheckinResponse& | 40 typedef base::Callback<void( |
| 40 checkin_response)> CheckinRequestCallback; | 41 net::HttpStatusCode response_code, |
| 42 const checkin_proto::AndroidCheckinResponse& checkin_response)> |
| 43 CheckinRequestCallback; |
| 41 | 44 |
| 42 // Checkin request details. | 45 // Checkin request details. |
| 43 struct GCM_EXPORT RequestInfo { | 46 struct GCM_EXPORT RequestInfo { |
| 44 RequestInfo(uint64_t android_id, | 47 RequestInfo(uint64_t android_id, |
| 45 uint64_t security_token, | 48 uint64_t security_token, |
| 46 const std::map<std::string, std::string>& account_tokens, | 49 const std::map<std::string, std::string>& account_tokens, |
| 47 const std::string& settings_digest, | 50 const std::string& settings_digest, |
| 48 const checkin_proto::ChromeBuildProto& chrome_build_proto); | 51 const checkin_proto::ChromeBuildProto& chrome_build_proto); |
| 49 RequestInfo(const RequestInfo& other); | 52 RequestInfo(const RequestInfo& other); |
| 50 ~RequestInfo(); | 53 ~RequestInfo(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 GCMStatsRecorder* recorder_; | 94 GCMStatsRecorder* recorder_; |
| 92 | 95 |
| 93 base::WeakPtrFactory<CheckinRequest> weak_ptr_factory_; | 96 base::WeakPtrFactory<CheckinRequest> weak_ptr_factory_; |
| 94 | 97 |
| 95 DISALLOW_COPY_AND_ASSIGN(CheckinRequest); | 98 DISALLOW_COPY_AND_ASSIGN(CheckinRequest); |
| 96 }; | 99 }; |
| 97 | 100 |
| 98 } // namespace gcm | 101 } // namespace gcm |
| 99 | 102 |
| 100 #endif // GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ | 103 #endif // GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ |
| OLD | NEW |