| OLD | NEW |
| 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_impl.h" | 5 #include "net/url_request/url_request_job_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool URLRequestJobFactoryImpl::IsHandledURL(const GURL& url) const { | 59 bool URLRequestJobFactoryImpl::IsHandledURL(const GURL& url) const { |
| 60 if (!url.is_valid()) { | 60 if (!url.is_valid()) { |
| 61 // We handle error cases. | 61 // We handle error cases. |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 return IsHandledProtocol(url.scheme()); | 64 return IsHandledProtocol(url.scheme()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool URLRequestJobFactoryImpl::IsSafeRedirectTarget( |
| 68 const GURL& location) const { |
| 69 DCHECK(CalledOnValidThread()); |
| 70 if (!location.is_valid()) { |
| 71 // Error cases are safely handled. |
| 72 return true; |
| 73 } |
| 74 ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find( |
| 75 location.scheme()); |
| 76 if (it == protocol_handler_map_.end()) { |
| 77 // Unhandled cases are safely handled. |
| 78 return true; |
| 79 } |
| 80 return it->second->IsSafeRedirectTarget(location); |
| 81 } |
| 82 |
| 67 } // namespace net | 83 } // namespace net |
| OLD | NEW |