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..8fb162da91764c46d2ecfe98333e021929fb5018 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,31 @@ 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) { |
+ instance_id_data_[app_id] = instance_id_data; |
+ gcm_store_->AddInstanceIDData( |
+ app_id, |
+ instance_id_data, |
+ base::Bind(&GCMClientImpl::IgnoreWriteResultCallback, |
+ weak_ptr_factory_.GetWeakPtr())); |
+} |
+ |
+void GCMClientImpl::RemoveInstanceIDData(const std::string& app_id) { |
+ instance_id_data_.erase(app_id); |
+ 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_.end()) |
+ return std::string(); |
+ return iter->second; |
+} |
+ |
void GCMClientImpl::StartCheckin() { |
// Make sure no checkin is in progress. |
if (checkin_request_.get()) |