1 // Copyright (c) 2014 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.
5 #include "content/browser/android/content_protocol_handler_impl.h"
7 #include "base/task_runner.h"
8 #include "content/browser/android/url_request_content_job.h"
9 #include "net/base/net_errors.h"
10 #include "net/url_request/url_request.h"
11 #include "net/url_request/url_request_error_job.h"
16 ContentProtocolHandler
* ContentProtocolHandler::Create(
17 const scoped_refptr
<base::TaskRunner
>& content_task_runner
) {
18 return new ContentProtocolHandlerImpl(content_task_runner
);
21 ContentProtocolHandlerImpl::ContentProtocolHandlerImpl(
22 const scoped_refptr
<base::TaskRunner
>& content_task_runner
)
23 : content_task_runner_(content_task_runner
) {}
25 ContentProtocolHandlerImpl::~ContentProtocolHandlerImpl() {}
27 net::URLRequestJob
* ContentProtocolHandlerImpl::MaybeCreateJob(
28 net::URLRequest
* request
, net::NetworkDelegate
* network_delegate
) const {
29 if (!network_delegate
) {
30 return new net::URLRequestErrorJob(
31 request
, network_delegate
, net::ERR_ACCESS_DENIED
);
33 return new URLRequestContentJob(
34 request
, network_delegate
, base::FilePath(request
->url().spec()),
35 content_task_runner_
);
38 bool ContentProtocolHandlerImpl::IsSafeRedirectTarget(
39 const GURL
& location
) const {
43 } // namespace content