Index: content/browser/loader/mime_sniffing_resource_handler.h |
diff --git a/content/browser/loader/mime_sniffing_resource_handler.h b/content/browser/loader/mime_sniffing_resource_handler.h |
index 8465c07979fa4eb4e34a01ab4731c87f387dff07..f36211f699779b3f99abe959d985ac2991534bf7 100644 |
--- a/content/browser/loader/mime_sniffing_resource_handler.h |
+++ b/content/browser/loader/mime_sniffing_resource_handler.h |
@@ -12,7 +12,6 @@ |
#include "base/memory/weak_ptr.h" |
#include "content/browser/loader/layered_resource_handler.h" |
#include "content/common/content_export.h" |
-#include "content/public/browser/resource_controller.h" |
#include "content/public/common/request_context_type.h" |
#include "ppapi/features/features.h" |
@@ -23,6 +22,7 @@ class URLRequest; |
namespace content { |
class InterceptingResourceHandler; |
class PluginService; |
+class ResourceController; |
class ResourceDispatcherHostImpl; |
struct WebPluginInfo; |
@@ -39,8 +39,7 @@ struct WebPluginInfo; |
// Accept header on the request based on its ResourceType, if one isn't already |
// present. |
class CONTENT_EXPORT MimeSniffingResourceHandler |
- : public LayeredResourceHandler, |
- public ResourceController { |
+ : public LayeredResourceHandler { |
public: |
MimeSniffingResourceHandler(std::unique_ptr<ResourceHandler> next_handler, |
ResourceDispatcherHostImpl* host, |
@@ -51,6 +50,8 @@ class CONTENT_EXPORT MimeSniffingResourceHandler |
~MimeSniffingResourceHandler() override; |
private: |
+ class Controller; |
Randy Smith (Not in Mondays)
2016/12/16 21:37:26
Is this needed? A forward decl that isn't referen
mmenke
2016/12/22 16:29:35
It calls private methods, so has to be an inner cl
|
+ |
friend class MimeSniffingResourceHandlerTest; |
enum State { |
// Starting state of the MimeSniffingResourceHandler. In this state, it is |
@@ -80,21 +81,21 @@ class CONTENT_EXPORT MimeSniffingResourceHandler |
}; |
// ResourceHandler implementation: |
- void SetController(ResourceController* controller) override; |
- bool OnWillStart(const GURL&, bool* defer) override; |
- bool OnResponseStarted(ResourceResponse* response, bool* defer) override; |
+ void OnWillStart(const GURL&, |
+ std::unique_ptr<ResourceController> controller) override; |
+ void OnResponseStarted( |
+ ResourceResponse* response, |
+ std::unique_ptr<ResourceController> controller) override; |
bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
int* buf_size, |
int min_size) override; |
- bool OnReadCompleted(int bytes_read, bool* defer) override; |
- void OnResponseCompleted(const net::URLRequestStatus& status, |
- bool* defer) override; |
+ void OnReadCompleted(int bytes_read, |
+ std::unique_ptr<ResourceController> controller) override; |
+ void OnResponseCompleted( |
+ const net::URLRequestStatus& status, |
+ std::unique_ptr<ResourceController> controller) override; |
- // ResourceController implementation: |
- void Resume() override; |
- void Cancel() override; |
- void CancelAndIgnore() override; |
- void CancelWithError(int error_code) override; |
+ void ResumeInternal(); |
// -------------------------------------------------------------------------- |
// The following methods replay the buffered data to the downstream |
@@ -104,16 +105,15 @@ class CONTENT_EXPORT MimeSniffingResourceHandler |
// Used to advance through the states of the state machine. |
void AdvanceState(); |
- bool ProcessState(bool* defer); |
// Intercepts the request as a stream/download if needed. |
- bool MaybeIntercept(bool* defer); |
+ void MaybeIntercept(); |
// Replays OnResponseStarted on the downstream handlers. |
- bool ReplayResponseReceived(bool* defer); |
+ void ReplayResponseReceived(); |
// Replays OnReadCompleted on the downstreams handlers. |
- bool ReplayReadCompleted(bool* defer); |
+ void ReplayReadCompleted(); |
// -------------------------------------------------------------------------- |
@@ -123,18 +123,20 @@ class CONTENT_EXPORT MimeSniffingResourceHandler |
// Checks whether this request should be intercepted as a stream or a |
// download. If this is the case, sets up the new ResourceHandler that will be |
- // used for interception. Returns false if teh request should be cancelled, |
- // true otherwise. |defer| is set to true if the interception check needs to |
- // finish asynchronously. |
- bool MaybeStartInterception(bool* defer); |
+ // used for interception. |
+ // |
+ // Returns true on synchronous success, false if the operation will need to |
+ // complete asynchronously or failure. On failure, also cancels the request. |
+ bool MaybeStartInterception(); |
// Determines whether a plugin will handle the current request. Returns false |
// if there is an error and the request should be cancelled and true |
- // otherwise. |defer| is set to true if plugin data is stale and needs to be |
- // refreshed before the request can be handled (in this case the function |
- // still returns true). If the request is directed to a plugin, |
- // |handled_by_plugin| is set to true. |
- bool CheckForPluginHandler(bool* defer, bool* handled_by_plugin); |
+ // otherwise. If the request is directed to a plugin, |handled_by_plugin| is |
+ // set to true. |
+ // |
+ // Returns true on synchronous success, false if the operation will need to |
+ // complete asynchronously or failure. On failure, also cancels the request. |
+ bool CheckForPluginHandler(bool* handled_by_plugin); |
// Whether this request is allowed to be intercepted as a download or a |
// stream. |