OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/custom_handlers/protocol_handler_registry.h" | 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 ProtocolHandler handler = LookupHandler(default_handlers_, | 144 ProtocolHandler handler = LookupHandler(default_handlers_, |
145 request->url().scheme()); | 145 request->url().scheme()); |
146 if (handler.IsEmpty()) | 146 if (handler.IsEmpty()) |
147 return NULL; | 147 return NULL; |
148 | 148 |
149 GURL translated_url(handler.TranslateUrl(request->url())); | 149 GURL translated_url(handler.TranslateUrl(request->url())); |
150 if (!translated_url.is_valid()) | 150 if (!translated_url.is_valid()) |
151 return NULL; | 151 return NULL; |
152 | 152 |
153 return new net::URLRequestRedirectJob( | 153 return new net::URLRequestRedirectJob( |
154 request, network_delegate, translated_url); | 154 request, network_delegate, translated_url, |
| 155 net::URLRequestRedirectJob::REDIRECT_302_FOUND); |
155 } | 156 } |
156 | 157 |
157 // URLInterceptor ------------------------------------------------------------ | 158 // URLInterceptor ------------------------------------------------------------ |
158 | 159 |
159 // Instances of this class are produced for ownership by the IO | 160 // Instances of this class are produced for ownership by the IO |
160 // thread where it handler URL requests. We should never hold | 161 // thread where it handler URL requests. We should never hold |
161 // any pointers on this class, only produce them in response to | 162 // any pointers on this class, only produce them in response to |
162 // requests via |ProtocolHandlerRegistry::CreateURLInterceptor|. | 163 // requests via |ProtocolHandlerRegistry::CreateURLInterceptor|. |
163 class ProtocolHandlerRegistry::URLInterceptor | 164 class ProtocolHandlerRegistry::URLInterceptor |
164 : public net::URLRequestJobFactory::Interceptor { | 165 : public net::URLRequestJobFactory::Interceptor { |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 } | 875 } |
875 | 876 |
876 net::URLRequestJobFactory::Interceptor* | 877 net::URLRequestJobFactory::Interceptor* |
877 ProtocolHandlerRegistry::CreateURLInterceptor() { | 878 ProtocolHandlerRegistry::CreateURLInterceptor() { |
878 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 879 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
879 // this is always created on the UI thread (in profile_io's | 880 // this is always created on the UI thread (in profile_io's |
880 // InitializeOnUIThread. Any method calls must be done | 881 // InitializeOnUIThread. Any method calls must be done |
881 // on the IO thread (this is checked). | 882 // on the IO thread (this is checked). |
882 return new URLInterceptor(core_); | 883 return new URLInterceptor(core_); |
883 } | 884 } |
OLD | NEW |