1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef XWALK_RUNTIME_BROWSER_RUNTIME_RESOURCE_DISPATCHER_HOST_DELEGATE_ANDROID_H_
6 #define XWALK_RUNTIME_BROWSER_RUNTIME_RESOURCE_DISPATCHER_HOST_DELEGATE_ANDROID_H_
11 #include "content/public/browser/content_browser_client.h"
12 #include "xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate.h"
15 class ResourceDispatcherHostLoginDelegate;
16 struct ResourceResponse;
17 } // namespace content
25 class IoThreadClientThrottle;
27 class RuntimeResourceDispatcherHostDelegateAndroid
28 : public RuntimeResourceDispatcherHostDelegate {
30 RuntimeResourceDispatcherHostDelegateAndroid();
31 virtual ~RuntimeResourceDispatcherHostDelegateAndroid();
33 virtual void RequestBeginning(
34 net::URLRequest* request,
35 content::ResourceContext* resource_context,
36 content::AppCacheService* appcache_service,
37 content::ResourceType resource_type,
38 ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE;
39 virtual void DownloadStarting(
40 net::URLRequest* request,
41 content::ResourceContext* resource_context,
45 bool is_content_initiated,
47 ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE;
48 virtual content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
49 net::AuthChallengeInfo* auth_info,
50 net::URLRequest* request) OVERRIDE;
51 virtual bool HandleExternalProtocol(
54 int route_id) OVERRIDE;
55 virtual void OnResponseStarted(
56 net::URLRequest* request,
57 content::ResourceContext* resource_context,
58 content::ResourceResponse* response,
59 IPC::Sender* sender) OVERRIDE;
61 void RemovePendingThrottleOnIoThread(IoThreadClientThrottle* throttle);
63 static void OnIoThreadClientReady(int new_render_process_id,
64 int new_render_frame_id);
65 static void AddPendingThrottle(int render_process_id,
67 IoThreadClientThrottle* pending_throttle);
69 // These methods must be called on IO thread.
70 void OnIoThreadClientReadyInternal(int new_render_process_id,
71 int new_render_frame_id);
72 void AddPendingThrottleOnIoThread(int render_process_id,
74 IoThreadClientThrottle* pending_throttle);
76 typedef std::pair<int, int> FrameRouteIDPair;
77 typedef std::map<FrameRouteIDPair, IoThreadClientThrottle*>
80 // Only accessed on the IO thread.
81 PendingThrottleMap pending_throttles_;
83 DISALLOW_COPY_AND_ASSIGN(RuntimeResourceDispatcherHostDelegateAndroid);
88 #endif // XWALK_RUNTIME_BROWSER_RUNTIME_RESOURCE_DISPATCHER_HOST_DELEGATE_ANDROID_H_