OLD | NEW |
---|---|
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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 time, | 523 time, |
524 base::Bind(&GCMClientImpl::IgnoreWriteResultCallback, | 524 base::Bind(&GCMClientImpl::IgnoreWriteResultCallback, |
525 weak_ptr_factory_.GetWeakPtr())); | 525 weak_ptr_factory_.GetWeakPtr())); |
526 } | 526 } |
527 | 527 |
528 void GCMClientImpl::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) { | 528 void GCMClientImpl::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) { |
529 DCHECK(mcs_client_); | 529 DCHECK(mcs_client_); |
530 mcs_client_->UpdateHeartbeatTimer(timer.Pass()); | 530 mcs_client_->UpdateHeartbeatTimer(timer.Pass()); |
531 } | 531 } |
532 | 532 |
533 void GCMClientImpl::AddHeartbeatInterval(const std::string& scope, | |
534 int interval_ms) { | |
535 DCHECK(mcs_client_); | |
536 mcs_client_->AddHeartbeatInterval(scope, interval_ms); | |
Nicolas Zea
2015/05/07 18:13:52
This can be called from any arbitrary component ri
fgorski
2015/05/10 06:44:33
Good point. I've added a check against delayed tas
| |
537 } | |
538 | |
539 void GCMClientImpl::RemoveHeartbeatInterval(const std::string& scope) { | |
540 DCHECK(mcs_client_); | |
541 mcs_client_->RemoveHeartbeatInterval(scope); | |
542 } | |
543 | |
533 void GCMClientImpl::StartCheckin() { | 544 void GCMClientImpl::StartCheckin() { |
534 // Make sure no checkin is in progress. | 545 // Make sure no checkin is in progress. |
535 if (checkin_request_.get()) | 546 if (checkin_request_.get()) |
536 return; | 547 return; |
537 | 548 |
538 checkin_proto::ChromeBuildProto chrome_build_proto; | 549 checkin_proto::ChromeBuildProto chrome_build_proto; |
539 ToCheckinProtoVersion(chrome_build_info_, &chrome_build_proto); | 550 ToCheckinProtoVersion(chrome_build_info_, &chrome_build_proto); |
540 CheckinRequest::RequestInfo request_info(device_checkin_info_.android_id, | 551 CheckinRequest::RequestInfo request_info(device_checkin_info_.android_id, |
541 device_checkin_info_.secret, | 552 device_checkin_info_.secret, |
542 device_checkin_info_.account_tokens, | 553 device_checkin_info_.account_tokens, |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1059 bool GCMClientImpl::HasStandaloneRegisteredApp() const { | 1070 bool GCMClientImpl::HasStandaloneRegisteredApp() const { |
1060 if (registrations_.empty()) | 1071 if (registrations_.empty()) |
1061 return false; | 1072 return false; |
1062 // Note that account mapper is not counted as a standalone app since it is | 1073 // Note that account mapper is not counted as a standalone app since it is |
1063 // automatically started when other app uses GCM. | 1074 // automatically started when other app uses GCM. |
1064 return registrations_.size() > 1 || | 1075 return registrations_.size() > 1 || |
1065 !registrations_.count(kGCMAccountMapperAppId); | 1076 !registrations_.count(kGCMAccountMapperAppId); |
1066 } | 1077 } |
1067 | 1078 |
1068 } // namespace gcm | 1079 } // namespace gcm |
OLD | NEW |