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 // A class to help filter URLRequest jobs based on the URL of the request | 5 // A class to help filter URLRequest jobs based on the URL of the request |
6 // rather than just the scheme. Example usage: | 6 // rather than just the scheme. Example usage: |
7 // | 7 // |
8 // // Use as an "http" handler. | 8 // // Use as an "http" handler. |
9 // URLRequest::RegisterProtocolFactory("http", &URLRequestFilter::Factory); | 9 // URLRequest::RegisterProtocolFactory("http", &URLRequestFilter::Factory); |
10 // // Add special handling for the URL http://foo.com/ | 10 // // Add special handling for the URL http://foo.com/ |
11 // URLRequestFilter::GetInstance()->AddUrlHandler( | 11 // URLRequestFilter::GetInstance()->AddUrlHandler( |
12 // GURL("http://foo.com/"), | 12 // GURL("http://foo.com/"), |
13 // &URLRequestCustomJob::Factory); | 13 // &URLRequestCustomJob::Factory); |
14 // | 14 // |
15 // If URLRequestFilter::Factory can't find a handle for the request, it passes | 15 // If URLRequestFilter::Factory can't find a handle for the request, it passes |
16 // it through to URLRequestInetJob::Factory and lets the default network stack | 16 // it through to URLRequestInetJob::Factory and lets the default network stack |
17 // handle it. | 17 // handle it. |
18 | 18 |
19 #ifndef NET_URL_REQUEST_URL_REQUEST_FILTER_H_ | 19 #ifndef NET_URL_REQUEST_URL_REQUEST_FILTER_H_ |
20 #define NET_URL_REQUEST_URL_REQUEST_FILTER_H_ | 20 #define NET_URL_REQUEST_URL_REQUEST_FILTER_H_ |
21 | 21 |
22 #include <map> | 22 #include <map> |
23 #include <string> | 23 #include <string> |
24 | 24 |
25 #include "base/callback.h" | 25 #include "base/callback.h" |
26 #include "base/hash_tables.h" | 26 #include "base/containers/hash_tables.h" |
27 #include "base/memory/scoped_ptr.h" | 27 #include "base/memory/scoped_ptr.h" |
28 #include "net/base/net_export.h" | 28 #include "net/base/net_export.h" |
29 #include "net/url_request/url_request.h" | 29 #include "net/url_request/url_request.h" |
30 #include "net/url_request/url_request_job_factory.h" | 30 #include "net/url_request/url_request_job_factory.h" |
31 | 31 |
32 class GURL; | 32 class GURL; |
33 | 33 |
34 namespace net { | 34 namespace net { |
35 class URLRequestJob; | 35 class URLRequestJob; |
36 | 36 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 private: | 96 private: |
97 // Singleton instance. | 97 // Singleton instance. |
98 static URLRequestFilter* shared_instance_; | 98 static URLRequestFilter* shared_instance_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(URLRequestFilter); | 100 DISALLOW_COPY_AND_ASSIGN(URLRequestFilter); |
101 }; | 101 }; |
102 | 102 |
103 } // namespace net | 103 } // namespace net |
104 | 104 |
105 #endif // NET_URL_REQUEST_URL_REQUEST_FILTER_H_ | 105 #endif // NET_URL_REQUEST_URL_REQUEST_FILTER_H_ |
OLD | NEW |