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

Side by Side Diff: components/gcm_driver/gcm_client_impl.cc

Issue 1124783002: [GCM] Wiring heartbeat interval calls to GCMDriver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@store-heartbeat-gcm
Patch Set: Addressing final feedback and fixing formatting 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 unified diff | Download patch
« no previous file with comments | « components/gcm_driver/gcm_client_impl.h ('k') | components/gcm_driver/gcm_driver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/gcm_driver/gcm_client_impl.h" 5 #include "components/gcm_driver/gcm_client_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 weak_ptr_factory_.GetWeakPtr())); 549 weak_ptr_factory_.GetWeakPtr()));
550 } 550 }
551 551
552 std::string GCMClientImpl::GetInstanceIDData(const std::string& app_id) { 552 std::string GCMClientImpl::GetInstanceIDData(const std::string& app_id) {
553 auto iter = instance_id_data_.find(app_id); 553 auto iter = instance_id_data_.find(app_id);
554 if (iter == instance_id_data_.end()) 554 if (iter == instance_id_data_.end())
555 return std::string(); 555 return std::string();
556 return iter->second; 556 return iter->second;
557 } 557 }
558 558
559 void GCMClientImpl::AddHeartbeatInterval(const std::string& scope,
560 int interval_ms) {
561 DCHECK(mcs_client_);
562 mcs_client_->AddHeartbeatInterval(scope, interval_ms);
563 }
564
565 void GCMClientImpl::RemoveHeartbeatInterval(const std::string& scope) {
566 DCHECK(mcs_client_);
567 mcs_client_->RemoveHeartbeatInterval(scope);
568 }
569
559 void GCMClientImpl::StartCheckin() { 570 void GCMClientImpl::StartCheckin() {
560 // Make sure no checkin is in progress. 571 // Make sure no checkin is in progress.
561 if (checkin_request_.get()) 572 if (checkin_request_.get())
562 return; 573 return;
563 574
564 checkin_proto::ChromeBuildProto chrome_build_proto; 575 checkin_proto::ChromeBuildProto chrome_build_proto;
565 ToCheckinProtoVersion(chrome_build_info_, &chrome_build_proto); 576 ToCheckinProtoVersion(chrome_build_info_, &chrome_build_proto);
566 CheckinRequest::RequestInfo request_info(device_checkin_info_.android_id, 577 CheckinRequest::RequestInfo request_info(device_checkin_info_.android_id,
567 device_checkin_info_.secret, 578 device_checkin_info_.secret,
568 device_checkin_info_.account_tokens, 579 device_checkin_info_.account_tokens,
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 bool GCMClientImpl::HasStandaloneRegisteredApp() const { 1096 bool GCMClientImpl::HasStandaloneRegisteredApp() const {
1086 if (registrations_.empty()) 1097 if (registrations_.empty())
1087 return false; 1098 return false;
1088 // Note that account mapper is not counted as a standalone app since it is 1099 // Note that account mapper is not counted as a standalone app since it is
1089 // automatically started when other app uses GCM. 1100 // automatically started when other app uses GCM.
1090 return registrations_.size() > 1 || 1101 return registrations_.size() > 1 ||
1091 !registrations_.count(kGCMAccountMapperAppId); 1102 !registrations_.count(kGCMAccountMapperAppId);
1092 } 1103 }
1093 1104
1094 } // namespace gcm 1105 } // namespace gcm
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_client_impl.h ('k') | components/gcm_driver/gcm_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698