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

Unified Diff: components/update_client/update_checker.cc

Issue 1899043002: Implement ping_freshness for update_client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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
« no previous file with comments | « components/update_client/update_checker.h ('k') | components/update_client/update_checker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/update_checker.cc
diff --git a/components/update_client/update_checker.cc b/components/update_client/update_checker.cc
index ec888929dd7f2e64423a0a0cc91e51365be46133..7f40a0c952fb691e0b6b9669d3bb299b22dc71a7 100644
--- a/components/update_client/update_checker.cc
+++ b/components/update_client/update_checker.cc
@@ -64,7 +64,7 @@ bool IsEncryptionRequired(const std::vector<CrxUpdateItem*>& items) {
// </app>
std::string BuildUpdateCheckRequest(const Configurator& config,
const std::vector<CrxUpdateItem*>& items,
- const PersistedData& metadata,
+ PersistedData* metadata,
const std::string& additional_attributes) {
const std::string brand(SanitizeBrand(config.GetBrand()));
std::string app_elements;
@@ -82,8 +82,9 @@ std::string BuildUpdateCheckRequest(const Configurator& config,
base::StringAppendF(&app, " ap=\"%s\"", ap.c_str());
base::StringAppendF(&app, ">");
base::StringAppendF(&app, "<updatecheck />");
- base::StringAppendF(&app, "<ping rd=\"%d\" />",
- metadata.GetDateLastRollCall(item->id));
+ base::StringAppendF(&app, "<ping rd=\"%d\" ping_freshness=\"%s\" />",
+ metadata->GetDateLastRollCall(item->id),
+ metadata->GetPingFreshness(item->id).c_str());
if (!item->component.fingerprint.empty()) {
base::StringAppendF(&app,
"<packages>"
@@ -105,7 +106,7 @@ std::string BuildUpdateCheckRequest(const Configurator& config,
class UpdateCheckerImpl : public UpdateChecker {
public:
UpdateCheckerImpl(const scoped_refptr<Configurator>& config,
- const PersistedData& metadata);
+ PersistedData* metadata);
~UpdateCheckerImpl() override;
// Overrides for UpdateChecker.
@@ -122,7 +123,7 @@ class UpdateCheckerImpl : public UpdateChecker {
base::ThreadChecker thread_checker_;
const scoped_refptr<Configurator> config_;
- const PersistedData& metadata_;
+ PersistedData* metadata_;
UpdateCheckCallback update_check_callback_;
scoped_ptr<RequestSender> request_sender_;
@@ -130,7 +131,7 @@ class UpdateCheckerImpl : public UpdateChecker {
};
UpdateCheckerImpl::UpdateCheckerImpl(const scoped_refptr<Configurator>& config,
- const PersistedData& metadata)
+ PersistedData* metadata)
: config_(config), metadata_(metadata) {}
UpdateCheckerImpl::~UpdateCheckerImpl() {
@@ -180,7 +181,7 @@ void UpdateCheckerImpl::OnRequestSenderComplete(
if (update_response.Parse(response)) {
int daynum = update_response.results().daystart_elapsed_days;
if (daynum != UpdateResponse::kNoDaystart)
- metadata_.SetDateLastRollCall(*ids_checked, daynum);
+ metadata_->SetDateLastRollCall(*ids_checked, daynum);
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(update_check_callback_, error,
update_response.results(), retry_after_sec));
@@ -200,7 +201,7 @@ void UpdateCheckerImpl::OnRequestSenderComplete(
scoped_ptr<UpdateChecker> UpdateChecker::Create(
const scoped_refptr<Configurator>& config,
- const PersistedData& persistent) {
+ PersistedData* persistent) {
return scoped_ptr<UpdateChecker>(new UpdateCheckerImpl(config, persistent));
}
« no previous file with comments | « components/update_client/update_checker.h ('k') | components/update_client/update_checker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698