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 // |use_subtype|: whether to register |app_id| as a "subtype" of a package |
| 66 // name auto-generated based on Chrome's app name & channel. |
| 67 // Must be true on Android. |
65 // |handler|: provides the GCM functionality needed to support Instance ID. | 68 // |handler|: provides the GCM functionality needed to support Instance ID. |
66 // Must outlive this class. On Android, this can be null instead. | 69 // Must outlive this class. On Android, this can be null instead. |
67 static std::unique_ptr<InstanceID> Create(const std::string& app_id, | 70 static std::unique_ptr<InstanceID> CreateInternal(const std::string& app_id, |
68 gcm::GCMDriver* gcm_driver); | 71 bool use_subtype, |
| 72 gcm::GCMDriver* gcm_driver); |
69 | 73 |
70 virtual ~InstanceID(); | 74 virtual ~InstanceID(); |
71 | 75 |
72 // Sets the callback that will be invoked when the token refresh event needs | 76 // Sets the callback that will be invoked when the token refresh event needs |
73 // to be triggered. | 77 // to be triggered. |
74 void SetTokenRefreshCallback(const TokenRefreshCallback& callback); | 78 void SetTokenRefreshCallback(const TokenRefreshCallback& callback); |
75 | 79 |
76 // Returns the Instance ID. | 80 // Returns the Instance ID. |
77 virtual void GetID(const GetIDCallback& callback) = 0; | 81 virtual void GetID(const GetIDCallback& callback) = 0; |
78 | 82 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 TokenRefreshCallback token_refresh_callback_; | 148 TokenRefreshCallback token_refresh_callback_; |
145 | 149 |
146 base::WeakPtrFactory<InstanceID> weak_ptr_factory_; | 150 base::WeakPtrFactory<InstanceID> weak_ptr_factory_; |
147 | 151 |
148 DISALLOW_COPY_AND_ASSIGN(InstanceID); | 152 DISALLOW_COPY_AND_ASSIGN(InstanceID); |
149 }; | 153 }; |
150 | 154 |
151 } // namespace instance_id | 155 } // namespace instance_id |
152 | 156 |
153 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ | 157 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_ |
OLD | NEW |