| 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 27 matching lines...) Expand all Loading... |
| 38 typedef base::Callback<void(InstanceID* instance_id, | 38 typedef base::Callback<void(InstanceID* instance_id, |
| 39 bool update_id)> TokenRefreshCallback; | 39 bool update_id)> TokenRefreshCallback; |
| 40 typedef base::Callback<void(InstanceID* instance_id, | 40 typedef base::Callback<void(InstanceID* instance_id, |
| 41 const std::string& token, | 41 const std::string& token, |
| 42 Result result)> GetTokenCallback; | 42 Result result)> GetTokenCallback; |
| 43 typedef base::Callback<void(InstanceID* instance_id, | 43 typedef base::Callback<void(InstanceID* instance_id, |
| 44 Result result)> DeleteTokenCallback; | 44 Result result)> DeleteTokenCallback; |
| 45 typedef base::Callback<void(InstanceID* instance_id, | 45 typedef base::Callback<void(InstanceID* instance_id, |
| 46 Result result)> DeleteIDCallback; | 46 Result result)> DeleteIDCallback; |
| 47 | 47 |
| 48 static const int kInstanceIDByteLength = 8; |
| 49 |
| 48 // Creator. | 50 // Creator. |
| 49 // |app_id|: identifies the application that uses the Instance ID. | 51 // |app_id|: identifies the application that uses the Instance ID. |
| 50 // |callback|: to be called when the token refresh is needed. | 52 // |callback|: to be called when the token refresh is needed. |
| 51 static InstanceID* Create(const std::string& app_id); | 53 static InstanceID* Create(const std::string& app_id); |
| 52 | 54 |
| 53 virtual ~InstanceID(); | 55 virtual ~InstanceID(); |
| 54 | 56 |
| 55 // Sets the callback that will be invoked when the token refresh event needs | 57 // Sets the callback that will be invoked when the token refresh event needs |
| 56 // to be triggered. | 58 // to be triggered. |
| 57 void SetTokenRefreshCallback(const TokenRefreshCallback& callback); | 59 void SetTokenRefreshCallback(const TokenRefreshCallback& callback); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 private: | 103 private: |
| 102 std::string app_id_; | 104 std::string app_id_; |
| 103 TokenRefreshCallback token_refresh_callback_; | 105 TokenRefreshCallback token_refresh_callback_; |
| 104 | 106 |
| 105 DISALLOW_COPY_AND_ASSIGN(InstanceID); | 107 DISALLOW_COPY_AND_ASSIGN(InstanceID); |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 } // namespace instance_id | 110 } // namespace instance_id |
| 109 | 111 |
| 110 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ | 112 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ |
| OLD | NEW |