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_IMPL_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_ |
6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_ | 6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 void GetToken(const std::string& authorized_entity, | 36 void GetToken(const std::string& authorized_entity, |
37 const std::string& scope, | 37 const std::string& scope, |
38 const std::map<std::string, std::string>& options, | 38 const std::map<std::string, std::string>& options, |
39 const GetTokenCallback& callback) override; | 39 const GetTokenCallback& callback) override; |
40 void DeleteToken(const std::string& authorized_entity, | 40 void DeleteToken(const std::string& authorized_entity, |
41 const std::string& scope, | 41 const std::string& scope, |
42 const DeleteTokenCallback& callback) override; | 42 const DeleteTokenCallback& callback) override; |
43 void DeleteID(const DeleteIDCallback& callback) override; | 43 void DeleteID(const DeleteIDCallback& callback) override; |
44 | 44 |
45 private: | 45 private: |
46 gcm::InstanceIDHandler* GetInstanceIDHandler() const; | |
47 | |
48 void EnsureIDGenerated(); | 46 void EnsureIDGenerated(); |
49 | 47 |
50 void OnGetTokenCompleted(const GetTokenCallback& callback, | 48 void OnGetTokenCompleted(const GetTokenCallback& callback, |
51 const std::string& token, | 49 const std::string& token, |
52 gcm::GCMClient::Result result); | 50 gcm::GCMClient::Result result); |
53 void OnDeleteTokenCompleted(const DeleteTokenCallback& callback, | 51 void OnDeleteTokenCompleted(const DeleteTokenCallback& callback, |
54 gcm::GCMClient::Result result); | 52 gcm::GCMClient::Result result); |
55 void OnDeleteIDCompleted(const DeleteIDCallback& callback, | 53 void OnDeleteIDCompleted(const DeleteIDCallback& callback, |
56 gcm::GCMClient::Result result); | 54 gcm::GCMClient::Result result); |
57 void GetInstanceIDDataCompleted(const std::string& instance_id, | 55 void GetInstanceIDDataCompleted(const std::string& instance_id, |
58 const std::string& extra_data); | 56 const std::string& extra_data); |
59 | 57 |
60 void DoGetID(const GetIDCallback& callback); | 58 void DoGetID(const GetIDCallback& callback); |
61 void DoGetCreationTime(const GetCreationTimeCallback& callback); | 59 void DoGetCreationTime(const GetCreationTimeCallback& callback); |
62 void DoGetToken( | 60 void DoGetToken( |
63 const std::string& authorized_entity, | 61 const std::string& authorized_entity, |
64 const std::string& scope, | 62 const std::string& scope, |
65 const std::map<std::string, std::string>& options, | 63 const std::map<std::string, std::string>& options, |
66 const GetTokenCallback& callback); | 64 const GetTokenCallback& callback); |
67 void DoDeleteToken(const std::string& authorized_entity, | 65 void DoDeleteToken(const std::string& authorized_entity, |
68 const std::string& scope, | 66 const std::string& scope, |
69 const DeleteTokenCallback& callback); | 67 const DeleteTokenCallback& callback); |
70 void DoDeleteID(const DeleteIDCallback& callback); | 68 void DoDeleteID(const DeleteIDCallback& callback); |
71 | 69 |
72 gcm::GCMDriver* gcm_driver_; // Not owned. | |
73 | |
74 gcm::GCMDelayedTaskController delayed_task_controller_; | 70 gcm::GCMDelayedTaskController delayed_task_controller_; |
75 | 71 |
76 // The generated Instance ID. | 72 // The generated Instance ID. |
77 std::string id_; | 73 std::string id_; |
78 | 74 |
79 // The time when the Instance ID has been generated. | 75 // The time when the Instance ID has been generated. |
80 base::Time creation_time_; | 76 base::Time creation_time_; |
81 | 77 |
82 base::WeakPtrFactory<InstanceIDImpl> weak_ptr_factory_; | 78 base::WeakPtrFactory<InstanceIDImpl> weak_ptr_factory_; |
83 | 79 |
84 DISALLOW_COPY_AND_ASSIGN(InstanceIDImpl); | 80 DISALLOW_COPY_AND_ASSIGN(InstanceIDImpl); |
85 }; | 81 }; |
86 | 82 |
87 } // namespace instance_id | 83 } // namespace instance_id |
88 | 84 |
89 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_ | 85 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_ |
OLD | NEW |