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/gtest_prod_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // This class is responsible for driving the URLRequest (i.e., calling Start, | 28 // This class is responsible for driving the URLRequest (i.e., calling Start, |
29 // Read, and servicing events). It has a ResourceHandler, which is typically a | 29 // Read, and servicing events). It has a ResourceHandler, which is typically a |
30 // chain of ResourceHandlers, and is the ResourceController for its handler. | 30 // chain of ResourceHandlers, and is the ResourceController for its handler. |
31 class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, | 31 class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, |
32 public SSLErrorHandler::Delegate, | 32 public SSLErrorHandler::Delegate, |
33 public ResourceController { | 33 public ResourceController { |
34 public: | 34 public: |
35 ResourceLoader(scoped_ptr<net::URLRequest> request, | 35 ResourceLoader(scoped_ptr<net::URLRequest> request, |
36 scoped_ptr<ResourceHandler> handler, | 36 scoped_ptr<ResourceHandler> handler, |
37 ResourceLoaderDelegate* delegate); | 37 ResourceLoaderDelegate* delegate); |
38 virtual ~ResourceLoader(); | 38 ~ResourceLoader() override; |
39 | 39 |
40 void StartRequest(); | 40 void StartRequest(); |
41 void CancelRequest(bool from_renderer); | 41 void CancelRequest(bool from_renderer); |
42 | 42 |
43 void ReportUploadProgress(); | 43 void ReportUploadProgress(); |
44 | 44 |
45 bool is_transferring() const { return is_transferring_; } | 45 bool is_transferring() const { return is_transferring_; } |
46 void MarkAsTransferring(); | 46 void MarkAsTransferring(); |
47 void CompleteTransfer(); | 47 void CompleteTransfer(); |
48 | 48 |
49 net::URLRequest* request() { return request_.get(); } | 49 net::URLRequest* request() { return request_.get(); } |
50 ResourceRequestInfoImpl* GetRequestInfo(); | 50 ResourceRequestInfoImpl* GetRequestInfo(); |
51 | 51 |
52 void ClearLoginDelegate(); | 52 void ClearLoginDelegate(); |
53 | 53 |
54 // IPC message handlers: | 54 // IPC message handlers: |
55 void OnUploadProgressACK(); | 55 void OnUploadProgressACK(); |
56 | 56 |
57 private: | 57 private: |
58 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup); | 58 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup); |
59 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreNull); | 59 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreNull); |
60 | 60 |
61 // net::URLRequest::Delegate implementation: | 61 // net::URLRequest::Delegate implementation: |
62 virtual void OnReceivedRedirect(net::URLRequest* request, | 62 void OnReceivedRedirect(net::URLRequest* request, |
63 const net::RedirectInfo& redirect_info, | 63 const net::RedirectInfo& redirect_info, |
64 bool* defer) override; | 64 bool* defer) override; |
65 virtual void OnAuthRequired(net::URLRequest* request, | 65 void OnAuthRequired(net::URLRequest* request, |
66 net::AuthChallengeInfo* info) override; | 66 net::AuthChallengeInfo* info) override; |
67 virtual void OnCertificateRequested(net::URLRequest* request, | 67 void OnCertificateRequested(net::URLRequest* request, |
68 net::SSLCertRequestInfo* info) override; | 68 net::SSLCertRequestInfo* info) override; |
69 virtual void OnSSLCertificateError(net::URLRequest* request, | 69 void OnSSLCertificateError(net::URLRequest* request, |
70 const net::SSLInfo& info, | 70 const net::SSLInfo& info, |
71 bool fatal) override; | 71 bool fatal) override; |
72 virtual void OnBeforeNetworkStart(net::URLRequest* request, | 72 void OnBeforeNetworkStart(net::URLRequest* request, bool* defer) override; |
73 bool* defer) override; | 73 void OnResponseStarted(net::URLRequest* request) override; |
74 virtual void OnResponseStarted(net::URLRequest* request) override; | 74 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
75 virtual void OnReadCompleted(net::URLRequest* request, | |
76 int bytes_read) override; | |
77 | 75 |
78 // SSLErrorHandler::Delegate implementation: | 76 // SSLErrorHandler::Delegate implementation: |
79 virtual void CancelSSLRequest(int error, | 77 void CancelSSLRequest(int error, const net::SSLInfo* ssl_info) override; |
80 const net::SSLInfo* ssl_info) override; | 78 void ContinueSSLRequest() override; |
81 virtual void ContinueSSLRequest() override; | |
82 | 79 |
83 // ResourceController implementation: | 80 // ResourceController implementation: |
84 virtual void Resume() override; | 81 void Resume() override; |
85 virtual void Cancel() override; | 82 void Cancel() override; |
86 virtual void CancelAndIgnore() override; | 83 void CancelAndIgnore() override; |
87 virtual void CancelWithError(int error_code) override; | 84 void CancelWithError(int error_code) override; |
88 | 85 |
89 void StartRequestInternal(); | 86 void StartRequestInternal(); |
90 void CancelRequestInternal(int error, bool from_renderer); | 87 void CancelRequestInternal(int error, bool from_renderer); |
91 // Stores the SignedCertificateTimestamps held in |sct_list| in the | 88 // Stores the SignedCertificateTimestamps held in |sct_list| in the |
92 // SignedCertificateTimestampStore singleton, associated with |process_id|. | 89 // SignedCertificateTimestampStore singleton, associated with |process_id|. |
93 // On return, |sct_ids| contains the assigned ID and verification status of | 90 // On return, |sct_ids| contains the assigned ID and verification status of |
94 // each SignedCertificateTimestamp. | 91 // each SignedCertificateTimestamp. |
95 void StoreSignedCertificateTimestamps( | 92 void StoreSignedCertificateTimestamps( |
96 const net::SignedCertificateTimestampAndStatusList& sct_list, | 93 const net::SignedCertificateTimestampAndStatusList& sct_list, |
97 int process_id, | 94 int process_id, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 bool is_transferring_; | 146 bool is_transferring_; |
150 | 147 |
151 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; | 148 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; |
152 | 149 |
153 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 150 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
154 }; | 151 }; |
155 | 152 |
156 } // namespace content | 153 } // namespace content |
157 | 154 |
158 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 155 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
OLD | NEW |