blob: d4cc49e058217b1ef27cdc39fd28734d2bba7cde (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// Copyright (c) 2011 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 NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_
#define NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/threading/non_thread_safe.h"
#include "net/base/net_export.h"
class GURL;
namespace net {
class NetworkDelegate;
class URLRequest;
class URLRequestJob;
class NET_EXPORT URLRequestJobFactory
: NON_EXPORTED_BASE(public base::NonThreadSafe) {
public:
// TODO(shalev): Move this to URLRequestJobFactoryImpl.
class NET_EXPORT ProtocolHandler {
public:
virtual ~ProtocolHandler();
virtual URLRequestJob* MaybeCreateJob(
URLRequest* request, NetworkDelegate* network_delegate) const = 0;
// Indicates if it should be safe to redirect to |location|. Should handle
// protocols handled by MaybeCreateJob(). Only called when registered with
// URLRequestJobFactoryImpl::SetProtocolHandler() not called when used with
// ProtocolInterceptJobFactory.
// NOTE(pauljensen): Default implementation returns true.
virtual bool IsSafeRedirectTarget(const GURL& location) const;
};
URLRequestJobFactory();
virtual ~URLRequestJobFactory();
virtual URLRequestJob* MaybeCreateJobWithProtocolHandler(
const std::string& scheme,
URLRequest* request,
NetworkDelegate* network_delegate) const = 0;
virtual bool IsHandledProtocol(const std::string& scheme) const = 0;
virtual bool IsHandledURL(const GURL& url) const = 0;
virtual bool IsSafeRedirectTarget(const GURL& location) const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactory);
};
} // namespace net
#endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_
|