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

Unified Diff: components/gcm_driver/gcm_driver.cc

Issue 2578583002: Provide a mechanism for the GCM driver to send message receipts to GCM.
Patch Set: Fix issue with rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/gcm_driver/gcm_driver.h ('k') | components/gcm_driver/gcm_driver_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/gcm_driver.cc
diff --git a/components/gcm_driver/gcm_driver.cc b/components/gcm_driver/gcm_driver.cc
index 21d30549d07030b043adfa405f0ab45eb6b94931..db6ad414a394ba91b5b5f471005e2a4ee0574a11 100644
--- a/components/gcm_driver/gcm_driver.cc
+++ b/components/gcm_driver/gcm_driver.cc
@@ -278,15 +278,19 @@ void GCMDriver::ClearCallbacks() {
send_callbacks_.clear();
}
-void GCMDriver::DispatchMessage(const std::string& app_id,
- const IncomingMessage& message) {
+void GCMDriver::DispatchMessage(
+ const std::string& app_id,
+ const IncomingMessage& message,
+ const MessageReceiptCallback& optional_receipt_callback) {
encryption_provider_.DecryptMessage(
app_id, message, base::Bind(&GCMDriver::DispatchMessageInternal,
- weak_ptr_factory_.GetWeakPtr(), app_id));
+ weak_ptr_factory_.GetWeakPtr(), app_id,
+ optional_receipt_callback));
}
void GCMDriver::DispatchMessageInternal(
const std::string& app_id,
+ const MessageReceiptCallback& optional_receipt_callback,
GCMEncryptionProvider::DecryptionResult result,
const IncomingMessage& message) {
UMA_HISTOGRAM_ENUMERATION("GCM.Crypto.DecryptMessageResult", result,
@@ -295,6 +299,8 @@ void GCMDriver::DispatchMessageInternal(
switch (result) {
case GCMEncryptionProvider::DECRYPTION_RESULT_UNENCRYPTED:
case GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED:
+ // TODO(beverloo): When the DefaultAppHandler is gone, call
+ // SendMessageReceipt here if there isn't a valid app handler.
GetAppHandler(app_id)->OnMessage(app_id, message);
return;
case GCMEncryptionProvider::DECRYPTION_RESULT_INVALID_ENCRYPTION_HEADER:
@@ -302,6 +308,7 @@ void GCMDriver::DispatchMessageInternal(
case GCMEncryptionProvider::DECRYPTION_RESULT_NO_KEYS:
case GCMEncryptionProvider::DECRYPTION_RESULT_INVALID_SHARED_SECRET:
case GCMEncryptionProvider::DECRYPTION_RESULT_INVALID_PAYLOAD:
+ optional_receipt_callback.Run(GCMMessageStatus::GCM_DECRYPTION_FAILURE);
RecordDecryptionFailure(app_id, result);
return;
}
« no previous file with comments | « components/gcm_driver/gcm_driver.h ('k') | components/gcm_driver/gcm_driver_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698