Index: android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h |
diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h |
index bc7088c49088f859e2f8d7a3aa83e38b7e750650..3fab3d3c569d3e71a2c50907c5259dad8570ac04 100644 |
--- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h |
+++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h |
@@ -5,9 +5,13 @@ |
#ifndef ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
#define ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
-#include "content/public/browser/resource_dispatcher_host_delegate.h" |
+#include <map> |
+#include "android_webview/browser/aw_contents_io_thread_client.h" |
#include "base/lazy_instance.h" |
+#include "base/memory/ref_counted.h" |
+#include "content/public/browser/resource_dispatcher_host_delegate.h" |
+#include "content/public/browser/resource_throttle.h" |
namespace content { |
class ResourceDispatcherHostLoginDelegate; |
@@ -15,6 +19,35 @@ class ResourceDispatcherHostLoginDelegate; |
namespace android_webview { |
+// Calls through the IoThreadClient to check the embedders settings to determine |
+// if the request should be cancelled. There may not always be an IoThreadClient |
+// available for the |child_id|, |route_id| pair (in the case of newly created |
+// pop up windows, for example) and in that case the request and the client |
+// callbacks will be deferred the request until a client is ready. |
+class IoThreadClientThrottle |
joth
2012/11/29 21:02:33
I think you can just forward declare this class he
benm (inactive)
2012/11/30 12:54:18
Done.
|
+ : public content::ResourceThrottle { |
+ public: |
+ IoThreadClientThrottle(int child_id, |
+ int route_id, |
+ net::URLRequest* request); |
+ virtual ~IoThreadClientThrottle(); |
+ |
+ // From content::ResourceThrottle |
+ virtual void WillStartRequest(bool* defer) OVERRIDE; |
+ virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; |
+ |
+ bool MaybeDeferRequest(bool* defer); |
+ void OnIoThreadClientReady(int new_child_id, int new_route_id); |
+ bool MaybeBlockRequest(); |
+ bool ShouldBlockRequest(); |
+ scoped_ptr<AwContentsIoThreadClient> GetIoThreadClient(); |
+ |
+private: |
+ int child_id_; |
+ int route_id_; |
+ net::URLRequest* request_; |
+}; |
+ |
class AwResourceDispatcherHostDelegate |
: public content::ResourceDispatcherHostDelegate { |
public: |
@@ -42,12 +75,23 @@ class AwResourceDispatcherHostDelegate |
int child_id, |
int route_id) OVERRIDE; |
+ static void OnIoThreadClientReady(int new_child_id, int new_route_id); |
+ static void AddPendingThrottle(int child_id, |
+ int route_id, |
+ IoThreadClientThrottle* pending_throttle); |
+ |
private: |
friend struct base::DefaultLazyInstanceTraits< |
AwResourceDispatcherHostDelegate>; |
AwResourceDispatcherHostDelegate(); |
virtual ~AwResourceDispatcherHostDelegate(); |
+ typedef std::pair<int, int> ChildRouteIDPair; |
+ typedef std::map<ChildRouteIDPair, IoThreadClientThrottle*> |
+ PendingThrottleMap; |
+ |
+ static PendingThrottleMap* pending_throttles_; |
joth
2012/11/29 21:02:33
no need for this to be static, make it a straight
benm (inactive)
2012/11/30 12:54:18
Done.
|
+ |
DISALLOW_COPY_AND_ASSIGN(AwResourceDispatcherHostDelegate); |
}; |