Pass the push message id to the decryption failure event
Bug: 958773
Change-Id: If88fdf21e6fc7f8209fd771d173ade9e4c32664e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1602726
Commit-Queue: Rayan Kanso <[email protected]>
Auto-Submit: Rayan Kanso <[email protected]>
Reviewed-by: Peter Beverloo <[email protected]>
Cr-Commit-Position: refs/heads/master@{#658179}
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc
index c8edcc7..33ce6a8e 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -421,6 +421,7 @@
void PushMessagingServiceImpl::OnMessageDecryptionFailed(
const std::string& app_id,
+ const std::string& message_id,
const std::string& error_message) {}
// GetEndpoint method ----------------------------------------------------------
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.h b/chrome/browser/push_messaging/push_messaging_service_impl.h
index 1a71784..3cbc3947 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.h
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.h
@@ -80,6 +80,7 @@
void OnSendAcknowledged(const std::string& app_id,
const std::string& message_id) override;
void OnMessageDecryptionFailed(const std::string& app_id,
+ const std::string& message_id,
const std::string& error_message) override;
bool CanHandle(const std::string& app_id) const override;
diff --git a/components/gcm_driver/fake_gcm_app_handler.cc b/components/gcm_driver/fake_gcm_app_handler.cc
index ce08111..02983974 100644
--- a/components/gcm_driver/fake_gcm_app_handler.cc
+++ b/components/gcm_driver/fake_gcm_app_handler.cc
@@ -63,6 +63,7 @@
void FakeGCMAppHandler::OnMessageDecryptionFailed(
const std::string& app_id,
+ const std::string& message_id,
const std::string& error_message) {
ClearResults();
received_event_ = DECRYPTION_FAILED_EVENT;
diff --git a/components/gcm_driver/fake_gcm_app_handler.h b/components/gcm_driver/fake_gcm_app_handler.h
index 0cb2dc0c..50bc38bf 100644
--- a/components/gcm_driver/fake_gcm_app_handler.h
+++ b/components/gcm_driver/fake_gcm_app_handler.h
@@ -50,6 +50,7 @@
const std::string& app_id,
const GCMClient::SendErrorDetails& send_error_details) override;
void OnMessageDecryptionFailed(const std::string& app_id,
+ const std::string& message_id,
const std::string& error_message) override;
void OnSendAcknowledged(const std::string& app_id,
const std::string& message_id) override;
diff --git a/components/gcm_driver/gcm_app_handler.cc b/components/gcm_driver/gcm_app_handler.cc
index 4828de76..c882799 100644
--- a/components/gcm_driver/gcm_app_handler.cc
+++ b/components/gcm_driver/gcm_app_handler.cc
@@ -11,6 +11,7 @@
void GCMAppHandler::OnMessageDecryptionFailed(
const std::string& app_id,
+ const std::string& message_id,
const std::string& error_message) {}
bool GCMAppHandler::CanHandle(const std::string& app_id) const {
diff --git a/components/gcm_driver/gcm_app_handler.h b/components/gcm_driver/gcm_app_handler.h
index d3e850d..676eeea8 100644
--- a/components/gcm_driver/gcm_app_handler.h
+++ b/components/gcm_driver/gcm_app_handler.h
@@ -49,9 +49,11 @@
const std::string& message_id) = 0;
// Called when a GCM message has been received but decryption failed.
+ // |message_id| is a message identifier sent by the GCM server.
// |error_message| is human-readable description of the error, for reporting
// purposes. By default this handler does nothing.
virtual void OnMessageDecryptionFailed(const std::string& app_id,
+ const std::string& message_id,
const std::string& error_message);
// If no app handler has been added with the exact app_id of an incoming
diff --git a/components/gcm_driver/gcm_driver.cc b/components/gcm_driver/gcm_driver.cc
index 526f771..f3cf956 100644
--- a/components/gcm_driver/gcm_driver.cc
+++ b/components/gcm_driver/gcm_driver.cc
@@ -300,7 +300,8 @@
GCMAppHandler* handler = GetAppHandler(app_id);
if (handler) {
handler->OnMessageDecryptionFailed(
- app_id, ToGCMDecryptionResultDetailsString(result));
+ app_id, message.message_id,
+ ToGCMDecryptionResultDetailsString(result));
}
return;
}