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