| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ | 6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 DISABLED, | 32 DISABLED, |
| 33 // Network socket error. | 33 // Network socket error. |
| 34 NETWORK_ERROR, | 34 NETWORK_ERROR, |
| 35 // Problem at the server. | 35 // Problem at the server. |
| 36 SERVER_ERROR, | 36 SERVER_ERROR, |
| 37 // Other errors. | 37 // Other errors. |
| 38 UNKNOWN_ERROR | 38 UNKNOWN_ERROR |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Asynchronous callbacks. | 41 // Asynchronous callbacks. |
| 42 typedef base::Callback<void(InstanceID* instance_id, | 42 typedef base::Callback<void(const std::string& app_id, |
| 43 bool update_id)> TokenRefreshCallback; | 43 bool update_id)> TokenRefreshCallback; |
| 44 typedef base::Callback<void(InstanceID* instance_id, | 44 typedef base::Callback<void(const std::string& token, |
| 45 const std::string& token, | |
| 46 Result result)> GetTokenCallback; | 45 Result result)> GetTokenCallback; |
| 47 typedef base::Callback<void(InstanceID* instance_id, | 46 typedef base::Callback<void(Result result)> DeleteTokenCallback; |
| 48 Result result)> DeleteTokenCallback; | 47 typedef base::Callback<void(Result result)> DeleteIDCallback; |
| 49 typedef base::Callback<void(InstanceID* instance_id, | |
| 50 Result result)> DeleteIDCallback; | |
| 51 | 48 |
| 52 static const int kInstanceIDByteLength = 8; | 49 static const int kInstanceIDByteLength = 8; |
| 53 | 50 |
| 54 // Creator. | 51 // Creator. |
| 55 // |app_id|: identifies the application that uses the Instance ID. | 52 // |app_id|: identifies the application that uses the Instance ID. |
| 56 // |gcm_driver|: driver to access the GCM functionalities needed to support | 53 // |gcm_driver|: driver to access the GCM functionalities needed to support |
| 57 // Instance ID. | 54 // Instance ID. |
| 58 static InstanceID* Create(const std::string& app_id, | 55 static InstanceID* Create(const std::string& app_id, |
| 59 gcm::GCMDriver* gcm_driver); | 56 gcm::GCMDriver* gcm_driver); |
| 60 | 57 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 private: | 107 private: |
| 111 std::string app_id_; | 108 std::string app_id_; |
| 112 TokenRefreshCallback token_refresh_callback_; | 109 TokenRefreshCallback token_refresh_callback_; |
| 113 | 110 |
| 114 DISALLOW_COPY_AND_ASSIGN(InstanceID); | 111 DISALLOW_COPY_AND_ASSIGN(InstanceID); |
| 115 }; | 112 }; |
| 116 | 113 |
| 117 } // namespace instance_id | 114 } // namespace instance_id |
| 118 | 115 |
| 119 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ | 116 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ |
| OLD | NEW |