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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 DCHECK(result) << "Invalid fetcher setting."; | 70 DCHECK(result) << "Invalid fetcher setting."; |
71 | 71 |
72 // Run the callback last because it may delete |this|. | 72 // Run the callback last because it may delete |this|. |
73 callback.Run(true, response); | 73 callback.Run(true, response); |
74 } | 74 } |
75 | 75 |
76 void AttestationCAClient::FetchURL(const std::string& url, | 76 void AttestationCAClient::FetchURL(const std::string& url, |
77 const std::string& request, | 77 const std::string& request, |
78 const DataCallback& on_response) { | 78 const DataCallback& on_response) { |
79 // The first argument allows the use of TestURLFetcherFactory in tests. | 79 // The first argument allows the use of TestURLFetcherFactory in tests. |
80 net::URLFetcher* fetcher = net::URLFetcher::Create(0, | 80 net::URLFetcher* fetcher = |
81 GURL(url), | 81 net::URLFetcher::Create(0, GURL(url), net::URLFetcher::POST, this) |
82 net::URLFetcher::POST, | 82 .release(); |
Ryan Sleevi
2015/04/30 18:23:44
Ideally, you'd move the .release() to line 88 and
| |
83 this); | |
84 fetcher->SetRequestContext(g_browser_process->system_request_context()); | 83 fetcher->SetRequestContext(g_browser_process->system_request_context()); |
85 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 84 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
86 net::LOAD_DO_NOT_SAVE_COOKIES | | 85 net::LOAD_DO_NOT_SAVE_COOKIES | |
87 net::LOAD_DISABLE_CACHE); | 86 net::LOAD_DISABLE_CACHE); |
88 fetcher->SetUploadData(kMimeContentType, request); | 87 fetcher->SetUploadData(kMimeContentType, request); |
89 pending_requests_[fetcher] = on_response; | 88 pending_requests_[fetcher] = on_response; |
90 fetcher->Start(); | 89 fetcher->Start(); |
91 } | 90 } |
92 | 91 |
93 } // namespace attestation | 92 } // namespace attestation |
94 } // namespace chromeos | 93 } // namespace chromeos |
OLD | NEW |