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

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

Issue 2578583002: Provide a mechanism for the GCM driver to send message receipts to GCM.
Patch Set: Added a callback entry point to GCMDriver, moved MessageReceiptCallback to gcm_message_status. Created 3 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 <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"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 std::vector<uint8_t> raw_data; 102 std::vector<uint8_t> raw_data;
103 JavaByteArrayToByteVector(env, j_raw_data, &raw_data); 103 JavaByteArrayToByteVector(env, j_raw_data, &raw_data);
104 message.raw_data.assign(raw_data.begin(), raw_data.end()); 104 message.raw_data.assign(raw_data.begin(), raw_data.end());
105 105
106 message_byte_size += message.raw_data.size(); 106 message_byte_size += message.raw_data.size();
107 } 107 }
108 108
109 recorder_.RecordDataMessageReceived(app_id, message.sender_id, 109 recorder_.RecordDataMessageReceived(app_id, message.sender_id,
110 message_byte_size); 110 message_byte_size);
111 111
112 DispatchMessage(app_id, message); 112 DispatchMessage(app_id, message,
113 base::Bind(&GCMDriverAndroid::SendMessageReceipt,
114 weak_ptr_factory_.GetWeakPtr()));
115 }
116
117 void GCMDriverAndroid::DoSendMessageReceipt(
118 const MessageReceiptCallback& callback,
119 GCMMessageStatus status) {
120 // All of the GCMDriverAndroid calls run on the UI thread, so just run the
121 // callback directly.
122 callback.Run(status);
123 }
124
125 void GCMDriverAndroid::SendMessageReceipt(GCMMessageStatus status) {
126 // TODO(harkness) Implement message receipts in android. crbug.com/674131.
127 NOTIMPLEMENTED();
Peter Beverloo 2017/02/08 17:09:09 nit: drop the NOTIMPLEMENTED() -- that'll just spa
harkness 2017/02/09 16:27:30 Done.
113 } 128 }
114 129
115 // static 130 // static
116 bool GCMDriverAndroid::RegisterJni(JNIEnv* env) { 131 bool GCMDriverAndroid::RegisterJni(JNIEnv* env) {
117 return RegisterNativesImpl(env); 132 return RegisterNativesImpl(env);
118 } 133 }
119 134
120 void GCMDriverAndroid::OnSignedIn() { 135 void GCMDriverAndroid::OnSignedIn() {
121 } 136 }
122 137
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 NOTIMPLEMENTED(); 275 NOTIMPLEMENTED();
261 } 276 }
262 277
263 void GCMDriverAndroid::RecordDecryptionFailure( 278 void GCMDriverAndroid::RecordDecryptionFailure(
264 const std::string& app_id, 279 const std::string& app_id,
265 GCMEncryptionProvider::DecryptionResult result) { 280 GCMEncryptionProvider::DecryptionResult result) {
266 recorder_.RecordDecryptionFailure(app_id, result); 281 recorder_.RecordDecryptionFailure(app_id, result);
267 } 282 }
268 283
269 } // namespace gcm 284 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698