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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 for (size_t i = 0; i + 1 < data_keys_and_values.size(); i += 2) { | 81 for (size_t i = 0; i + 1 < data_keys_and_values.size(); i += 2) { |
82 message.data[data_keys_and_values[i]] = data_keys_and_values[i+1]; | 82 message.data[data_keys_and_values[i]] = data_keys_and_values[i+1]; |
83 } | 83 } |
84 // Convert j_raw_data from byte[] to binary std::string. | 84 // Convert j_raw_data from byte[] to binary std::string. |
85 if (j_raw_data) { | 85 if (j_raw_data) { |
86 std::vector<uint8_t> raw_data; | 86 std::vector<uint8_t> raw_data; |
87 JavaByteArrayToByteVector(env, j_raw_data, &raw_data); | 87 JavaByteArrayToByteVector(env, j_raw_data, &raw_data); |
88 message.raw_data.assign(raw_data.begin(), raw_data.end()); | 88 message.raw_data.assign(raw_data.begin(), raw_data.end()); |
89 } | 89 } |
90 | 90 |
91 GetAppHandler(app_id)->OnMessage(app_id, message); | 91 DispatchMessage(app_id, message); |
92 } | 92 } |
93 | 93 |
94 void GCMDriverAndroid::OnMessagesDeleted(JNIEnv* env, | 94 void GCMDriverAndroid::OnMessagesDeleted(JNIEnv* env, |
95 jobject obj, | 95 jobject obj, |
96 jstring j_app_id) { | 96 jstring j_app_id) { |
97 std::string app_id = ConvertJavaStringToUTF8(env, j_app_id); | 97 std::string app_id = ConvertJavaStringToUTF8(env, j_app_id); |
98 | 98 |
99 GetAppHandler(app_id)->OnMessagesDeleted(app_id); | 99 GetAppHandler(app_id)->OnMessagesDeleted(app_id); |
100 } | 100 } |
101 | 101 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ConvertUTF8ToJavaString(env, sender_id).Release()); | 215 ConvertUTF8ToJavaString(env, sender_id).Release()); |
216 } | 216 } |
217 | 217 |
218 void GCMDriverAndroid::SendImpl(const std::string& app_id, | 218 void GCMDriverAndroid::SendImpl(const std::string& app_id, |
219 const std::string& receiver_id, | 219 const std::string& receiver_id, |
220 const OutgoingMessage& message) { | 220 const OutgoingMessage& message) { |
221 NOTIMPLEMENTED(); | 221 NOTIMPLEMENTED(); |
222 } | 222 } |
223 | 223 |
224 } // namespace gcm | 224 } // namespace gcm |
OLD | NEW |