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

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

Issue 2697793004: Push API: Validate storage before returning cached subscriptions (Closed)
Patch Set: Fix include Created 3 years, 8 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 JNIEnv* env = AttachCurrentThread(); 116 JNIEnv* env = AttachCurrentThread();
117 Java_InstanceIDBridge_getToken( 117 Java_InstanceIDBridge_getToken(
118 env, java_ref_, request_id, 118 env, java_ref_, request_id,
119 ConvertUTF8ToJavaString(env, authorized_entity), 119 ConvertUTF8ToJavaString(env, authorized_entity),
120 ConvertUTF8ToJavaString(env, scope), 120 ConvertUTF8ToJavaString(env, scope),
121 base::android::ToJavaArrayOfStrings(env, options_strings)); 121 base::android::ToJavaArrayOfStrings(env, options_strings));
122 } 122 }
123 123
124 void InstanceIDAndroid::ValidateToken(const std::string& authorized_entity,
125 const std::string& scope,
126 const std::string& token,
127 const ValidateTokenCallback& callback) {
128 // gcm_driver doesn't store tokens on Android, so assume it's valid.
129 base::ThreadTaskRunnerHandle::Get()->PostTask(
130 FROM_HERE, base::Bind(callback, true /* is_valid */));
131 }
132
124 void InstanceIDAndroid::DeleteTokenImpl(const std::string& authorized_entity, 133 void InstanceIDAndroid::DeleteTokenImpl(const std::string& authorized_entity,
125 const std::string& scope, 134 const std::string& scope,
126 const DeleteTokenCallback& callback) { 135 const DeleteTokenCallback& callback) {
127 DCHECK(thread_checker_.CalledOnValidThread()); 136 DCHECK(thread_checker_.CalledOnValidThread());
128 137
129 int32_t request_id = delete_token_callbacks_.Add( 138 int32_t request_id = delete_token_callbacks_.Add(
130 base::MakeUnique<DeleteTokenCallback>(callback)); 139 base::MakeUnique<DeleteTokenCallback>(callback));
131 140
132 JNIEnv* env = AttachCurrentThread(); 141 JNIEnv* env = AttachCurrentThread();
133 Java_InstanceIDBridge_deleteToken( 142 Java_InstanceIDBridge_deleteToken(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 jboolean success) { 225 jboolean success) {
217 DCHECK(thread_checker_.CalledOnValidThread()); 226 DCHECK(thread_checker_.CalledOnValidThread());
218 227
219 DeleteIDCallback* callback = delete_id_callbacks_.Lookup(request_id); 228 DeleteIDCallback* callback = delete_id_callbacks_.Lookup(request_id);
220 DCHECK(callback); 229 DCHECK(callback);
221 callback->Run(success ? InstanceID::SUCCESS : InstanceID::UNKNOWN_ERROR); 230 callback->Run(success ? InstanceID::SUCCESS : InstanceID::UNKNOWN_ERROR);
222 delete_id_callbacks_.Remove(request_id); 231 delete_id_callbacks_.Remove(request_id);
223 } 232 }
224 233
225 } // namespace instance_id 234 } // namespace instance_id
OLDNEW
« no previous file with comments | « components/gcm_driver/instance_id/instance_id_android.h ('k') | components/gcm_driver/instance_id/instance_id_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698