Index: headless/public/util/black_hole_protocol_handler.h |
diff --git a/headless/public/util/black_hole_protocol_handler.h b/headless/public/util/black_hole_protocol_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7d72890483779779b9c17965130441f0b931a823 |
--- /dev/null |
+++ b/headless/public/util/black_hole_protocol_handler.h |
@@ -0,0 +1,31 @@ |
+// 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_BLACK_HOLE_PROTOCOL_HANDLER_H_ |
+#define HEADLESS_PUBLIC_UTIL_BLACK_HOLE_PROTOCOL_HANDLER_H_ |
+ |
+#include <map> |
+ |
+#include "net/url_request/url_request_job_factory.h" |
+ |
+namespace headless { |
+ |
+// A protocol handler that fails any request sent to it. |
+class BlackHoleProtocolHandler |
+ : public net::URLRequestJobFactory::ProtocolHandler { |
+ public: |
+ BlackHoleProtocolHandler(); |
+ ~BlackHoleProtocolHandler() override; |
+ |
+ net::URLRequestJob* MaybeCreateJob( |
+ net::URLRequest* request, |
+ net::NetworkDelegate* network_delegate) const override; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(BlackHoleProtocolHandler); |
+}; |
+ |
+} // namespace headless |
+ |
+#endif // HEADLESS_PUBLIC_UTIL_BLACK_HOLE_PROTOCOL_HANDLER_H_ |