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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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 "net/base/load_flags.h" 8 #include "net/base/load_flags.h"
9 #include "net/url_request/url_request_job_manager.h" 9 #include "net/url_request/url_request_job_manager.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 URLRequestJobFactoryImpl::URLRequestJobFactoryImpl() {} 14 URLRequestJobFactoryImpl::URLRequestJobFactoryImpl() {
15 }
15 16
16 URLRequestJobFactoryImpl::~URLRequestJobFactoryImpl() { 17 URLRequestJobFactoryImpl::~URLRequestJobFactoryImpl() {
17 STLDeleteValues(&protocol_handler_map_); 18 STLDeleteValues(&protocol_handler_map_);
18 } 19 }
19 20
20 bool URLRequestJobFactoryImpl::SetProtocolHandler( 21 bool URLRequestJobFactoryImpl::SetProtocolHandler(
21 const std::string& scheme, 22 const std::string& scheme,
22 ProtocolHandler* protocol_handler) { 23 ProtocolHandler* protocol_handler) {
23 DCHECK(CalledOnValidThread()); 24 DCHECK(CalledOnValidThread());
24 25
(...skipping 21 matching lines...) Expand all
46 ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme); 47 ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme);
47 if (it == protocol_handler_map_.end()) 48 if (it == protocol_handler_map_.end())
48 return NULL; 49 return NULL;
49 return it->second->MaybeCreateJob(request, network_delegate); 50 return it->second->MaybeCreateJob(request, network_delegate);
50 } 51 }
51 52
52 bool URLRequestJobFactoryImpl::IsHandledProtocol( 53 bool URLRequestJobFactoryImpl::IsHandledProtocol(
53 const std::string& scheme) const { 54 const std::string& scheme) const {
54 DCHECK(CalledOnValidThread()); 55 DCHECK(CalledOnValidThread());
55 return ContainsKey(protocol_handler_map_, scheme) || 56 return ContainsKey(protocol_handler_map_, scheme) ||
56 URLRequestJobManager::GetInstance()->SupportsScheme(scheme); 57 URLRequestJobManager::GetInstance()->SupportsScheme(scheme);
57 } 58 }
58 59
59 bool URLRequestJobFactoryImpl::IsHandledURL(const GURL& url) const { 60 bool URLRequestJobFactoryImpl::IsHandledURL(const GURL& url) const {
60 if (!url.is_valid()) { 61 if (!url.is_valid()) {
61 // We handle error cases. 62 // We handle error cases.
62 return true; 63 return true;
63 } 64 }
64 return IsHandledProtocol(url.scheme()); 65 return IsHandledProtocol(url.scheme());
65 } 66 }
66 67
67 bool URLRequestJobFactoryImpl::IsSafeRedirectTarget( 68 bool URLRequestJobFactoryImpl::IsSafeRedirectTarget(
68 const GURL& location) const { 69 const GURL& location) const {
69 DCHECK(CalledOnValidThread()); 70 DCHECK(CalledOnValidThread());
70 if (!location.is_valid()) { 71 if (!location.is_valid()) {
71 // Error cases are safely handled. 72 // Error cases are safely handled.
72 return true; 73 return true;
73 } 74 }
74 ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find( 75 ProtocolHandlerMap::const_iterator it =
75 location.scheme()); 76 protocol_handler_map_.find(location.scheme());
76 if (it == protocol_handler_map_.end()) { 77 if (it == protocol_handler_map_.end()) {
77 // Unhandled cases are safely handled. 78 // Unhandled cases are safely handled.
78 return true; 79 return true;
79 } 80 }
80 return it->second->IsSafeRedirectTarget(location); 81 return it->second->IsSafeRedirectTarget(location);
81 } 82 }
82 83
83 } // namespace net 84 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698