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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. |
63 // All parameters are mandatory. | 63 // All parameters are mandatory. |
64 struct GCM_EXPORT RequestInfo { | 64 struct GCM_EXPORT RequestInfo { |
65 RequestInfo(uint64_t android_id, | 65 RequestInfo(uint64_t android_id, |
66 uint64_t security_token, | 66 uint64_t security_token, |
67 const std::string& app_id); | 67 const std::string& category, |
| 68 const std::string& subtype); |
68 ~RequestInfo(); | 69 ~RequestInfo(); |
69 | 70 |
70 // Android ID of the device. | 71 // Android ID of the device. |
71 uint64_t android_id; | 72 uint64_t android_id; |
72 // Security token of the device. | 73 // Security token of the device. |
73 uint64_t security_token; | 74 uint64_t security_token; |
74 // Application ID. | 75 |
75 std::string app_id; | 76 // Application ID used in Chrome to refer to registration/token's owner. |
| 77 const std::string& app_id() { return subtype.empty() ? category : subtype; } |
| 78 |
| 79 // GCM category field derived from the |app_id|. |
| 80 std::string category; |
| 81 // GCM subtype field derived from the |app_id|. |
| 82 std::string subtype; |
76 }; | 83 }; |
77 | 84 |
78 // Encapsulates the custom logic that is needed to build and process the | 85 // Encapsulates the custom logic that is needed to build and process the |
79 // unregistration request. | 86 // unregistration request. |
80 class GCM_EXPORT CustomRequestHandler { | 87 class GCM_EXPORT CustomRequestHandler { |
81 public: | 88 public: |
82 CustomRequestHandler(); | 89 CustomRequestHandler(); |
83 virtual ~CustomRequestHandler(); | 90 virtual ~CustomRequestHandler(); |
84 | 91 |
85 // Builds the HTTP request body data. It is called after | 92 // Builds the HTTP request body data. It is called after |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 std::string source_to_record_; | 149 std::string source_to_record_; |
143 | 150 |
144 base::WeakPtrFactory<UnregistrationRequest> weak_ptr_factory_; | 151 base::WeakPtrFactory<UnregistrationRequest> weak_ptr_factory_; |
145 | 152 |
146 DISALLOW_COPY_AND_ASSIGN(UnregistrationRequest); | 153 DISALLOW_COPY_AND_ASSIGN(UnregistrationRequest); |
147 }; | 154 }; |
148 | 155 |
149 } // namespace gcm | 156 } // namespace gcm |
150 | 157 |
151 #endif // GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ | 158 #endif // GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ |
OLD | NEW |