OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/attestation/attestation_ca_client.h" | 5 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 void AttestationCAClient::OnURLFetchComplete(const net::URLFetcher* source) { | 42 void AttestationCAClient::OnURLFetchComplete(const net::URLFetcher* source) { |
43 FetcherCallbackMap::iterator iter = pending_requests_.find(source); | 43 FetcherCallbackMap::iterator iter = pending_requests_.find(source); |
44 if (iter == pending_requests_.end()) { | 44 if (iter == pending_requests_.end()) { |
45 LOG(WARNING) << "Callback from unknown source."; | 45 LOG(WARNING) << "Callback from unknown source."; |
46 return; | 46 return; |
47 } | 47 } |
48 | 48 |
49 DataCallback callback = iter->second; | 49 DataCallback callback = iter->second; |
50 pending_requests_.erase(iter); | 50 pending_requests_.erase(iter); |
51 scoped_ptr<const net::URLFetcher> scoped_source(source); | 51 std::unique_ptr<const net::URLFetcher> scoped_source(source); |
52 | 52 |
53 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS) { | 53 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS) { |
54 LOG(ERROR) << "Attestation CA request failed, status: " | 54 LOG(ERROR) << "Attestation CA request failed, status: " |
55 << source->GetStatus().status() << ", error: " | 55 << source->GetStatus().status() << ", error: " |
56 << source->GetStatus().error(); | 56 << source->GetStatus().error(); |
57 callback.Run(false, ""); | 57 callback.Run(false, ""); |
58 return; | 58 return; |
59 } | 59 } |
60 | 60 |
61 if (source->GetResponseCode() != net::HTTP_OK) { | 61 if (source->GetResponseCode() != net::HTTP_OK) { |
(...skipping 22 matching lines...) Expand all Loading... |
84 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 84 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
85 net::LOAD_DO_NOT_SAVE_COOKIES | | 85 net::LOAD_DO_NOT_SAVE_COOKIES | |
86 net::LOAD_DISABLE_CACHE); | 86 net::LOAD_DISABLE_CACHE); |
87 fetcher->SetUploadData(kMimeContentType, request); | 87 fetcher->SetUploadData(kMimeContentType, request); |
88 pending_requests_[fetcher] = on_response; | 88 pending_requests_[fetcher] = on_response; |
89 fetcher->Start(); | 89 fetcher->Start(); |
90 } | 90 } |
91 | 91 |
92 } // namespace attestation | 92 } // namespace attestation |
93 } // namespace chromeos | 93 } // namespace chromeos |
OLD | NEW |