Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: components/gcm_driver/instance_id/instance_id_android.cc

Issue 2111973002: Add support for GCM subtypes to desktop Instance ID implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid9push
Patch Set: Fix thestig nits and Chrome OS compile Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698