| 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 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_CA_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_CA_CLIENT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_CA_CLIENT_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_CA_CLIENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chromeos/attestation/attestation_constants.h" | |
| 13 #include "chromeos/attestation/attestation_flow.h" | 12 #include "chromeos/attestation/attestation_flow.h" |
| 14 #include "net/url_request/url_fetcher_delegate.h" | 13 #include "net/url_request/url_fetcher_delegate.h" |
| 15 | 14 |
| 16 namespace chromeos { | 15 namespace chromeos { |
| 17 namespace attestation { | 16 namespace attestation { |
| 18 | 17 |
| 19 // This class is a ServerProxy implementation for the Chrome OS attestation | 18 // This class is a ServerProxy implementation for the Chrome OS attestation |
| 20 // flow. It sends all requests to an Attestation CA via HTTPS. | 19 // flow. It sends all requests to an Attestation CA via HTTPS. |
| 21 class AttestationCAClient : public ServerProxy, | 20 class AttestationCAClient : public ServerProxy, |
| 22 public net::URLFetcherDelegate { | 21 public net::URLFetcherDelegate { |
| 23 public: | 22 public: |
| 24 AttestationCAClient(); | 23 AttestationCAClient(); |
| 25 ~AttestationCAClient() override; | 24 ~AttestationCAClient() override; |
| 26 | 25 |
| 27 // chromeos::attestation::ServerProxy: | 26 // chromeos::attestation::ServerProxy: |
| 28 void SendEnrollRequest(const std::string& request, | 27 void SendEnrollRequest(const std::string& request, |
| 29 const DataCallback& on_response) override; | 28 const DataCallback& on_response) override; |
| 30 void SendCertificateRequest(const std::string& request, | 29 void SendCertificateRequest(const std::string& request, |
| 31 const DataCallback& on_response) override; | 30 const DataCallback& on_response) override; |
| 32 | 31 |
| 33 // net::URLFetcherDelegate: | 32 // net::URLFetcherDelegate: |
| 34 void OnURLFetchComplete(const net::URLFetcher* source) override; | 33 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 35 | 34 |
| 36 PrivacyCAType GetType() override; | |
| 37 | |
| 38 private: | 35 private: |
| 39 PrivacyCAType pca_type_; | |
| 40 | |
| 41 typedef std::map<const net::URLFetcher*, DataCallback> FetcherCallbackMap; | 36 typedef std::map<const net::URLFetcher*, DataCallback> FetcherCallbackMap; |
| 42 | 37 |
| 43 // POSTs |request| data to |url| and calls |on_response| with the response | 38 // POSTs |request| data to |url| and calls |on_response| with the response |
| 44 // data when the fetch is complete. | 39 // data when the fetch is complete. |
| 45 void FetchURL(const std::string& url, | 40 void FetchURL(const std::string& url, |
| 46 const std::string& request, | 41 const std::string& request, |
| 47 const DataCallback& on_response); | 42 const DataCallback& on_response); |
| 48 | 43 |
| 49 // Tracks all URL requests we have started. | 44 // Tracks all URL requests we have started. |
| 50 FetcherCallbackMap pending_requests_; | 45 FetcherCallbackMap pending_requests_; |
| 51 | 46 |
| 52 DISALLOW_COPY_AND_ASSIGN(AttestationCAClient); | 47 DISALLOW_COPY_AND_ASSIGN(AttestationCAClient); |
| 53 }; | 48 }; |
| 54 | 49 |
| 55 } // namespace attestation | 50 } // namespace attestation |
| 56 } // namespace chromeos | 51 } // namespace chromeos |
| 57 | 52 |
| 58 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_CA_CLIENT_H_ | 53 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_CA_CLIENT_H_ |
| OLD | NEW |