| 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/domain_reliability/uploader.h" | 5 #include "components/domain_reliability/uploader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 if (discard_uploads_) { | 70 if (discard_uploads_) { |
| 71 VLOG(1) << "Discarding report instead of uploading."; | 71 VLOG(1) << "Discarding report instead of uploading."; |
| 72 UploadResult result; | 72 UploadResult result; |
| 73 result.status = UploadResult::SUCCESS; | 73 result.status = UploadResult::SUCCESS; |
| 74 callback.Run(result); | 74 callback.Run(result); |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 | 77 |
| 78 net::URLFetcher* fetcher = | 78 net::URLFetcher* fetcher = |
| 79 net::URLFetcher::Create(0, upload_url, net::URLFetcher::POST, this); | 79 net::URLFetcher::Create(0, upload_url, net::URLFetcher::POST, this) |
| 80 .release(); |
| 80 fetcher->SetRequestContext(url_request_context_getter_.get()); | 81 fetcher->SetRequestContext(url_request_context_getter_.get()); |
| 81 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 82 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 82 net::LOAD_DO_NOT_SAVE_COOKIES); | 83 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 83 fetcher->SetUploadData(kJsonMimeType, report_json); | 84 fetcher->SetUploadData(kJsonMimeType, report_json); |
| 84 fetcher->SetAutomaticallyRetryOn5xx(false); | 85 fetcher->SetAutomaticallyRetryOn5xx(false); |
| 85 fetcher->SetURLRequestUserData( | 86 fetcher->SetURLRequestUserData( |
| 86 UploadUserData::kUserDataKey, | 87 UploadUserData::kUserDataKey, |
| 87 UploadUserData::CreateCreateDataCallback()); | 88 UploadUserData::CreateCreateDataCallback()); |
| 88 fetcher->Start(); | 89 fetcher->Start(); |
| 89 | 90 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 new DomainReliabilityUploaderImpl(time, url_request_context_getter)); | 162 new DomainReliabilityUploaderImpl(time, url_request_context_getter)); |
| 162 } | 163 } |
| 163 | 164 |
| 164 // static | 165 // static |
| 165 bool DomainReliabilityUploader::URLRequestIsUpload( | 166 bool DomainReliabilityUploader::URLRequestIsUpload( |
| 166 const net::URLRequest& request) { | 167 const net::URLRequest& request) { |
| 167 return request.GetUserData(UploadUserData::kUserDataKey) != nullptr; | 168 return request.GetUserData(UploadUserData::kUserDataKey) != nullptr; |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace domain_reliability | 171 } // namespace domain_reliability |
| OLD | NEW |