OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/ref_counted.h" |
11 | 12 |
12 namespace net { | 13 namespace net { |
13 class URLRequest; | 14 class URLRequest; |
14 class URLRequestJob; | 15 class URLRequestJob; |
15 class NetworkDelegate; | 16 class NetworkDelegate; |
16 } | 17 } |
17 | 18 |
18 namespace android_webview { | 19 namespace android_webview { |
19 | 20 |
| 21 class InterceptedRequestData; |
| 22 |
20 // This class represents the Java-side data that is to be used to complete a | 23 // This class represents the Java-side data that is to be used to complete a |
21 // particular URLRequest. | 24 // particular URLRequest. |
22 class InterceptedRequestData { | 25 class InterceptedRequestData { |
23 public: | 26 public: |
| 27 typedef base::RefCountedData<scoped_ptr<InterceptedRequestData> > Holder; |
24 virtual ~InterceptedRequestData() {} | 28 virtual ~InterceptedRequestData() {} |
25 | 29 |
26 // This creates a URLRequestJob for the |request| wich will read data from | 30 // This creates a URLRequestJob for the |request| wich will read data from the |
27 // the |intercepted_request_data| structure (instead of going to the network | 31 // |intercepted_request_data| structure obtained from |holder| (instead of |
28 // or to the cache). | 32 // going to the network or to the cache). |
29 // The newly created job does not take ownership of |this|. | 33 static net::URLRequestJob* CreateJobFor( |
30 virtual net::URLRequestJob* CreateJobFor( | 34 scoped_refptr<Holder> holder, |
31 net::URLRequest* request, | 35 net::URLRequest* request, |
32 net::NetworkDelegate* network_delegate) const = 0; | 36 net::NetworkDelegate* network_delegate); |
33 | 37 |
34 protected: | 38 protected: |
35 InterceptedRequestData() {} | 39 InterceptedRequestData() {} |
36 | 40 |
37 private: | 41 private: |
38 DISALLOW_COPY_AND_ASSIGN(InterceptedRequestData); | 42 DISALLOW_COPY_AND_ASSIGN(InterceptedRequestData); |
39 }; | 43 }; |
40 | 44 |
41 } // namespace android_webview | 45 } // namespace android_webview |
42 | 46 |
43 #endif // ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ | 47 #endif // ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ |
OLD | NEW |