Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: headless/public/util/http_url_fetcher.h

Issue 2352663003: Adds a --deterministic-fetch flag to headless_shell (Closed)
Patch Set: Added a few comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698