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

Unified Diff: android_webview/browser/net/fallback_protocol_handler.cc

Issue 12377051: [android_webview] Don't intercept resource and asset URLRequests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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: android_webview/browser/net/fallback_protocol_handler.cc
diff --git a/android_webview/browser/net/fallback_protocol_handler.cc b/android_webview/browser/net/fallback_protocol_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2dab03e6cfd7b3a5b56b9e30b7aa1e8b5223213f
--- /dev/null
+++ b/android_webview/browser/net/fallback_protocol_handler.cc
@@ -0,0 +1,42 @@
+// Copyright 2013 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.
+
+#include "android_webview/browser/net/fallback_protocol_handler.h"
+
+using net::URLRequestJobFactory;
+
+namespace android_webview {
+
+namespace {
+
+typedef std::vector<net::URLRequestJobFactory::ProtocolHandler*>
+ ProtocolHandlerVector;
+
+} // namespace
+
+FallbackProtocolHandler::FallbackProtocolHandler(
+ ProtocolHandlerVector* handlers,
+ scoped_ptr<URLRequestJobFactory::ProtocolHandler> fallback_handler)
+ : fallback_handler_(fallback_handler.Pass()) {
+ handlers_.swap(*handlers);
+}
+
+FallbackProtocolHandler::~FallbackProtocolHandler() {}
+
+net::URLRequestJob* FallbackProtocolHandler::MaybeCreateJob(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const {
+
+ for (ProtocolHandlerVector::iterator i = handlers_.begin();
+ i != handlers_end();
+ ++i) {
+ net::URLRequestJob* job = i->MaybeCreateJob(request, network_delegate);
+ if (job)
+ return job;
+ }
+
+ return fallback_handler_->MaybeCreateJob(request, network_delegate);
+}
+
+} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698