Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Side by Side Diff: content/browser/loader/resource_loader.h

Issue 859213006: Cancel client auth requests when not promptable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client-auth-cancel-1
Patch Set: worker_common.js was missing a license header (also a rebase) Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
9 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
11 #include "content/browser/loader/resource_handler.h" 10 #include "content/browser/loader/resource_handler.h"
11 #include "content/browser/ssl/ssl_client_auth_handler.h"
12 #include "content/browser/ssl/ssl_error_handler.h" 12 #include "content/browser/ssl/ssl_error_handler.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/public/browser/resource_controller.h" 14 #include "content/public/browser/resource_controller.h"
15 #include "content/public/common/signed_certificate_timestamp_id_and_status.h" 15 #include "content/public/common/signed_certificate_timestamp_id_and_status.h"
16 #include "net/url_request/url_request.h" 16 #include "net/url_request/url_request.h"
17 17
18 namespace net { 18 namespace net {
19 class X509Certificate; 19 class X509Certificate;
20 } 20 }
21 21
22 namespace content { 22 namespace content {
23 class ResourceDispatcherHostLoginDelegate; 23 class ResourceDispatcherHostLoginDelegate;
24 class ResourceLoaderDelegate; 24 class ResourceLoaderDelegate;
25 class ResourceRequestInfoImpl; 25 class ResourceRequestInfoImpl;
26 class SSLClientAuthHandler;
27 26
28 // This class is responsible for driving the URLRequest (i.e., calling Start, 27 // 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 28 // Read, and servicing events). It has a ResourceHandler, which is typically a
30 // chain of ResourceHandlers, and is the ResourceController for its handler. 29 // chain of ResourceHandlers, and is the ResourceController for its handler.
31 class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, 30 class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate,
32 public SSLErrorHandler::Delegate, 31 public SSLErrorHandler::Delegate,
32 public SSLClientAuthHandler::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 ~ResourceLoader() override; 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);
59 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreNull);
60 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreAsyncCancel);
61
62 // net::URLRequest::Delegate implementation: 58 // net::URLRequest::Delegate implementation:
63 void OnReceivedRedirect(net::URLRequest* request, 59 void OnReceivedRedirect(net::URLRequest* request,
64 const net::RedirectInfo& redirect_info, 60 const net::RedirectInfo& redirect_info,
65 bool* defer) override; 61 bool* defer) override;
66 void OnAuthRequired(net::URLRequest* request, 62 void OnAuthRequired(net::URLRequest* request,
67 net::AuthChallengeInfo* info) override; 63 net::AuthChallengeInfo* info) override;
68 void OnCertificateRequested(net::URLRequest* request, 64 void OnCertificateRequested(net::URLRequest* request,
69 net::SSLCertRequestInfo* info) override; 65 net::SSLCertRequestInfo* info) override;
70 void OnSSLCertificateError(net::URLRequest* request, 66 void OnSSLCertificateError(net::URLRequest* request,
71 const net::SSLInfo& info, 67 const net::SSLInfo& info,
72 bool fatal) override; 68 bool fatal) override;
73 void OnBeforeNetworkStart(net::URLRequest* request, bool* defer) override; 69 void OnBeforeNetworkStart(net::URLRequest* request, bool* defer) override;
74 void OnResponseStarted(net::URLRequest* request) override; 70 void OnResponseStarted(net::URLRequest* request) override;
75 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; 71 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
76 72
77 // SSLErrorHandler::Delegate implementation: 73 // SSLErrorHandler::Delegate implementation:
78 void CancelSSLRequest(int error, const net::SSLInfo* ssl_info) override; 74 void CancelSSLRequest(int error, const net::SSLInfo* ssl_info) override;
79 void ContinueSSLRequest() override; 75 void ContinueSSLRequest() override;
80 76
77 // SSLClientAuthHandler::Delegate implementation.
78 void ContinueWithCertificate(net::X509Certificate* cert) override;
79 void CancelCertificateSelection() override;
80
81 // ResourceController implementation: 81 // ResourceController implementation:
82 void Resume() override; 82 void Resume() override;
83 void Cancel() override; 83 void Cancel() override;
84 void CancelAndIgnore() override; 84 void CancelAndIgnore() override;
85 void CancelWithError(int error_code) override; 85 void CancelWithError(int error_code) override;
86 86
87 void StartRequestInternal(); 87 void StartRequestInternal();
88 void CancelRequestInternal(int error, bool from_renderer); 88 void CancelRequestInternal(int error, bool from_renderer);
89 // Stores the SignedCertificateTimestamps held in |sct_list| in the 89 // Stores the SignedCertificateTimestamps held in |sct_list| in the
90 // SignedCertificateTimestampStore singleton, associated with |process_id|. 90 // SignedCertificateTimestampStore singleton, associated with |process_id|.
91 // On return, |sct_ids| contains the assigned ID and verification status of 91 // On return, |sct_ids| contains the assigned ID and verification status of
92 // each SignedCertificateTimestamp. 92 // each SignedCertificateTimestamp.
93 void StoreSignedCertificateTimestamps( 93 void StoreSignedCertificateTimestamps(
94 const net::SignedCertificateTimestampAndStatusList& sct_list, 94 const net::SignedCertificateTimestampAndStatusList& sct_list,
95 int process_id, 95 int process_id,
96 SignedCertificateTimestampIDStatusList* sct_ids); 96 SignedCertificateTimestampIDStatusList* sct_ids);
97 void CompleteResponseStarted(); 97 void CompleteResponseStarted();
98 void StartReading(bool is_continuation); 98 void StartReading(bool is_continuation);
99 void ResumeReading(); 99 void ResumeReading();
100 void ReadMore(int* bytes_read); 100 void ReadMore(int* bytes_read);
101 // Passes a read result to the handler. 101 // Passes a read result to the handler.
102 void CompleteRead(int bytes_read); 102 void CompleteRead(int bytes_read);
103 void ResponseCompleted(); 103 void ResponseCompleted();
104 void CallDidFinishLoading(); 104 void CallDidFinishLoading();
105 void RecordHistograms(); 105 void RecordHistograms();
106 void ContinueWithCertificate(net::X509Certificate* cert);
107 106
108 bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; } 107 bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; }
109 108
110 // Used for categorizing loading of prefetches for reporting in histograms. 109 // Used for categorizing loading of prefetches for reporting in histograms.
111 // NOTE: This enumeration is used in histograms, so please do not add entries 110 // NOTE: This enumeration is used in histograms, so please do not add entries
112 // in the middle. 111 // in the middle.
113 enum PrefetchStatus { 112 enum PrefetchStatus {
114 STATUS_UNDEFINED, 113 STATUS_UNDEFINED,
115 STATUS_SUCCESS_FROM_CACHE, 114 STATUS_SUCCESS_FROM_CACHE,
116 STATUS_SUCCESS_FROM_NETWORK, 115 STATUS_SUCCESS_FROM_NETWORK,
(...skipping 30 matching lines...) Expand all
147 bool is_transferring_; 146 bool is_transferring_;
148 147
149 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; 148 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_;
150 149
151 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); 150 DISALLOW_COPY_AND_ASSIGN(ResourceLoader);
152 }; 151 };
153 152
154 } // namespace content 153 } // namespace content
155 154
156 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ 155 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_
OLDNEW
« no previous file with comments | « chromecast/browser/cast_content_browser_client.cc ('k') | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698