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

Unified Diff: components/gcm_driver/gcm_client_impl.cc

Issue 1126233004: Persist Instance ID data to GCM store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
Index: components/gcm_driver/gcm_client_impl.cc
diff --git a/components/gcm_driver/gcm_client_impl.cc b/components/gcm_driver/gcm_client_impl.cc
index 1c9f64fbe447498e27d1ca4a8c47b77a210adb1b..d0d1caf28b0f50260a99e2284d3e29ed1223c3ce 100644
--- a/components/gcm_driver/gcm_client_impl.cc
+++ b/components/gcm_driver/gcm_client_impl.cc
@@ -348,6 +348,7 @@ void GCMClientImpl::OnLoadCompleted(scoped_ptr<GCMStore::LoadResult> result) {
device_checkin_info_.accounts_set = true;
last_checkin_time_ = result->last_checkin_time;
gservices_settings_.UpdateFromLoadResult(*result);
+ instance_id_data_ = result->instance_id_data;
load_result_ = result.Pass();
state_ = LOADED;
@@ -530,6 +531,29 @@ void GCMClientImpl::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) {
mcs_client_->UpdateHeartbeatTimer(timer.Pass());
}
+void GCMClientImpl::AddInstanceIDData(const std::string& app_id,
+ const std::string& instance_id_data) {
fgorski 2015/05/08 17:12:33 Also add to the instance_id_data_
jianli 2015/05/08 20:56:01 Done.
+ gcm_store_->AddInstanceIDData(
+ app_id,
+ instance_id_data,
+ base::Bind(&GCMClientImpl::IgnoreWriteResultCallback,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void GCMClientImpl::RemoveInstanceIDData(const std::string& app_id) {
fgorski 2015/05/08 17:12:33 remove from instance ID data_ This and above coul
jianli 2015/05/08 20:56:01 Done.
+ gcm_store_->RemoveInstanceIDData(
+ app_id,
+ base::Bind(&GCMClientImpl::IgnoreWriteResultCallback,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+std::string GCMClientImpl::GetInstanceIDData(const std::string& app_id) {
+ auto iter = instance_id_data_.find(app_id);
+ if (iter == instance_id_data_.cend())
+ return std::string();
+ return iter->second;
+}
+
void GCMClientImpl::StartCheckin() {
// Make sure no checkin is in progress.
if (checkin_request_.get())

Powered by Google App Engine
This is Rietveld 408576698