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 #ifndef COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_ |
6 #define COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "net/url_request/url_fetcher_delegate.h" | 16 #include "net/url_request/url_fetcher_delegate.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
| 19 namespace client_update_protocol { |
| 20 class Ecdsa; |
| 21 } |
| 22 |
19 namespace net { | 23 namespace net { |
20 class URLFetcher; | 24 class URLFetcher; |
21 } | 25 } |
22 | 26 |
23 namespace update_client { | 27 namespace update_client { |
24 | 28 |
25 class ClientUpdateProtocolEcdsa; | |
26 class Configurator; | 29 class Configurator; |
27 | 30 |
28 // Sends a request to one of the urls provided. The class implements a chain | 31 // Sends a request to one of the urls provided. The class implements a chain |
29 // of responsibility design pattern, where the urls are tried in the order they | 32 // of responsibility design pattern, where the urls are tried in the order they |
30 // are specified, until the request to one of them succeeds or all have failed. | 33 // are specified, until the request to one of them succeeds or all have failed. |
31 // CUP signing is optional. | 34 // CUP signing is optional. |
32 class RequestSender : public net::URLFetcherDelegate { | 35 class RequestSender : public net::URLFetcherDelegate { |
33 public: | 36 public: |
34 // If |error| is 0, then the response is provided in the |response| parameter. | 37 // If |error| is 0, then the response is provided in the |response| parameter. |
35 using RequestSenderCallback = | 38 using RequestSenderCallback = |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 80 |
78 const scoped_refptr<Configurator> config_; | 81 const scoped_refptr<Configurator> config_; |
79 bool use_signing_; | 82 bool use_signing_; |
80 std::vector<GURL> urls_; | 83 std::vector<GURL> urls_; |
81 std::string request_body_; | 84 std::string request_body_; |
82 RequestSenderCallback request_sender_callback_; | 85 RequestSenderCallback request_sender_callback_; |
83 | 86 |
84 std::string public_key_; | 87 std::string public_key_; |
85 std::vector<GURL>::const_iterator cur_url_; | 88 std::vector<GURL>::const_iterator cur_url_; |
86 scoped_ptr<net::URLFetcher> url_fetcher_; | 89 scoped_ptr<net::URLFetcher> url_fetcher_; |
87 scoped_ptr<ClientUpdateProtocolEcdsa> signer_; | 90 scoped_ptr<client_update_protocol::Ecdsa> signer_; |
88 | 91 |
89 DISALLOW_COPY_AND_ASSIGN(RequestSender); | 92 DISALLOW_COPY_AND_ASSIGN(RequestSender); |
90 }; | 93 }; |
91 | 94 |
92 } // namespace update_client | 95 } // namespace update_client |
93 | 96 |
94 #endif // COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_ | 97 #endif // COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_ |
OLD | NEW |