Index: headless/public/util/http_url_fetcher.h |
diff --git a/headless/public/util/http_url_fetcher.h b/headless/public/util/http_url_fetcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ecad75c54b1a7f4f882fdaf3f2894d6dec9939fe |
--- /dev/null |
+++ b/headless/public/util/http_url_fetcher.h |
@@ -0,0 +1,43 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef HEADLESS_PUBLIC_UTIL_HTTP_URL_FETCHER_H_ |
+#define HEADLESS_PUBLIC_UTIL_HTTP_URL_FETCHER_H_ |
+ |
+#include "base/macros.h" |
+#include "headless/public/util/url_fetcher.h" |
+ |
+namespace net { |
+class URLRequestContext; |
+class URLRequestJobFactory; |
+} // namespace |
+ |
+namespace headless { |
+ |
+// This URLFetcher owns a (mostly) empty URLRequestContext which it uses to |
+// fetch, bypassing any user-specified protocol handlers. |
+class HttpUrlFetcher : public URLFetcher { |
+ public: |
+ explicit HttpUrlFetcher( |
+ std::unique_ptr<net::URLRequestContext> url_request_context); |
+ ~HttpUrlFetcher() override; |
+ |
+ // URLFetcher implementation: |
+ void StartFetch(const GURL& rewritten_url, |
+ const net::HttpRequestHeaders& request_headers, |
+ ResultListener* result_listener) override; |
+ |
+ private: |
+ class Delegate; |
+ |
+ std::unique_ptr<net::URLRequestContext> url_request_context_; |
+ std::unique_ptr<net::URLRequestJobFactory> url_request_job_factory_; |
+ std::unique_ptr<Delegate> delagate_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(HttpUrlFetcher); |
+}; |
+ |
+} // namespace headless |
+ |
+#endif // HEADLESS_PUBLIC_UTIL_HTTP_URL_FETCHER_H_ |