OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ | 5 #ifndef NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ |
6 #define NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ | 6 #define NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
21 #include "base/threading/non_thread_safe.h" | 21 #include "base/threading/non_thread_safe.h" |
22 #include "net/http/http_request_headers.h" | 22 #include "net/http/http_request_headers.h" |
23 #include "net/http/http_status_code.h" | 23 #include "net/http/http_status_code.h" |
24 #include "net/url_request/url_fetcher_factory.h" | 24 #include "net/url_request/url_fetcher_factory.h" |
25 #include "net/url_request/url_request_status.h" | 25 #include "net/url_request/url_request_status.h" |
26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 27 #include "url/origin.h" |
27 | 28 |
28 namespace net { | 29 namespace net { |
29 | 30 |
30 // Changes URLFetcher's Factory for the lifetime of the object. | 31 // Changes URLFetcher's Factory for the lifetime of the object. |
31 // Note that this scoper cannot be nested (to make it even harder to misuse). | 32 // Note that this scoper cannot be nested (to make it even harder to misuse). |
32 class ScopedURLFetcherFactory : public base::NonThreadSafe { | 33 class ScopedURLFetcherFactory : public base::NonThreadSafe { |
33 public: | 34 public: |
34 explicit ScopedURLFetcherFactory(URLFetcherFactory* factory); | 35 explicit ScopedURLFetcherFactory(URLFetcherFactory* factory); |
35 virtual ~ScopedURLFetcherFactory(); | 36 virtual ~ScopedURLFetcherFactory(); |
36 | 37 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void SetLoadFlags(int load_flags) override; | 109 void SetLoadFlags(int load_flags) override; |
109 int GetLoadFlags() const override; | 110 int GetLoadFlags() const override; |
110 void SetReferrer(const std::string& referrer) override; | 111 void SetReferrer(const std::string& referrer) override; |
111 void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy) override; | 112 void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy) override; |
112 void SetExtraRequestHeaders( | 113 void SetExtraRequestHeaders( |
113 const std::string& extra_request_headers) override; | 114 const std::string& extra_request_headers) override; |
114 void AddExtraRequestHeader(const std::string& header_line) override; | 115 void AddExtraRequestHeader(const std::string& header_line) override; |
115 void SetRequestContext( | 116 void SetRequestContext( |
116 URLRequestContextGetter* request_context_getter) override; | 117 URLRequestContextGetter* request_context_getter) override; |
117 void SetFirstPartyForCookies(const GURL& first_party_for_cookies) override; | 118 void SetFirstPartyForCookies(const GURL& first_party_for_cookies) override; |
| 119 void SetRequestorOrigin(const url::Origin& requestor_origin) override; |
118 void SetURLRequestUserData( | 120 void SetURLRequestUserData( |
119 const void* key, | 121 const void* key, |
120 const CreateDataCallback& create_data_callback) override; | 122 const CreateDataCallback& create_data_callback) override; |
121 void SetStopOnRedirect(bool stop_on_redirect) override; | 123 void SetStopOnRedirect(bool stop_on_redirect) override; |
122 void SetAutomaticallyRetryOn5xx(bool retry) override; | 124 void SetAutomaticallyRetryOn5xx(bool retry) override; |
123 void SetMaxRetriesOn5xx(int max_retries) override; | 125 void SetMaxRetriesOn5xx(int max_retries) override; |
124 int GetMaxRetriesOn5xx() const override; | 126 int GetMaxRetriesOn5xx() const override; |
125 base::TimeDelta GetBackoffDelay() const override; | 127 base::TimeDelta GetBackoffDelay() const override; |
126 void SetAutomaticallyRetryOnNetworkChanges(int max_retries) override; | 128 void SetAutomaticallyRetryOnNetworkChanges(int max_retries) override; |
127 void SaveResponseToFileAtPath( | 129 void SaveResponseToFileAtPath( |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // This method will create a real URLFetcher. | 460 // This method will create a real URLFetcher. |
459 scoped_ptr<URLFetcher> CreateURLFetcher(int id, | 461 scoped_ptr<URLFetcher> CreateURLFetcher(int id, |
460 const GURL& url, | 462 const GURL& url, |
461 URLFetcher::RequestType request_type, | 463 URLFetcher::RequestType request_type, |
462 URLFetcherDelegate* d) override; | 464 URLFetcherDelegate* d) override; |
463 }; | 465 }; |
464 | 466 |
465 } // namespace net | 467 } // namespace net |
466 | 468 |
467 #endif // NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ | 469 #endif // NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ |
OLD | NEW |