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 <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 GetCreationTimeCallback; | 53 GetCreationTimeCallback; |
54 typedef base::Callback<void(const std::string& token, | 54 typedef base::Callback<void(const std::string& token, |
55 Result result)> GetTokenCallback; | 55 Result result)> GetTokenCallback; |
56 typedef base::Callback<void(const std::string&, const std::string&)> | 56 typedef base::Callback<void(const std::string&, const std::string&)> |
57 GetEncryptionInfoCallback; | 57 GetEncryptionInfoCallback; |
58 typedef base::Callback<void(Result result)> DeleteTokenCallback; | 58 typedef base::Callback<void(Result result)> DeleteTokenCallback; |
59 typedef base::Callback<void(Result result)> DeleteIDCallback; | 59 typedef base::Callback<void(Result result)> DeleteIDCallback; |
60 | 60 |
61 static const int kInstanceIDByteLength = 8; | 61 static const int kInstanceIDByteLength = 8; |
62 | 62 |
63 // Creator. | 63 // Creator. Should only be used by InstanceIDDriver::GetInstanceID. |
64 // |app_id|: identifies the application that uses the Instance ID. | 64 // |app_id|: identifies the application that uses the Instance ID. |
65 // |handler|: provides the GCM functionality needed to support Instance ID. | 65 // |handler|: provides the GCM functionality needed to support Instance ID. |
66 // Must outlive this class. On Android, this can be null instead. | 66 // Must outlive this class. On Android, this can be null instead. |
67 static std::unique_ptr<InstanceID> Create(const std::string& app_id, | 67 static std::unique_ptr<InstanceID> CreateInternal(const std::string& app_id, |
68 gcm::GCMDriver* gcm_driver); | 68 gcm::GCMDriver* gcm_driver); |
69 | 69 |
70 virtual ~InstanceID(); | 70 virtual ~InstanceID(); |
71 | 71 |
72 // Sets the callback that will be invoked when the token refresh event needs | 72 // Sets the callback that will be invoked when the token refresh event needs |
73 // to be triggered. | 73 // to be triggered. |
74 void SetTokenRefreshCallback(const TokenRefreshCallback& callback); | 74 void SetTokenRefreshCallback(const TokenRefreshCallback& callback); |
75 | 75 |
76 // Returns the Instance ID. | 76 // Returns the Instance ID. |
77 virtual void GetID(const GetIDCallback& callback) = 0; | 77 virtual void GetID(const GetIDCallback& callback) = 0; |
78 | 78 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 TokenRefreshCallback token_refresh_callback_; | 144 TokenRefreshCallback token_refresh_callback_; |
145 | 145 |
146 base::WeakPtrFactory<InstanceID> weak_ptr_factory_; | 146 base::WeakPtrFactory<InstanceID> weak_ptr_factory_; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(InstanceID); | 148 DISALLOW_COPY_AND_ASSIGN(InstanceID); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace instance_id | 151 } // namespace instance_id |
152 | 152 |
153 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ | 153 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ |
OLD | NEW |