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

Side by Side Diff: chrome/browser/net/http_intercept_job_factory.cc

Issue 10836248: Turned job_factory into a pure virtual class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 "chrome/browser/net/http_intercept_job_factory.h"
6
7 #include "base/stl_util.h"
8 #include "googleurl/src/gurl.h"
9 #include "net/base/load_flags.h"
10 #include "net/url_request/url_request_job_manager.h"
11
12 class GURL;
13
14 namespace net {
15
16 const char* kHttpScheme = "http";
17 const char* kHttpsScheme = "https";
18
19 HttpInterceptJobFactory::HttpInterceptJobFactory(
20 const URLRequestJobFactory* job_factory,
21 ProtocolHandler* protocol_handler)
22 : job_factory_(job_factory),
23 protocol_handler_(protocol_handler) {
24 }
25
26 HttpInterceptJobFactory::~HttpInterceptJobFactory() {}
27
28 bool HttpInterceptJobFactory::SetProtocolHandler(
29 const std::string& scheme, ProtocolHandler* protocol_handler) {
30 NOTREACHED();
31 return false;
32 }
33
34 void HttpInterceptJobFactory::AddInterceptor(Interceptor* interceptor) {
35 // Interceptor addition is not allowed.
36 NOTREACHED();
37 }
38
39 URLRequestJob* HttpInterceptJobFactory::MaybeCreateJobWithInterceptor(
40 URLRequest* request) const {
41 return job_factory_->MaybeCreateJobWithInterceptor(request);
42 }
43
44 URLRequestJob* HttpInterceptJobFactory::MaybeCreateJobWithProtocolHandler(
45 const std::string& scheme, URLRequest* request) const {
46 DCHECK(CalledOnValidThread());
47 if (scheme == kHttpScheme || scheme == kHttpsScheme)
48 return protocol_handler_->MaybeCreateJob(request);
49 return job_factory_->MaybeCreateJobWithProtocolHandler(scheme, request);
50 }
51
52 URLRequestJob* HttpInterceptJobFactory::MaybeInterceptRedirect(
53 const GURL& location, URLRequest* request) const {
54 return job_factory_->MaybeInterceptRedirect(location, request);
55 }
56
57 URLRequestJob* HttpInterceptJobFactory::MaybeInterceptResponse(
58 URLRequest* request) const {
59 return job_factory_->MaybeInterceptResponse(request);
60 }
61
62 bool HttpInterceptJobFactory::IsHandledProtocol(
63 const std::string& scheme) const {
64 DCHECK(CalledOnValidThread());
65 if (scheme == kHttpScheme || scheme == kHttpsScheme)
66 return true;
67 return job_factory_->IsHandledProtocol(scheme);
68 }
69
70 bool HttpInterceptJobFactory::IsHandledURL(const GURL& url) const {
71 if (url.scheme() == kHttpScheme || url.scheme() == kHttpsScheme)
72 return true;
73 return job_factory_->IsHandledURL(url);
74 }
75
76 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698