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

Unified Diff: components/gcm_driver/fake_gcm_client.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/fake_gcm_client.h ('k') | components/gcm_driver/gcm_account_mapper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/fake_gcm_client.cc
diff --git a/components/gcm_driver/fake_gcm_client.cc b/components/gcm_driver/fake_gcm_client.cc
index eaa66c894d182fea831ea919e8b275cdc9edd992..88447c6f21bc4f09b2bffc83b15cfd9823db0408 100644
--- a/components/gcm_driver/fake_gcm_client.cc
+++ b/components/gcm_driver/fake_gcm_client.cc
@@ -238,15 +238,28 @@ void FakeGCMClient::PerformDelayedStart() {
}
void FakeGCMClient::ReceiveMessage(const std::string& app_id,
+ const std::string& message_id,
const IncomingMessage& message) {
DCHECK(ui_thread_->RunsTasksOnCurrentThread());
+ MessageReceiptCallback optional_receipt_callback =
+ base::Bind(&FakeGCMClient::SendMessageReceipt,
+ weak_ptr_factory_.GetWeakPtr(), message_id, app_id);
+
io_thread_->PostTask(
- FROM_HERE,
- base::Bind(&FakeGCMClient::MessageReceived,
- weak_ptr_factory_.GetWeakPtr(),
- app_id,
- message));
+ FROM_HERE, base::Bind(&FakeGCMClient::MessageReceived,
+ weak_ptr_factory_.GetWeakPtr(), app_id, message,
+ optional_receipt_callback));
+}
+
+void FakeGCMClient::SendMessageReceipt(const std::string& message_id,
+ const std::string& app_id,
+ GCMMessageStatus status) {
+ DCHECK(io_thread_->RunsTasksOnCurrentThread());
+
+ receipt_message_id_ = message_id;
+ receipt_app_id_ = app_id;
+ receipt_status_ = status;
}
void FakeGCMClient::DeleteMessages(const std::string& app_id) {
@@ -302,10 +315,12 @@ void FakeGCMClient::SendFinished(const std::string& app_id,
}
}
-void FakeGCMClient::MessageReceived(const std::string& app_id,
- const IncomingMessage& message) {
+void FakeGCMClient::MessageReceived(
+ const std::string& app_id,
+ const IncomingMessage& message,
+ const MessageReceiptCallback& optional_receipt_callback) {
if (delegate_)
- delegate_->OnMessageReceived(app_id, message);
+ delegate_->OnMessageReceived(app_id, message, optional_receipt_callback);
}
void FakeGCMClient::MessagesDeleted(const std::string& app_id) {
« no previous file with comments | « components/gcm_driver/fake_gcm_client.h ('k') | components/gcm_driver/gcm_account_mapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698