Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: google_apis/gcm/engine/unregistration_request.h

Issue 2434243002: GCM Engine: Split up reg/unreg UNKNOWN_ERROR to improve metrics (Closed)
Patch Set: mid-cycle -> mid-beta Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 22 matching lines...) Expand all
33 // TODO(fgorski): Consider sharing code with RegistrationRequest if possible. 33 // TODO(fgorski): Consider sharing code with RegistrationRequest if possible.
34 class GCM_EXPORT UnregistrationRequest : public net::URLFetcherDelegate { 34 class GCM_EXPORT UnregistrationRequest : public net::URLFetcherDelegate {
35 public: 35 public:
36 // Outcome of the response parsing. Note that these enums are consumed by a 36 // Outcome of the response parsing. Note that these enums are consumed by a
37 // histogram, so ordering should not be modified. 37 // histogram, so ordering should not be modified.
38 enum Status { 38 enum Status {
39 SUCCESS, // Unregistration completed successfully. 39 SUCCESS, // Unregistration completed successfully.
40 URL_FETCHING_FAILED, // URL fetching failed. 40 URL_FETCHING_FAILED, // URL fetching failed.
41 NO_RESPONSE_BODY, // No response body. 41 NO_RESPONSE_BODY, // No response body.
42 RESPONSE_PARSING_FAILED, // Failed to parse a meaningful output from 42 RESPONSE_PARSING_FAILED, // Failed to parse a meaningful output from
43 // response 43 // response body.
44 // body.
45 INCORRECT_APP_ID, // App ID returned by the fetcher does not match 44 INCORRECT_APP_ID, // App ID returned by the fetcher does not match
46 // request. 45 // request.
47 INVALID_PARAMETERS, // Request parameters were invalid. 46 INVALID_PARAMETERS, // Request parameters were invalid.
48 SERVICE_UNAVAILABLE, // Unregistration service unavailable. 47 SERVICE_UNAVAILABLE, // Unregistration service unavailable.
49 INTERNAL_SERVER_ERROR, // Internal server error happened during request. 48 INTERNAL_SERVER_ERROR, // Internal server error happened during request.
50 HTTP_NOT_OK, // HTTP response code was not OK. 49 HTTP_NOT_OK, // HTTP response code was not OK.
51 UNKNOWN_ERROR, // Unknown error. 50 UNKNOWN_ERROR, // Unknown error.
52 REACHED_MAX_RETRIES, // Reached maximum number of retries. 51 REACHED_MAX_RETRIES, // Reached maximum number of retries.
52 DEVICE_REGISTRATION_ERROR,// Chrome is not properly registered.
53 // NOTE: Always keep this entry at the end. Add new status types only 53 // NOTE: Always keep this entry at the end. Add new status types only
54 // immediately above this line. Make sure to update the corresponding 54 // immediately above this line. Make sure to update the corresponding
55 // histogram enum accordingly. 55 // histogram enum accordingly.
56 UNREGISTRATION_STATUS_COUNT, 56 UNREGISTRATION_STATUS_COUNT,
57 }; 57 };
58 58
59 // Callback completing the unregistration request. 59 // Callback completing the unregistration request.
60 typedef base::Callback<void(Status success)> UnregistrationCallback; 60 typedef base::Callback<void(Status success)> UnregistrationCallback;
61 61
62 // Defines the common info about an unregistration/token-deletion request. 62 // Defines the common info about an unregistration/token-deletion request.
(...skipping 26 matching lines...) Expand all
89 CustomRequestHandler(); 89 CustomRequestHandler();
90 virtual ~CustomRequestHandler(); 90 virtual ~CustomRequestHandler();
91 91
92 // Builds the HTTP request body data. It is called after 92 // Builds the HTTP request body data. It is called after
93 // UnregistrationRequest::BuildRequestBody to append more custom info to 93 // UnregistrationRequest::BuildRequestBody to append more custom info to
94 // |body|. Note that the request body is encoded in HTTP form format. 94 // |body|. Note that the request body is encoded in HTTP form format.
95 virtual void BuildRequestBody(std::string* body) = 0; 95 virtual void BuildRequestBody(std::string* body) = 0;
96 96
97 // Parses the HTTP response. It is called after 97 // Parses the HTTP response. It is called after
98 // UnregistrationRequest::ParseResponse to proceed the parsing. 98 // UnregistrationRequest::ParseResponse to proceed the parsing.
99 virtual Status ParseResponse(const net::URLFetcher* source) = 0; 99 virtual Status ParseResponse(const std::string& response) = 0;
100 100
101 // Reports various UMAs, including status, retry count and completion time. 101 // Reports various UMAs, including status, retry count and completion time.
102 virtual void ReportUMAs(Status status, 102 virtual void ReportUMAs(Status status,
103 int retry_count, 103 int retry_count,
104 base::TimeDelta complete_time) = 0; 104 base::TimeDelta complete_time) = 0;
105 }; 105 };
106 106
107 // Creates an instance of UnregistrationRequest. |callback| will be called 107 // Creates an instance of UnregistrationRequest. |callback| will be called
108 // once registration has been revoked or there has been an error that makes 108 // once registration has been revoked or there has been an error that makes
109 // further retries pointless. 109 // further retries pointless.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 std::string source_to_record_; 149 std::string source_to_record_;
150 150
151 base::WeakPtrFactory<UnregistrationRequest> weak_ptr_factory_; 151 base::WeakPtrFactory<UnregistrationRequest> weak_ptr_factory_;
152 152
153 DISALLOW_COPY_AND_ASSIGN(UnregistrationRequest); 153 DISALLOW_COPY_AND_ASSIGN(UnregistrationRequest);
154 }; 154 };
155 155
156 } // namespace gcm 156 } // namespace gcm
157 157
158 #endif // GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ 158 #endif // GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/registration_request_unittest.cc ('k') | google_apis/gcm/engine/unregistration_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698