OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "android_webview/browser/net/fallback_protocol_handler.h" |
| 6 |
| 7 using net::URLRequestJobFactory; |
| 8 |
| 9 namespace android_webview { |
| 10 |
| 11 namespace { |
| 12 |
| 13 typedef std::vector<net::URLRequestJobFactory::ProtocolHandler*> |
| 14 ProtocolHandlerVector; |
| 15 |
| 16 } // namespace |
| 17 |
| 18 FallbackProtocolHandler::FallbackProtocolHandler( |
| 19 ProtocolHandlerVector* handlers, |
| 20 scoped_ptr<URLRequestJobFactory::ProtocolHandler> fallback_handler) |
| 21 : fallback_handler_(fallback_handler.Pass()) { |
| 22 handlers_.swap(*handlers); |
| 23 } |
| 24 |
| 25 FallbackProtocolHandler::~FallbackProtocolHandler() {} |
| 26 |
| 27 net::URLRequestJob* FallbackProtocolHandler::MaybeCreateJob( |
| 28 net::URLRequest* request, |
| 29 net::NetworkDelegate* network_delegate) const { |
| 30 |
| 31 for (ProtocolHandlerVector::iterator i = handlers_.begin(); |
| 32 i != handlers_end(); |
| 33 ++i) { |
| 34 net::URLRequestJob* job = i->MaybeCreateJob(request, network_delegate); |
| 35 if (job) |
| 36 return job; |
| 37 } |
| 38 |
| 39 return fallback_handler_->MaybeCreateJob(request, network_delegate); |
| 40 } |
| 41 |
| 42 } // namespace android_webview |
OLD | NEW |