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

Unified Diff: components/update_client/ping_manager.cc

Issue 1740333002: Allow fallback from https to http for component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/ping_manager.h ('k') | components/update_client/ping_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/ping_manager.cc
diff --git a/components/update_client/ping_manager.cc b/components/update_client/ping_manager.cc
index 191881457b5596271de9231e6449a8f37b3dd060..2d665933db06dcb631ffc311d95f61a1adadb595 100644
--- a/components/update_client/ping_manager.cc
+++ b/components/update_client/ping_manager.cc
@@ -179,7 +179,9 @@ class PingSender {
bool SendPing(const CrxUpdateItem* item);
private:
- void OnRequestSenderComplete(int error, const std::string& response);
+ void OnRequestSenderComplete(int error,
+ const std::string& response,
+ int retry_after_sec);
const scoped_refptr<Configurator> config_;
scoped_ptr<RequestSender> request_sender_;
@@ -196,7 +198,8 @@ PingSender::~PingSender() {
}
void PingSender::OnRequestSenderComplete(int error,
- const std::string& response) {
+ const std::string& response,
+ int retry_after_sec) {
DCHECK(thread_checker_.CalledOnValidThread());
delete this;
}
@@ -205,7 +208,9 @@ bool PingSender::SendPing(const CrxUpdateItem* item) {
DCHECK(item);
DCHECK(thread_checker_.CalledOnValidThread());
- std::vector<GURL> urls(config_->PingUrl());
+ auto urls(config_->PingUrl());
+ if (item->component.requires_network_encryption)
+ RemoveUnsecureUrls(&urls);
if (urls.empty())
return false;
@@ -225,12 +230,14 @@ PingManager::PingManager(const scoped_refptr<Configurator>& config)
PingManager::~PingManager() {
}
-// Sends a fire and forget ping when the updates are complete. The ping
-// sender object self-deletes after sending the ping has completed asynchrously.
-void PingManager::SendPing(const CrxUpdateItem* item) {
- PingSender* ping_sender(new PingSender(config_));
+bool PingManager::SendPing(const CrxUpdateItem* item) {
+ scoped_ptr<PingSender> ping_sender(new PingSender(config_));
if (!ping_sender->SendPing(item))
- delete ping_sender;
+ return false;
+
+ // The ping sender object self-deletes after sending the ping asynchrously.
+ ping_sender.release();
+ return true;
}
} // namespace update_client
« no previous file with comments | « components/update_client/ping_manager.h ('k') | components/update_client/ping_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698