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_UNREGISTRATION_REQUEST_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ |
6 #define GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // response | 43 // response |
44 // body. | 44 // body. |
45 INCORRECT_APP_ID, // App ID returned by the fetcher does not match | 45 INCORRECT_APP_ID, // App ID returned by the fetcher does not match |
46 // request. | 46 // request. |
47 INVALID_PARAMETERS, // Request parameters were invalid. | 47 INVALID_PARAMETERS, // Request parameters were invalid. |
48 SERVICE_UNAVAILABLE, // Unregistration service unavailable. | 48 SERVICE_UNAVAILABLE, // Unregistration service unavailable. |
49 INTERNAL_SERVER_ERROR, // Internal server error happened during request. | 49 INTERNAL_SERVER_ERROR, // Internal server error happened during request. |
50 HTTP_NOT_OK, // HTTP response code was not OK. | 50 HTTP_NOT_OK, // HTTP response code was not OK. |
51 UNKNOWN_ERROR, // Unknown error. | 51 UNKNOWN_ERROR, // Unknown error. |
52 REACHED_MAX_RETRIES, // Reached maximum number of retries. | 52 REACHED_MAX_RETRIES, // Reached maximum number of retries. |
| 53 DEVICE_REGISTRATION_ERROR,// Chrome is not properly registered. |
53 // NOTE: Always keep this entry at the end. Add new status types only | 54 // NOTE: Always keep this entry at the end. Add new status types only |
54 // immediately above this line. Make sure to update the corresponding | 55 // immediately above this line. Make sure to update the corresponding |
55 // histogram enum accordingly. | 56 // histogram enum accordingly. |
56 UNREGISTRATION_STATUS_COUNT, | 57 UNREGISTRATION_STATUS_COUNT, |
57 }; | 58 }; |
58 | 59 |
59 // Callback completing the unregistration request. | 60 // Callback completing the unregistration request. |
60 typedef base::Callback<void(Status success)> UnregistrationCallback; | 61 typedef base::Callback<void(Status success)> UnregistrationCallback; |
61 | 62 |
62 // Defines the common info about an unregistration/token-deletion request. | 63 // Defines the common info about an unregistration/token-deletion request. |
(...skipping 26 matching lines...) Expand all Loading... |
89 CustomRequestHandler(); | 90 CustomRequestHandler(); |
90 virtual ~CustomRequestHandler(); | 91 virtual ~CustomRequestHandler(); |
91 | 92 |
92 // Builds the HTTP request body data. It is called after | 93 // Builds the HTTP request body data. It is called after |
93 // UnregistrationRequest::BuildRequestBody to append more custom info to | 94 // UnregistrationRequest::BuildRequestBody to append more custom info to |
94 // |body|. Note that the request body is encoded in HTTP form format. | 95 // |body|. Note that the request body is encoded in HTTP form format. |
95 virtual void BuildRequestBody(std::string* body) = 0; | 96 virtual void BuildRequestBody(std::string* body) = 0; |
96 | 97 |
97 // Parses the HTTP response. It is called after | 98 // Parses the HTTP response. It is called after |
98 // UnregistrationRequest::ParseResponse to proceed the parsing. | 99 // UnregistrationRequest::ParseResponse to proceed the parsing. |
99 virtual Status ParseResponse(const net::URLFetcher* source) = 0; | 100 virtual Status ParseResponse(std::string response) = 0; |
100 | 101 |
101 // Reports various UMAs, including status, retry count and completion time. | 102 // Reports various UMAs, including status, retry count and completion time. |
102 virtual void ReportUMAs(Status status, | 103 virtual void ReportUMAs(Status status, |
103 int retry_count, | 104 int retry_count, |
104 base::TimeDelta complete_time) = 0; | 105 base::TimeDelta complete_time) = 0; |
105 }; | 106 }; |
106 | 107 |
107 // Creates an instance of UnregistrationRequest. |callback| will be called | 108 // Creates an instance of UnregistrationRequest. |callback| will be called |
108 // once registration has been revoked or there has been an error that makes | 109 // once registration has been revoked or there has been an error that makes |
109 // further retries pointless. | 110 // further retries pointless. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 std::string source_to_record_; | 150 std::string source_to_record_; |
150 | 151 |
151 base::WeakPtrFactory<UnregistrationRequest> weak_ptr_factory_; | 152 base::WeakPtrFactory<UnregistrationRequest> weak_ptr_factory_; |
152 | 153 |
153 DISALLOW_COPY_AND_ASSIGN(UnregistrationRequest); | 154 DISALLOW_COPY_AND_ASSIGN(UnregistrationRequest); |
154 }; | 155 }; |
155 | 156 |
156 } // namespace gcm | 157 } // namespace gcm |
157 | 158 |
158 #endif // GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ | 159 #endif // GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ |
OLD | NEW |