| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 return true; | 194 return true; |
| 195 } | 195 } |
| 196 | 196 |
| 197 void AffiliationFetcher::OnURLFetchComplete(const net::URLFetcher* source) { | 197 void AffiliationFetcher::OnURLFetchComplete(const net::URLFetcher* source) { |
| 198 DCHECK_EQ(source, fetcher_.get()); | 198 DCHECK_EQ(source, fetcher_.get()); |
| 199 | 199 |
| 200 // Note that invoking the |delegate_| may destroy |this| synchronously, so the | 200 // Note that invoking the |delegate_| may destroy |this| synchronously, so the |
| 201 // invocation must happen last. | 201 // invocation must happen last. |
| 202 scoped_ptr<AffiliationFetcherDelegate::Result> result_data( | 202 std::unique_ptr<AffiliationFetcherDelegate::Result> result_data( |
| 203 new AffiliationFetcherDelegate::Result); | 203 new AffiliationFetcherDelegate::Result); |
| 204 if (fetcher_->GetStatus().status() == net::URLRequestStatus::SUCCESS && | 204 if (fetcher_->GetStatus().status() == net::URLRequestStatus::SUCCESS && |
| 205 fetcher_->GetResponseCode() == net::HTTP_OK) { | 205 fetcher_->GetResponseCode() == net::HTTP_OK) { |
| 206 if (ParseResponse(result_data.get())) { | 206 if (ParseResponse(result_data.get())) { |
| 207 ReportStatistics(AFFILIATION_FETCH_RESULT_SUCCESS, nullptr); | 207 ReportStatistics(AFFILIATION_FETCH_RESULT_SUCCESS, nullptr); |
| 208 delegate_->OnFetchSucceeded(std::move(result_data)); | 208 delegate_->OnFetchSucceeded(std::move(result_data)); |
| 209 } else { | 209 } else { |
| 210 ReportStatistics(AFFILIATION_FETCH_RESULT_MALFORMED, nullptr); | 210 ReportStatistics(AFFILIATION_FETCH_RESULT_MALFORMED, nullptr); |
| 211 delegate_->OnMalformedResponse(); | 211 delegate_->OnMalformedResponse(); |
| 212 } | 212 } |
| 213 } else { | 213 } else { |
| 214 ReportStatistics(AFFILIATION_FETCH_RESULT_FAILURE, fetcher_.get()); | 214 ReportStatistics(AFFILIATION_FETCH_RESULT_FAILURE, fetcher_.get()); |
| 215 delegate_->OnFetchFailed(); | 215 delegate_->OnFetchFailed(); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace password_manager | 219 } // namespace password_manager |
| OLD | NEW |