| 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 bool use_subtype, |
| 51 gcm::GCMDriver* gcm_driver) { |
| 52 CHECK(use_subtype) << "Android only supports InstanceIDs using subtypes"; |
| 50 return base::WrapUnique(new InstanceIDAndroid(app_id, gcm_driver)); | 53 return base::WrapUnique(new InstanceIDAndroid(app_id, gcm_driver)); |
| 51 } | 54 } |
| 52 | 55 |
| 53 InstanceIDAndroid::InstanceIDAndroid(const std::string& app_id, | 56 InstanceIDAndroid::InstanceIDAndroid(const std::string& app_id, |
| 54 gcm::GCMDriver* gcm_driver) | 57 gcm::GCMDriver* gcm_driver) |
| 55 : InstanceID(app_id, gcm_driver) { | 58 : InstanceID(app_id, gcm_driver) { |
| 56 DCHECK(thread_checker_.CalledOnValidThread()); | 59 DCHECK(thread_checker_.CalledOnValidThread()); |
| 57 | 60 |
| 58 DCHECK(!app_id.empty()) << "Empty app_id is not supported"; | 61 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 | 62 // 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) { | 215 jboolean success) { |
| 213 DCHECK(thread_checker_.CalledOnValidThread()); | 216 DCHECK(thread_checker_.CalledOnValidThread()); |
| 214 | 217 |
| 215 DeleteIDCallback* callback = delete_id_callbacks_.Lookup(request_id); | 218 DeleteIDCallback* callback = delete_id_callbacks_.Lookup(request_id); |
| 216 DCHECK(callback); | 219 DCHECK(callback); |
| 217 callback->Run(success ? InstanceID::SUCCESS : InstanceID::UNKNOWN_ERROR); | 220 callback->Run(success ? InstanceID::SUCCESS : InstanceID::UNKNOWN_ERROR); |
| 218 delete_id_callbacks_.Remove(request_id); | 221 delete_id_callbacks_.Remove(request_id); |
| 219 } | 222 } |
| 220 | 223 |
| 221 } // namespace instance_id | 224 } // namespace instance_id |
| OLD | NEW |