| 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/update_client/ping_manager.h" | 5 #include "components/update_client/ping_manager.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include <memory> | 9 #include <memory> | 
| 10 #include <string> | 10 #include <string> | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 60 void PingSender::OnRequestSenderComplete(int error, | 60 void PingSender::OnRequestSenderComplete(int error, | 
| 61                                          const std::string& response, | 61                                          const std::string& response, | 
| 62                                          int retry_after_sec) { | 62                                          int retry_after_sec) { | 
| 63   DCHECK(thread_checker_.CalledOnValidThread()); | 63   DCHECK(thread_checker_.CalledOnValidThread()); | 
| 64   delete this; | 64   delete this; | 
| 65 } | 65 } | 
| 66 | 66 | 
| 67 bool PingSender::SendPing(const Component& component) { | 67 bool PingSender::SendPing(const Component& component) { | 
| 68   DCHECK(thread_checker_.CalledOnValidThread()); | 68   DCHECK(thread_checker_.CalledOnValidThread()); | 
| 69 | 69 | 
|  | 70   if (component.events().empty()) | 
|  | 71     return false; | 
|  | 72 | 
| 70   auto urls(config_->PingUrl()); | 73   auto urls(config_->PingUrl()); | 
| 71   if (component.crx_component().requires_network_encryption) | 74   if (component.crx_component().requires_network_encryption) | 
| 72     RemoveUnsecureUrls(&urls); | 75     RemoveUnsecureUrls(&urls); | 
| 73 | 76 | 
| 74   if (urls.empty()) | 77   if (urls.empty()) | 
| 75     return false; | 78     return false; | 
| 76 | 79 | 
| 77   request_sender_ = base::MakeUnique<RequestSender>(config_); | 80   request_sender_ = base::MakeUnique<RequestSender>(config_); | 
| 78   request_sender_->Send( | 81   request_sender_->Send( | 
| 79       false, BuildEventPingRequest(*config_, component), urls, | 82       false, BuildEventPingRequest(*config_, component), urls, | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 96   auto ping_sender = base::MakeUnique<PingSender>(config_); | 99   auto ping_sender = base::MakeUnique<PingSender>(config_); | 
| 97   if (!ping_sender->SendPing(component)) | 100   if (!ping_sender->SendPing(component)) | 
| 98     return false; | 101     return false; | 
| 99 | 102 | 
| 100   // The ping sender object self-deletes after sending the ping asynchrously. | 103   // The ping sender object self-deletes after sending the ping asynchrously. | 
| 101   ping_sender.release(); | 104   ping_sender.release(); | 
| 102   return true; | 105   return true; | 
| 103 } | 106 } | 
| 104 | 107 | 
| 105 }  // namespace update_client | 108 }  // namespace update_client | 
| OLD | NEW | 
|---|