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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 void GCMDriverAndroid::WakeFromSuspendForHeartbeat(bool wake) { | 162 void GCMDriverAndroid::WakeFromSuspendForHeartbeat(bool wake) { |
163 } | 163 } |
164 | 164 |
165 GCMClient::Result GCMDriverAndroid::EnsureStarted( | 165 GCMClient::Result GCMDriverAndroid::EnsureStarted( |
166 GCMClient::StartMode start_mode) { | 166 GCMClient::StartMode start_mode) { |
167 // TODO(johnme): Maybe we should check if GMS is available? | 167 // TODO(johnme): Maybe we should check if GMS is available? |
168 return GCMClient::SUCCESS; | 168 return GCMClient::SUCCESS; |
169 } | 169 } |
170 | 170 |
171 void GCMDriverAndroid::RegisterImpl( | 171 void GCMDriverAndroid::RegisterImpl( |
172 const std::string& app_id, | 172 const std::string& app_id, const std::vector<std::string>& sender_ids) { |
173 const std::vector<std::string>& sender_ids) { | 173 DCHECK_EQ(1u, sender_ids.size()); |
174 JNIEnv* env = AttachCurrentThread(); | 174 JNIEnv* env = AttachCurrentThread(); |
175 Java_GCMDriver_register( | 175 Java_GCMDriver_register( |
176 env, java_ref_.obj(), | 176 env, java_ref_.obj(), |
177 ConvertUTF8ToJavaString(env, app_id).Release(), | 177 ConvertUTF8ToJavaString(env, app_id).Release(), |
178 ToJavaArrayOfStrings(env, sender_ids).obj()); | 178 ConvertUTF8ToJavaString(env, sender_ids[0]).Release()); |
179 } | 179 } |
180 | 180 |
181 void GCMDriverAndroid::UnregisterImpl(const std::string& app_id) { | 181 void GCMDriverAndroid::UnregisterImpl(const std::string& app_id) { |
| 182 NOTREACHED(); |
| 183 } |
| 184 |
| 185 void GCMDriverAndroid::UnregisterWithSenderIdImpl( |
| 186 const std::string& app_id, const std::string& sender_id) { |
182 JNIEnv* env = AttachCurrentThread(); | 187 JNIEnv* env = AttachCurrentThread(); |
183 Java_GCMDriver_unregister( | 188 Java_GCMDriver_unregister( |
184 env, java_ref_.obj(), | 189 env, java_ref_.obj(), |
185 ConvertUTF8ToJavaString(env, app_id).Release()); | 190 ConvertUTF8ToJavaString(env, app_id).Release(), |
| 191 ConvertUTF8ToJavaString(env, sender_id).Release()); |
186 } | 192 } |
187 | 193 |
188 void GCMDriverAndroid::SendImpl(const std::string& app_id, | 194 void GCMDriverAndroid::SendImpl(const std::string& app_id, |
189 const std::string& receiver_id, | 195 const std::string& receiver_id, |
190 const GCMClient::OutgoingMessage& message) { | 196 const GCMClient::OutgoingMessage& message) { |
191 NOTIMPLEMENTED(); | 197 NOTIMPLEMENTED(); |
192 } | 198 } |
193 | 199 |
194 } // namespace gcm | 200 } // namespace gcm |
OLD | NEW |