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_ANDROID_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_ANDROID_H_ |
6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_ANDROID_H_ | 6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/id_map.h" | 16 #include "base/id_map.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "components/gcm_driver/instance_id/instance_id.h" | 20 #include "components/gcm_driver/instance_id/instance_id.h" |
21 | 21 |
22 namespace instance_id { | 22 namespace instance_id { |
23 | 23 |
24 // InstanceID implementation for Android. | 24 // InstanceID implementation for Android. |
25 class InstanceIDAndroid : public InstanceID { | 25 class InstanceIDAndroid : public InstanceID { |
26 public: | 26 public: |
27 // Register JNI methods. | 27 // Register JNI methods. |
28 static bool RegisterBindings(JNIEnv* env); | 28 static bool RegisterBindings(JNIEnv* env); |
29 | 29 |
| 30 static void ClearDataAndSetUseFakeForTesting(bool use_fake); |
| 31 |
30 InstanceIDAndroid(const std::string& app_id); | 32 InstanceIDAndroid(const std::string& app_id); |
31 ~InstanceIDAndroid() override; | 33 ~InstanceIDAndroid() override; |
32 | 34 |
33 // InstanceID implementation: | 35 // InstanceID implementation: |
34 void GetID(const GetIDCallback& callback) override; | 36 void GetID(const GetIDCallback& callback) override; |
35 void GetCreationTime(const GetCreationTimeCallback& callback) override; | 37 void GetCreationTime(const GetCreationTimeCallback& callback) override; |
36 void GetToken(const std::string& audience, | 38 void GetToken(const std::string& audience, |
37 const std::string& scope, | 39 const std::string& scope, |
38 const std::map<std::string, std::string>& options, | 40 const std::map<std::string, std::string>& options, |
39 const GetTokenCallback& callback) override; | 41 const GetTokenCallback& callback) override; |
(...skipping 24 matching lines...) Expand all Loading... |
64 IDMap<DeleteIDCallback, IDMapOwnPointer> delete_id_callbacks_; | 66 IDMap<DeleteIDCallback, IDMapOwnPointer> delete_id_callbacks_; |
65 | 67 |
66 base::ThreadChecker thread_checker_; | 68 base::ThreadChecker thread_checker_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(InstanceIDAndroid); | 70 DISALLOW_COPY_AND_ASSIGN(InstanceIDAndroid); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace instance_id | 73 } // namespace instance_id |
72 | 74 |
73 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_ANDROID_H_ | 75 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_ANDROID_H_ |
OLD | NEW |