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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ |
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // must be "http". | 30 // must be "http". |
31 void SetResponse(const std::string& url, | 31 void SetResponse(const std::string& url, |
32 const std::string& headers, | 32 const std::string& headers, |
33 const FilePath& path); | 33 const FilePath& path); |
34 | 34 |
35 // Returns how many requests have been issued that have a stored reply. | 35 // Returns how many requests have been issued that have a stored reply. |
36 int hit_count() const { return hit_count_; } | 36 int hit_count() const { return hit_count_; } |
37 | 37 |
38 private: | 38 private: |
39 // When computing matches, this ignores the query parameters of the url. | 39 // When computing matches, this ignores the query parameters of the url. |
40 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) OVERRIDE; | 40 virtual net::URLRequestJob* MaybeIntercept( |
| 41 net::URLRequest* request, |
| 42 net::NetworkDelegate* network_delegate) OVERRIDE; |
41 | 43 |
42 friend class base::RefCountedThreadSafe<ComponentUpdateInterceptor>; | 44 friend class base::RefCountedThreadSafe<ComponentUpdateInterceptor>; |
43 | 45 |
44 virtual ~ComponentUpdateInterceptor(); | 46 virtual ~ComponentUpdateInterceptor(); |
45 | 47 |
46 struct Response { | 48 struct Response { |
47 FilePath data_path; | 49 FilePath data_path; |
48 std::string headers; | 50 std::string headers; |
49 }; | 51 }; |
50 | 52 |
51 typedef std::map<GURL, Response> ResponseMap; | 53 typedef std::map<GURL, Response> ResponseMap; |
52 ResponseMap responses_; | 54 ResponseMap responses_; |
53 int hit_count_; | 55 int hit_count_; |
54 | 56 |
55 DISALLOW_COPY_AND_ASSIGN(ComponentUpdateInterceptor); | 57 DISALLOW_COPY_AND_ASSIGN(ComponentUpdateInterceptor); |
56 }; | 58 }; |
57 | 59 |
58 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ | 60 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_INTERCEPTOR_H_ |
OLD | NEW |