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

Side by Side Diff: components/gcm_driver/gcm_driver_android.cc

Issue 914693002: Push API: Fix unsubscribing from GCM on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment nits I missed earlier Created 5 years, 10 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 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
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 CHECK_EQ(1, 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(
182 const std::string& app_id, const std::vector<std::string>& sender_ids) {
183 CHECK_EQ(1, sender_ids.size());
182 JNIEnv* env = AttachCurrentThread(); 184 JNIEnv* env = AttachCurrentThread();
183 Java_GCMDriver_unregister( 185 Java_GCMDriver_unregister(
184 env, java_ref_.obj(), 186 env, java_ref_.obj(),
185 ConvertUTF8ToJavaString(env, app_id).Release()); 187 ConvertUTF8ToJavaString(env, app_id).Release(),
188 ConvertUTF8ToJavaString(env, sender_ids[0]).Release());
186 } 189 }
187 190
188 void GCMDriverAndroid::SendImpl(const std::string& app_id, 191 void GCMDriverAndroid::SendImpl(const std::string& app_id,
189 const std::string& receiver_id, 192 const std::string& receiver_id,
190 const GCMClient::OutgoingMessage& message) { 193 const GCMClient::OutgoingMessage& message) {
191 NOTIMPLEMENTED(); 194 NOTIMPLEMENTED();
192 } 195 }
193 196
194 } // namespace gcm 197 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698