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

Unified Diff: components/gcm_driver/gcm_client_impl.cc

Issue 681453004: [GCM] Adding last token fetching time handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 db4504ba2143defd2d6a9e8a4af0d6127c551d03..95580f6f7b2321d7c72497193a7abdf3d8b79dc9 100644
--- a/components/gcm_driver/gcm_client_impl.cc
+++ b/components/gcm_driver/gcm_client_impl.cc
@@ -328,12 +328,13 @@ void GCMClientImpl::OnLoadCompleted(scoped_ptr<GCMStore::LoadResult> result) {
// load result to InitializeMCSClient.
std::vector<AccountMapping> account_mappings;
account_mappings.swap(result->account_mappings);
+ base::Time last_token_fetching_time = result->last_token_fetching_time;
InitializeMCSClient(result.Pass());
if (device_checkin_info_.IsValid()) {
SchedulePeriodicCheckin();
- OnReady(account_mappings);
+ OnReady(account_mappings, last_token_fetching_time);
return;
}
@@ -387,15 +388,16 @@ void GCMClientImpl::OnFirstTimeDeviceCheckinCompleted(
base::Bind(&GCMClientImpl::SetDeviceCredentialsCallback,
weak_ptr_factory_.GetWeakPtr()));
- OnReady(std::vector<AccountMapping>());
+ OnReady(std::vector<AccountMapping>(), base::Time());
}
void GCMClientImpl::OnReady(
- const std::vector<AccountMapping>& account_mappings) {
+ const std::vector<AccountMapping>& account_mappings,
+ const base::Time& last_token_fetching_time) {
state_ = READY;
StartMCSLogin();
- delegate_->OnGCMReady(account_mappings);
+ delegate_->OnGCMReady(account_mappings, last_token_fetching_time);
}
void GCMClientImpl::StartMCSLogin() {
@@ -470,6 +472,13 @@ void GCMClientImpl::RemoveAccountMapping(const std::string& account_id) {
weak_ptr_factory_.GetWeakPtr()));
}
+void GCMClientImpl::SetLastTokenFetchingTime(const base::Time& time) {
+ gcm_store_->SetLastTokenFetchingTime(
+ time,
+ base::Bind(&GCMClientImpl::DefaultStoreCallback,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
void GCMClientImpl::StartCheckin() {
// Make sure no checkin is in progress.
if (checkin_request_.get())

Powered by Google App Engine
This is Rietveld 408576698