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 CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | |
8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
10 #include "content/browser/loader/resource_handler.h" | 11 #include "content/browser/loader/resource_handler.h" |
11 #include "content/browser/ssl/ssl_error_handler.h" | 12 #include "content/browser/ssl/ssl_error_handler.h" |
12 #include "content/public/browser/resource_controller.h" | 13 #include "content/public/browser/resource_controller.h" |
13 #include "net/url_request/url_request.h" | 14 #include "net/url_request/url_request.h" |
14 | 15 |
16 namespace net { | |
17 class ClientCertStore; | |
18 } | |
19 | |
15 namespace content { | 20 namespace content { |
16 class ResourceDispatcherHostLoginDelegate; | 21 class ResourceDispatcherHostLoginDelegate; |
17 class ResourceLoaderDelegate; | 22 class ResourceLoaderDelegate; |
18 class ResourceRequestInfoImpl; | 23 class ResourceRequestInfoImpl; |
19 class SSLClientAuthHandler; | 24 class SSLClientAuthHandler; |
20 | 25 |
21 // This class is responsible for driving the URLRequest (i.e., calling Start, | 26 // This class is responsible for driving the URLRequest (i.e., calling Start, |
22 // Read, and servicing events). It has a ResourceHandler, which is typically a | 27 // Read, and servicing events). It has a ResourceHandler, which is typically a |
23 // chain of ResourceHandlers, and is the ResourceController for its handler. | 28 // chain of ResourceHandlers, and is the ResourceController for its handler. |
24 class ResourceLoader : public net::URLRequest::Delegate, | 29 class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, |
Ryan Sleevi
2013/02/01 22:48:37
This is incorrect, in that ResourceLoader should *
ppi
2013/02/04 19:35:54
I would have meant that if we had CONTENT_EXPORT_P
| |
25 public SSLErrorHandler::Delegate, | 30 public SSLErrorHandler::Delegate, |
26 public ResourceController { | 31 public ResourceController { |
27 public: | 32 public: |
28 ResourceLoader(scoped_ptr<net::URLRequest> request, | 33 ResourceLoader(scoped_ptr<net::URLRequest> request, |
29 scoped_ptr<ResourceHandler> handler, | 34 scoped_ptr<ResourceHandler> handler, |
30 ResourceLoaderDelegate* delegate); | 35 ResourceLoaderDelegate* delegate); |
31 virtual ~ResourceLoader(); | 36 virtual ~ResourceLoader(); |
32 | 37 |
33 void StartRequest(); | 38 void StartRequest(); |
34 void CancelRequest(bool from_renderer); | 39 void CancelRequest(bool from_renderer); |
35 | 40 |
36 void ReportUploadProgress(); | 41 void ReportUploadProgress(); |
37 | 42 |
38 bool is_transferring() const { return is_transferring_; } | 43 bool is_transferring() const { return is_transferring_; } |
39 void MarkAsTransferring(); | 44 void MarkAsTransferring(); |
40 void WillCompleteTransfer(); | 45 void WillCompleteTransfer(); |
41 void CompleteTransfer(scoped_ptr<ResourceHandler> new_handler); | 46 void CompleteTransfer(scoped_ptr<ResourceHandler> new_handler); |
42 | 47 |
43 net::URLRequest* request() { return request_.get(); } | 48 net::URLRequest* request() { return request_.get(); } |
44 ResourceRequestInfoImpl* GetRequestInfo(); | 49 ResourceRequestInfoImpl* GetRequestInfo(); |
45 | 50 |
46 void ClearLoginDelegate(); | 51 void ClearLoginDelegate(); |
47 void ClearSSLClientAuthHandler(); | 52 void ClearSSLClientAuthHandler(); |
48 | 53 |
49 // IPC message handlers: | 54 // IPC message handlers: |
50 void OnUploadProgressACK(); | 55 void OnUploadProgressACK(); |
51 | 56 |
52 private: | 57 private: |
58 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup); | |
59 | |
60 // Hook for testing - swaps the client cert store with the provided one. | |
61 void swap_client_cert_store_for_testing( | |
62 scoped_ptr<net::ClientCertStore>& store); | |
Ryan Sleevi
2013/02/01 22:48:37
style:
1) It is not accepted by Google C++ Style
ppi
2013/02/04 19:35:54
Thanks! In patch set 7 I have moved to using a pri
| |
63 | |
53 // net::URLRequest::Delegate implementation: | 64 // net::URLRequest::Delegate implementation: |
54 virtual void OnReceivedRedirect(net::URLRequest* request, | 65 virtual void OnReceivedRedirect(net::URLRequest* request, |
55 const GURL& new_url, | 66 const GURL& new_url, |
56 bool* defer) OVERRIDE; | 67 bool* defer) OVERRIDE; |
57 virtual void OnAuthRequired(net::URLRequest* request, | 68 virtual void OnAuthRequired(net::URLRequest* request, |
58 net::AuthChallengeInfo* info) OVERRIDE; | 69 net::AuthChallengeInfo* info) OVERRIDE; |
59 virtual void OnCertificateRequested(net::URLRequest* request, | 70 virtual void OnCertificateRequested(net::URLRequest* request, |
60 net::SSLCertRequestInfo* info) OVERRIDE; | 71 net::SSLCertRequestInfo* info) OVERRIDE; |
61 virtual void OnSSLCertificateError(net::URLRequest* request, | 72 virtual void OnSSLCertificateError(net::URLRequest* request, |
62 const net::SSLInfo& info, | 73 const net::SSLInfo& info, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 | 118 |
108 uint64 last_upload_position_; | 119 uint64 last_upload_position_; |
109 bool waiting_for_upload_progress_ack_; | 120 bool waiting_for_upload_progress_ack_; |
110 base::TimeTicks last_upload_ticks_; | 121 base::TimeTicks last_upload_ticks_; |
111 | 122 |
112 // Indicates that we are in a state of being transferred to a new downstream | 123 // Indicates that we are in a state of being transferred to a new downstream |
113 // consumer. We are waiting for a notification to complete the transfer, at | 124 // consumer. We are waiting for a notification to complete the transfer, at |
114 // which point we'll receive a new ResourceHandler. | 125 // which point we'll receive a new ResourceHandler. |
115 bool is_transferring_; | 126 bool is_transferring_; |
116 | 127 |
128 scoped_ptr<net::ClientCertStore> client_cert_store_; | |
129 | |
117 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; | 130 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; |
118 | 131 |
119 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 132 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
120 }; | 133 }; |
121 | 134 |
122 } // namespace content | 135 } // namespace content |
123 | 136 |
124 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 137 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
OLD | NEW |