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_COMPONENT_UPDATER_REQUEST_SENDER_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_ |
6 #define COMPONENTS_COMPONENT_UPDATER_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/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.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 net { | 19 namespace net { |
20 class URLFetcher; | 20 class URLFetcher; |
21 } | 21 } |
22 | 22 |
23 namespace component_updater { | 23 namespace update_client { |
24 | 24 |
25 class Configurator; | 25 class Configurator; |
26 | 26 |
27 // Sends a request to one of the urls provided. The class implements a chain | 27 // Sends a request to one of the urls provided. The class implements a chain |
28 // of responsibility design pattern, where the urls are tried in the order they | 28 // of responsibility design pattern, where the urls are tried in the order they |
29 // are specified, until the request to one of them succeeds or all have failed. | 29 // are specified, until the request to one of them succeeds or all have failed. |
30 class RequestSender : public net::URLFetcherDelegate { | 30 class RequestSender : public net::URLFetcherDelegate { |
31 public: | 31 public: |
32 // The |source| refers to the fetcher object used to make the request. This | 32 // The |source| refers to the fetcher object used to make the request. This |
33 // parameter can be NULL in some error cases. | 33 // parameter can be NULL in some error cases. |
(...skipping 18 matching lines...) Expand all Loading... |
52 std::vector<GURL>::const_iterator cur_url_; | 52 std::vector<GURL>::const_iterator cur_url_; |
53 scoped_ptr<net::URLFetcher> url_fetcher_; | 53 scoped_ptr<net::URLFetcher> url_fetcher_; |
54 std::string request_string_; | 54 std::string request_string_; |
55 RequestSenderCallback request_sender_callback_; | 55 RequestSenderCallback request_sender_callback_; |
56 | 56 |
57 base::ThreadChecker thread_checker_; | 57 base::ThreadChecker thread_checker_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(RequestSender); | 59 DISALLOW_COPY_AND_ASSIGN(RequestSender); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace component_updater | 62 } // namespace update_client |
63 | 63 |
64 #endif // COMPONENTS_COMPONENT_UPDATER_REQUEST_SENDER_H_ | 64 #endif // COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_ |
OLD | NEW |