| Index: net/url_request/url_request_filter.cc
|
| diff --git a/net/url_request/url_request_filter.cc b/net/url_request/url_request_filter.cc
|
| index 19a8747ea9bbdd92a9cc2b703b87197c97e780ab..8f8d1e0f7a8ac20c3dc956c2eba4e810fd9f69c6 100644
|
| --- a/net/url_request/url_request_filter.cc
|
| +++ b/net/url_request/url_request_filter.cc
|
| @@ -22,7 +22,8 @@ class URLRequestFilterProtocolHandler
|
|
|
| // URLRequestJobFactory::ProtocolHandler implementation
|
| virtual URLRequestJob* MaybeCreateJob(
|
| - URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE {
|
| + URLRequest* request,
|
| + NetworkDelegate* network_delegate) const OVERRIDE {
|
| return factory_(request, network_delegate, request->url().scheme());
|
| }
|
|
|
| @@ -36,7 +37,8 @@ class URLRequestFilterProtocolHandler
|
|
|
| URLRequestFilter* URLRequestFilter::shared_instance_ = NULL;
|
|
|
| -URLRequestFilter::~URLRequestFilter() {}
|
| +URLRequestFilter::~URLRequestFilter() {
|
| +}
|
|
|
| // static
|
| URLRequestJob* URLRequestFilter::Factory(URLRequest* request,
|
| @@ -53,12 +55,14 @@ URLRequestFilter* URLRequestFilter::GetInstance() {
|
| return shared_instance_;
|
| }
|
|
|
| -void URLRequestFilter::AddHostnameHandler(const std::string& scheme,
|
| - const std::string& hostname, URLRequest::ProtocolFactory* factory) {
|
| - AddHostnameProtocolHandler(
|
| - scheme, hostname,
|
| - scoped_ptr<URLRequestJobFactory::ProtocolHandler>(
|
| - new URLRequestFilterProtocolHandler(factory)));
|
| +void URLRequestFilter::AddHostnameHandler(
|
| + const std::string& scheme,
|
| + const std::string& hostname,
|
| + URLRequest::ProtocolFactory* factory) {
|
| + AddHostnameProtocolHandler(scheme,
|
| + hostname,
|
| + scoped_ptr<URLRequestJobFactory::ProtocolHandler>(
|
| + new URLRequestFilterProtocolHandler(factory)));
|
| }
|
|
|
| void URLRequestFilter::AddHostnameProtocolHandler(
|
| @@ -70,13 +74,14 @@ void URLRequestFilter::AddHostnameProtocolHandler(
|
| protocol_handler.release();
|
|
|
| // Register with the ProtocolFactory.
|
| - URLRequest::Deprecated::RegisterProtocolFactory(
|
| - scheme, &URLRequestFilter::Factory);
|
| + URLRequest::Deprecated::RegisterProtocolFactory(scheme,
|
| + &URLRequestFilter::Factory);
|
|
|
| #ifndef NDEBUG
|
| // Check to see if we're masking URLs in the url_handler_map_.
|
| for (UrlHandlerMap::const_iterator i = url_handler_map_.begin();
|
| - i != url_handler_map_.end(); ++i) {
|
| + i != url_handler_map_.end();
|
| + ++i) {
|
| const GURL& url = GURL(i->first);
|
| HostnameHandlerMap::iterator host_it =
|
| hostname_handler_map_.find(make_pair(url.scheme(), url.host()));
|
| @@ -99,16 +104,14 @@ void URLRequestFilter::RemoveHostnameHandler(const std::string& scheme,
|
| // handlers.
|
| }
|
|
|
| -bool URLRequestFilter::AddUrlHandler(
|
| - const GURL& url,
|
| - URLRequest::ProtocolFactory* factory) {
|
| +bool URLRequestFilter::AddUrlHandler(const GURL& url,
|
| + URLRequest::ProtocolFactory* factory) {
|
| return AddUrlProtocolHandler(
|
| url,
|
| scoped_ptr<URLRequestJobFactory::ProtocolHandler>(
|
| new URLRequestFilterProtocolHandler(factory)));
|
| }
|
|
|
| -
|
| bool URLRequestFilter::AddUrlProtocolHandler(
|
| const GURL& url,
|
| scoped_ptr<URLRequestJobFactory::ProtocolHandler> protocol_handler) {
|
| @@ -121,8 +124,8 @@ bool URLRequestFilter::AddUrlProtocolHandler(
|
| URLRequest::Deprecated::RegisterProtocolFactory(url.scheme(),
|
| &URLRequestFilter::Factory);
|
| // Check to see if this URL is masked by a hostname handler.
|
| - DCHECK_EQ(0u, hostname_handler_map_.count(make_pair(url.scheme(),
|
| - url.host())));
|
| + DCHECK_EQ(0u,
|
| + hostname_handler_map_.count(make_pair(url.scheme(), url.host())));
|
|
|
| return true;
|
| }
|
| @@ -142,15 +145,18 @@ void URLRequestFilter::ClearHandlers() {
|
| // Unregister with the ProtocolFactory.
|
| std::set<std::string> schemes;
|
| for (UrlHandlerMap::const_iterator i = url_handler_map_.begin();
|
| - i != url_handler_map_.end(); ++i) {
|
| + i != url_handler_map_.end();
|
| + ++i) {
|
| schemes.insert(GURL(i->first).scheme());
|
| }
|
| for (HostnameHandlerMap::const_iterator i = hostname_handler_map_.begin();
|
| - i != hostname_handler_map_.end(); ++i) {
|
| + i != hostname_handler_map_.end();
|
| + ++i) {
|
| schemes.insert(i->first.first);
|
| }
|
| for (std::set<std::string>::const_iterator scheme = schemes.begin();
|
| - scheme != schemes.end(); ++scheme) {
|
| + scheme != schemes.end();
|
| + ++scheme) {
|
| URLRequest::Deprecated::RegisterProtocolFactory(*scheme, NULL);
|
| }
|
|
|
| @@ -159,7 +165,8 @@ void URLRequestFilter::ClearHandlers() {
|
| hit_count_ = 0;
|
| }
|
|
|
| -URLRequestFilter::URLRequestFilter() : hit_count_(0) { }
|
| +URLRequestFilter::URLRequestFilter() : hit_count_(0) {
|
| +}
|
|
|
| URLRequestJob* URLRequestFilter::FindRequestHandler(
|
| URLRequest* request,
|
|
|