Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gcm_driver_android.h" | 5 #include "components/gcm_driver/gcm_driver_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/android/context_utils.h" | 10 #include "base/android/context_utils.h" |
| 11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 12 #include "base/android/jni_array.h" | 12 #include "base/android/jni_array.h" |
| 13 #include "base/android/jni_string.h" | 13 #include "base/android/jni_string.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | |
| 16 #include "jni/GCMDriver_jni.h" | 17 #include "jni/GCMDriver_jni.h" |
| 17 | 18 |
| 18 using base::android::AppendJavaStringArrayToStringVector; | 19 using base::android::AppendJavaStringArrayToStringVector; |
| 19 using base::android::AttachCurrentThread; | 20 using base::android::AttachCurrentThread; |
| 20 using base::android::ConvertJavaStringToUTF8; | 21 using base::android::ConvertJavaStringToUTF8; |
| 21 using base::android::ConvertUTF8ToJavaString; | 22 using base::android::ConvertUTF8ToJavaString; |
| 22 using base::android::JavaByteArrayToByteVector; | 23 using base::android::JavaByteArrayToByteVector; |
| 23 using base::android::JavaParamRef; | 24 using base::android::JavaParamRef; |
| 24 | 25 |
| 25 namespace gcm { | 26 namespace gcm { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 message_byte_size); | 111 message_byte_size); |
| 111 | 112 |
| 112 DispatchMessage(app_id, message); | 113 DispatchMessage(app_id, message); |
| 113 } | 114 } |
| 114 | 115 |
| 115 // static | 116 // static |
| 116 bool GCMDriverAndroid::RegisterJni(JNIEnv* env) { | 117 bool GCMDriverAndroid::RegisterJni(JNIEnv* env) { |
| 117 return RegisterNativesImpl(env); | 118 return RegisterNativesImpl(env); |
| 118 } | 119 } |
| 119 | 120 |
| 121 void GCMDriverAndroid::ValidateRegistration( | |
| 122 const std::string& app_id, | |
| 123 const std::vector<std::string>& sender_ids, | |
| 124 const std::string& registration_id, | |
| 125 const ValidateRegistrationCallback& callback) { | |
| 126 // gcm_driver doesn't store registration IDs on Android, so assume it's valid. | |
|
Peter Beverloo
2017/03/20 23:50:13
Is there something we could do here long-term, lik
johnme
2017/03/30 18:36:38
No, GMSCore has a cache, but it expires, and there
| |
| 127 base::ThreadTaskRunnerHandle::Get()->PostTask( | |
| 128 FROM_HERE, base::Bind(callback, true /* is_valid */)); | |
| 129 } | |
| 130 | |
| 120 void GCMDriverAndroid::OnSignedIn() { | 131 void GCMDriverAndroid::OnSignedIn() { |
| 121 } | 132 } |
| 122 | 133 |
| 123 void GCMDriverAndroid::OnSignedOut() { | 134 void GCMDriverAndroid::OnSignedOut() { |
| 124 } | 135 } |
| 125 | 136 |
| 126 void GCMDriverAndroid::AddConnectionObserver(GCMConnectionObserver* observer) { | 137 void GCMDriverAndroid::AddConnectionObserver(GCMConnectionObserver* observer) { |
| 127 } | 138 } |
| 128 | 139 |
| 129 void GCMDriverAndroid::RemoveConnectionObserver( | 140 void GCMDriverAndroid::RemoveConnectionObserver( |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 NOTIMPLEMENTED(); | 271 NOTIMPLEMENTED(); |
| 261 } | 272 } |
| 262 | 273 |
| 263 void GCMDriverAndroid::RecordDecryptionFailure( | 274 void GCMDriverAndroid::RecordDecryptionFailure( |
| 264 const std::string& app_id, | 275 const std::string& app_id, |
| 265 GCMEncryptionProvider::DecryptionResult result) { | 276 GCMEncryptionProvider::DecryptionResult result) { |
| 266 recorder_.RecordDecryptionFailure(app_id, result); | 277 recorder_.RecordDecryptionFailure(app_id, result); |
| 267 } | 278 } |
| 268 | 279 |
| 269 } // namespace gcm | 280 } // namespace gcm |
| OLD | NEW |