blob: f5e5d208f8f55f0913b95aed48bb4b277675463c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright (c) 2014 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 "content/browser/android/content_protocol_handler_impl.h"
#include "base/task_runner.h"
#include "content/browser/android/url_request_content_job.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_error_job.h"
namespace content {
// static
ContentProtocolHandler* ContentProtocolHandler::Create(
const scoped_refptr<base::TaskRunner>& content_task_runner) {
return new ContentProtocolHandlerImpl(content_task_runner);
}
ContentProtocolHandlerImpl::ContentProtocolHandlerImpl(
const scoped_refptr<base::TaskRunner>& content_task_runner)
: content_task_runner_(content_task_runner) {}
ContentProtocolHandlerImpl::~ContentProtocolHandlerImpl() {}
net::URLRequestJob* ContentProtocolHandlerImpl::MaybeCreateJob(
net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
if (!network_delegate) {
return new net::URLRequestErrorJob(
request, network_delegate, net::ERR_ACCESS_DENIED);
}
return new URLRequestContentJob(
request, network_delegate, base::FilePath(request->url().spec()),
content_task_runner_);
}
bool ContentProtocolHandlerImpl::IsSafeRedirectTarget(
const GURL& location) const {
return false;
}
} // namespace content
|