| 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" |
| 11 #include "content/browser/loader/resource_handler.h" | 11 #include "content/browser/loader/resource_handler.h" |
| 12 #include "content/browser/ssl/ssl_client_auth_handler.h" |
| 12 #include "content/browser/ssl/ssl_error_handler.h" | 13 #include "content/browser/ssl/ssl_error_handler.h" |
| 13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/resource_controller.h" | 15 #include "content/public/browser/resource_controller.h" |
| 15 #include "content/public/common/signed_certificate_timestamp_id_and_status.h" | 16 #include "content/public/common/signed_certificate_timestamp_id_and_status.h" |
| 16 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 class X509Certificate; | 20 class X509Certificate; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 class ResourceDispatcherHostLoginDelegate; | 24 class ResourceDispatcherHostLoginDelegate; |
| 24 class ResourceLoaderDelegate; | 25 class ResourceLoaderDelegate; |
| 25 class ResourceRequestInfoImpl; | 26 class ResourceRequestInfoImpl; |
| 26 class SSLClientAuthHandler; | |
| 27 | 27 |
| 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 SSLClientAuthHandler::Delegate, |
| 33 public ResourceController { | 34 public ResourceController { |
| 34 public: | 35 public: |
| 35 ResourceLoader(scoped_ptr<net::URLRequest> request, | 36 ResourceLoader(scoped_ptr<net::URLRequest> request, |
| 36 scoped_ptr<ResourceHandler> handler, | 37 scoped_ptr<ResourceHandler> handler, |
| 37 ResourceLoaderDelegate* delegate); | 38 ResourceLoaderDelegate* delegate); |
| 38 ~ResourceLoader() override; | 39 ~ResourceLoader() override; |
| 39 | 40 |
| 40 void StartRequest(); | 41 void StartRequest(); |
| 41 void CancelRequest(bool from_renderer); | 42 void CancelRequest(bool from_renderer); |
| 42 | 43 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 71 const net::SSLInfo& info, | 72 const net::SSLInfo& info, |
| 72 bool fatal) override; | 73 bool fatal) override; |
| 73 void OnBeforeNetworkStart(net::URLRequest* request, bool* defer) override; | 74 void OnBeforeNetworkStart(net::URLRequest* request, bool* defer) override; |
| 74 void OnResponseStarted(net::URLRequest* request) override; | 75 void OnResponseStarted(net::URLRequest* request) override; |
| 75 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | 76 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
| 76 | 77 |
| 77 // SSLErrorHandler::Delegate implementation: | 78 // SSLErrorHandler::Delegate implementation: |
| 78 void CancelSSLRequest(int error, const net::SSLInfo* ssl_info) override; | 79 void CancelSSLRequest(int error, const net::SSLInfo* ssl_info) override; |
| 79 void ContinueSSLRequest() override; | 80 void ContinueSSLRequest() override; |
| 80 | 81 |
| 82 // SSLClientAuthHandler::Delegate implementation. |
| 83 void ContinueWithCertificate(net::X509Certificate* cert) override; |
| 84 void CancelCertificateSelection() override; |
| 85 |
| 81 // ResourceController implementation: | 86 // ResourceController implementation: |
| 82 void Resume() override; | 87 void Resume() override; |
| 83 void Cancel() override; | 88 void Cancel() override; |
| 84 void CancelAndIgnore() override; | 89 void CancelAndIgnore() override; |
| 85 void CancelWithError(int error_code) override; | 90 void CancelWithError(int error_code) override; |
| 86 | 91 |
| 87 void StartRequestInternal(); | 92 void StartRequestInternal(); |
| 88 void CancelRequestInternal(int error, bool from_renderer); | 93 void CancelRequestInternal(int error, bool from_renderer); |
| 89 // Stores the SignedCertificateTimestamps held in |sct_list| in the | 94 // Stores the SignedCertificateTimestamps held in |sct_list| in the |
| 90 // SignedCertificateTimestampStore singleton, associated with |process_id|. | 95 // SignedCertificateTimestampStore singleton, associated with |process_id|. |
| 91 // On return, |sct_ids| contains the assigned ID and verification status of | 96 // On return, |sct_ids| contains the assigned ID and verification status of |
| 92 // each SignedCertificateTimestamp. | 97 // each SignedCertificateTimestamp. |
| 93 void StoreSignedCertificateTimestamps( | 98 void StoreSignedCertificateTimestamps( |
| 94 const net::SignedCertificateTimestampAndStatusList& sct_list, | 99 const net::SignedCertificateTimestampAndStatusList& sct_list, |
| 95 int process_id, | 100 int process_id, |
| 96 SignedCertificateTimestampIDStatusList* sct_ids); | 101 SignedCertificateTimestampIDStatusList* sct_ids); |
| 97 void CompleteResponseStarted(); | 102 void CompleteResponseStarted(); |
| 98 void StartReading(bool is_continuation); | 103 void StartReading(bool is_continuation); |
| 99 void ResumeReading(); | 104 void ResumeReading(); |
| 100 void ReadMore(int* bytes_read); | 105 void ReadMore(int* bytes_read); |
| 101 // Passes a read result to the handler. | 106 // Passes a read result to the handler. |
| 102 void CompleteRead(int bytes_read); | 107 void CompleteRead(int bytes_read); |
| 103 void ResponseCompleted(); | 108 void ResponseCompleted(); |
| 104 void CallDidFinishLoading(); | 109 void CallDidFinishLoading(); |
| 105 void RecordHistograms(); | 110 void RecordHistograms(); |
| 106 void ContinueWithCertificate(net::X509Certificate* cert); | |
| 107 | 111 |
| 108 bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; } | 112 bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; } |
| 109 | 113 |
| 110 // Used for categorizing loading of prefetches for reporting in histograms. | 114 // Used for categorizing loading of prefetches for reporting in histograms. |
| 111 // NOTE: This enumeration is used in histograms, so please do not add entries | 115 // NOTE: This enumeration is used in histograms, so please do not add entries |
| 112 // in the middle. | 116 // in the middle. |
| 113 enum PrefetchStatus { | 117 enum PrefetchStatus { |
| 114 STATUS_UNDEFINED, | 118 STATUS_UNDEFINED, |
| 115 STATUS_SUCCESS_FROM_CACHE, | 119 STATUS_SUCCESS_FROM_CACHE, |
| 116 STATUS_SUCCESS_FROM_NETWORK, | 120 STATUS_SUCCESS_FROM_NETWORK, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 147 bool is_transferring_; | 151 bool is_transferring_; |
| 148 | 152 |
| 149 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; | 153 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; |
| 150 | 154 |
| 151 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 155 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
| 152 }; | 156 }; |
| 153 | 157 |
| 154 } // namespace content | 158 } // namespace content |
| 155 | 159 |
| 156 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 160 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
| OLD | NEW |