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/password_manager/core/browser/affiliation_fetcher.h" | 5 #include "components/password_manager/core/browser/affiliation_fetcher.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
9 #include "components/password_manager/core/browser/affiliation_api.pb.h" | 9 #include "components/password_manager/core/browser/affiliation_api.pb.h" |
10 #include "components/password_manager/core/browser/affiliation_utils.h" | 10 #include "components/password_manager/core/browser/affiliation_utils.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // static | 82 // static |
83 void AffiliationFetcher::SetFactoryForTesting( | 83 void AffiliationFetcher::SetFactoryForTesting( |
84 TestAffiliationFetcherFactory* factory) { | 84 TestAffiliationFetcherFactory* factory) { |
85 g_testing_factory = factory; | 85 g_testing_factory = factory; |
86 } | 86 } |
87 | 87 |
88 void AffiliationFetcher::StartRequest() { | 88 void AffiliationFetcher::StartRequest() { |
89 DCHECK(!fetcher_); | 89 DCHECK(!fetcher_); |
90 | 90 |
91 fetcher_.reset( | 91 fetcher_ = |
92 net::URLFetcher::Create(BuildQueryURL(), net::URLFetcher::POST, this)); | 92 net::URLFetcher::Create(BuildQueryURL(), net::URLFetcher::POST, this); |
93 fetcher_->SetRequestContext(request_context_getter_.get()); | 93 fetcher_->SetRequestContext(request_context_getter_.get()); |
94 fetcher_->SetUploadData("application/x-protobuf", PreparePayload()); | 94 fetcher_->SetUploadData("application/x-protobuf", PreparePayload()); |
95 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 95 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
96 net::LOAD_DO_NOT_SEND_COOKIES | | 96 net::LOAD_DO_NOT_SEND_COOKIES | |
97 net::LOAD_DO_NOT_SEND_AUTH_DATA | | 97 net::LOAD_DO_NOT_SEND_AUTH_DATA | |
98 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE); | 98 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE); |
99 fetcher_->SetAutomaticallyRetryOn5xx(false); | 99 fetcher_->SetAutomaticallyRetryOn5xx(false); |
100 fetcher_->SetAutomaticallyRetryOnNetworkChanges(0); | 100 fetcher_->SetAutomaticallyRetryOnNetworkChanges(0); |
101 fetcher_->Start(); | 101 fetcher_->Start(); |
102 } | 102 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 ReportStatistics(AFFILIATION_FETCH_RESULT_MALFORMED, nullptr); | 207 ReportStatistics(AFFILIATION_FETCH_RESULT_MALFORMED, nullptr); |
208 delegate_->OnMalformedResponse(); | 208 delegate_->OnMalformedResponse(); |
209 } | 209 } |
210 } else { | 210 } else { |
211 ReportStatistics(AFFILIATION_FETCH_RESULT_FAILURE, fetcher_.get()); | 211 ReportStatistics(AFFILIATION_FETCH_RESULT_FAILURE, fetcher_.get()); |
212 delegate_->OnFetchFailed(); | 212 delegate_->OnFetchFailed(); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 } // namespace password_manager | 216 } // namespace password_manager |
OLD | NEW |