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

Side by Side Diff: net/url_request/url_request_job_factory.cc

Issue 7075005: Revert 86802 - Remove ProtocolFactory/Interceptor uses in GViewRequestInterceptor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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
« no previous file with comments | « net/url_request/url_request_job_factory.h ('k') | net/url_request/url_request_job_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_job_factory.h" 5 #include "net/url_request/url_request_job_factory.h"
6 6
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "net/base/load_flags.h" 9 #include "net/base/load_flags.h"
10 #include "net/url_request/url_request_job_manager.h" 10 #include "net/url_request/url_request_job_manager.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 URLRequestJob* URLRequestJobFactory::MaybeCreateJobWithProtocolHandler( 69 URLRequestJob* URLRequestJobFactory::MaybeCreateJobWithProtocolHandler(
70 const std::string& scheme, 70 const std::string& scheme,
71 URLRequest* request) const { 71 URLRequest* request) const {
72 DCHECK(CalledOnValidThread()); 72 DCHECK(CalledOnValidThread());
73 ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme); 73 ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme);
74 if (it == protocol_handler_map_.end()) 74 if (it == protocol_handler_map_.end())
75 return NULL; 75 return NULL;
76 return it->second->MaybeCreateJob(request); 76 return it->second->MaybeCreateJob(request);
77 } 77 }
78 78
79 URLRequestJob* URLRequestJobFactory::MaybeInterceptRedirect(
80 const GURL& location,
81 URLRequest* request) const {
82 DCHECK(CalledOnValidThread());
83 URLRequestJob* job = NULL;
84
85 if (!(request->load_flags() & LOAD_DISABLE_INTERCEPT)) {
86 InterceptorList::const_iterator i;
87 for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
88 job = (*i)->MaybeInterceptRedirect(location, request);
89 if (job)
90 return job;
91 }
92 }
93 return NULL;
94 }
95
96 URLRequestJob* URLRequestJobFactory::MaybeInterceptResponse(
97 URLRequest* request) const {
98 DCHECK(CalledOnValidThread());
99 URLRequestJob* job = NULL;
100
101 if (!(request->load_flags() & LOAD_DISABLE_INTERCEPT)) {
102 InterceptorList::const_iterator i;
103 for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
104 job = (*i)->MaybeInterceptResponse(request);
105 if (job)
106 return job;
107 }
108 }
109 return NULL;
110 }
111
112 bool URLRequestJobFactory::IsHandledProtocol(const std::string& scheme) const { 79 bool URLRequestJobFactory::IsHandledProtocol(const std::string& scheme) const {
113 DCHECK(CalledOnValidThread()); 80 DCHECK(CalledOnValidThread());
114 InterceptorList::const_iterator i; 81 InterceptorList::const_iterator i;
115 for (i = interceptors_.begin(); i != interceptors_.end(); ++i) { 82 for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
116 if ((*i)->WillHandleProtocol(scheme)) 83 if ((*i)->WillHandleProtocol(scheme))
117 return true; 84 return true;
118 } 85 }
119 return ContainsKey(protocol_handler_map_, scheme) || 86 return ContainsKey(protocol_handler_map_, scheme) ||
120 URLRequestJobManager::GetInstance()->SupportsScheme(scheme); 87 URLRequestJobManager::GetInstance()->SupportsScheme(scheme);
121 } 88 }
122 89
123 bool URLRequestJobFactory::IsHandledURL(const GURL& url) const { 90 bool URLRequestJobFactory::IsHandledURL(const GURL& url) const {
124 if (!url.is_valid()) { 91 if (!url.is_valid()) {
125 // We handle error cases. 92 // We handle error cases.
126 return true; 93 return true;
127 } 94 }
128 return IsHandledProtocol(url.scheme()); 95 return IsHandledProtocol(url.scheme());
129 } 96 }
130 97
131 } // namespace net 98 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_factory.h ('k') | net/url_request/url_request_job_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698