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 #include "components/gcm_driver/instance_id/instance_id_android.h" | 5 #include "components/gcm_driver/instance_id/instance_id_android.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 JNIEnv* env = AttachCurrentThread(); | 38 JNIEnv* env = AttachCurrentThread(); |
39 Java_InstanceIDBridge_setBlockOnAsyncTasksForTesting(env, previous_value_); | 39 Java_InstanceIDBridge_setBlockOnAsyncTasksForTesting(env, previous_value_); |
40 } | 40 } |
41 | 41 |
42 // static | 42 // static |
43 bool InstanceIDAndroid::RegisterJni(JNIEnv* env) { | 43 bool InstanceIDAndroid::RegisterJni(JNIEnv* env) { |
44 return RegisterNativesImpl(env); | 44 return RegisterNativesImpl(env); |
45 } | 45 } |
46 | 46 |
47 // static | 47 // static |
48 std::unique_ptr<InstanceID> InstanceID::Create(const std::string& app_id, | 48 std::unique_ptr<InstanceID> InstanceID::CreateInternal( |
49 gcm::GCMDriver* gcm_driver) { | 49 const std::string& app_id, |
| 50 gcm::GCMDriver* gcm_driver) { |
50 return base::WrapUnique(new InstanceIDAndroid(app_id, gcm_driver)); | 51 return base::WrapUnique(new InstanceIDAndroid(app_id, gcm_driver)); |
51 } | 52 } |
52 | 53 |
53 InstanceIDAndroid::InstanceIDAndroid(const std::string& app_id, | 54 InstanceIDAndroid::InstanceIDAndroid(const std::string& app_id, |
54 gcm::GCMDriver* gcm_driver) | 55 gcm::GCMDriver* gcm_driver) |
55 : InstanceID(app_id, gcm_driver) { | 56 : InstanceID(app_id, gcm_driver) { |
56 DCHECK(thread_checker_.CalledOnValidThread()); | 57 DCHECK(thread_checker_.CalledOnValidThread()); |
57 | 58 |
58 DCHECK(!app_id.empty()) << "Empty app_id is not supported"; | 59 DCHECK(!app_id.empty()) << "Empty app_id is not supported"; |
59 // The |app_id| is stored in GCM's category field by the desktop InstanceID | 60 // The |app_id| is stored in GCM's category field by the desktop InstanceID |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 jboolean success) { | 213 jboolean success) { |
213 DCHECK(thread_checker_.CalledOnValidThread()); | 214 DCHECK(thread_checker_.CalledOnValidThread()); |
214 | 215 |
215 DeleteIDCallback* callback = delete_id_callbacks_.Lookup(request_id); | 216 DeleteIDCallback* callback = delete_id_callbacks_.Lookup(request_id); |
216 DCHECK(callback); | 217 DCHECK(callback); |
217 callback->Run(success ? InstanceID::SUCCESS : InstanceID::UNKNOWN_ERROR); | 218 callback->Run(success ? InstanceID::SUCCESS : InstanceID::UNKNOWN_ERROR); |
218 delete_id_callbacks_.Remove(request_id); | 219 delete_id_callbacks_.Remove(request_id); |
219 } | 220 } |
220 | 221 |
221 } // namespace instance_id | 222 } // namespace instance_id |
OLD | NEW |