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 ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_DELEGATE_H
_ | 5 #ifndef ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_DELEGATE_H
_ |
6 #define ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_DELEGATE_H
_ | 6 #define ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_DELEGATE_H
_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace android_webview { | 22 namespace android_webview { |
23 | 23 |
24 class IoThreadClientThrottle; | 24 class IoThreadClientThrottle; |
25 | 25 |
26 class AwResourceDispatcherHostDelegate | 26 class AwResourceDispatcherHostDelegate |
27 : public content::ResourceDispatcherHostDelegate { | 27 : public content::ResourceDispatcherHostDelegate { |
28 public: | 28 public: |
29 static void ResourceDispatcherHostCreated(); | 29 static void ResourceDispatcherHostCreated(); |
30 | 30 |
31 // Overriden methods from ResourceDispatcherHostDelegate. | 31 // Overriden methods from ResourceDispatcherHostDelegate. |
32 virtual void RequestBeginning( | 32 void RequestBeginning( |
33 net::URLRequest* request, | 33 net::URLRequest* request, |
34 content::ResourceContext* resource_context, | 34 content::ResourceContext* resource_context, |
35 content::AppCacheService* appcache_service, | 35 content::AppCacheService* appcache_service, |
36 content::ResourceType resource_type, | 36 content::ResourceType resource_type, |
37 ScopedVector<content::ResourceThrottle>* throttles) override; | 37 ScopedVector<content::ResourceThrottle>* throttles) override; |
38 virtual void DownloadStarting( | 38 void DownloadStarting( |
39 net::URLRequest* request, | 39 net::URLRequest* request, |
40 content::ResourceContext* resource_context, | 40 content::ResourceContext* resource_context, |
41 int child_id, | 41 int child_id, |
42 int route_id, | 42 int route_id, |
43 int request_id, | 43 int request_id, |
44 bool is_content_initiated, | 44 bool is_content_initiated, |
45 bool must_download, | 45 bool must_download, |
46 ScopedVector<content::ResourceThrottle>* throttles) override; | 46 ScopedVector<content::ResourceThrottle>* throttles) override; |
47 virtual content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( | 47 content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( |
48 net::AuthChallengeInfo* auth_info, | 48 net::AuthChallengeInfo* auth_info, |
49 net::URLRequest* request) override; | 49 net::URLRequest* request) override; |
50 virtual bool HandleExternalProtocol(const GURL& url, | 50 bool HandleExternalProtocol(const GURL& url, |
51 int child_id, | 51 int child_id, |
52 int route_id) override; | 52 int route_id) override; |
53 virtual void OnResponseStarted( | 53 void OnResponseStarted(net::URLRequest* request, |
54 net::URLRequest* request, | 54 content::ResourceContext* resource_context, |
55 content::ResourceContext* resource_context, | 55 content::ResourceResponse* response, |
56 content::ResourceResponse* response, | 56 IPC::Sender* sender) override; |
57 IPC::Sender* sender) override; | |
58 | 57 |
59 virtual void OnRequestRedirected( | 58 void OnRequestRedirected(const GURL& redirect_url, |
60 const GURL& redirect_url, | 59 net::URLRequest* request, |
61 net::URLRequest* request, | 60 content::ResourceContext* resource_context, |
62 content::ResourceContext* resource_context, | 61 content::ResourceResponse* response) override; |
63 content::ResourceResponse* response) override; | |
64 | 62 |
65 void RemovePendingThrottleOnIoThread(IoThreadClientThrottle* throttle); | 63 void RemovePendingThrottleOnIoThread(IoThreadClientThrottle* throttle); |
66 | 64 |
67 static void OnIoThreadClientReady(int new_render_process_id, | 65 static void OnIoThreadClientReady(int new_render_process_id, |
68 int new_render_frame_id); | 66 int new_render_frame_id); |
69 static void AddPendingThrottle(int render_process_id, | 67 static void AddPendingThrottle(int render_process_id, |
70 int render_frame_id, | 68 int render_frame_id, |
71 IoThreadClientThrottle* pending_throttle); | 69 IoThreadClientThrottle* pending_throttle); |
72 | 70 |
73 private: | 71 private: |
74 friend struct base::DefaultLazyInstanceTraits< | 72 friend struct base::DefaultLazyInstanceTraits< |
75 AwResourceDispatcherHostDelegate>; | 73 AwResourceDispatcherHostDelegate>; |
76 AwResourceDispatcherHostDelegate(); | 74 AwResourceDispatcherHostDelegate(); |
77 virtual ~AwResourceDispatcherHostDelegate(); | 75 ~AwResourceDispatcherHostDelegate() override; |
78 | 76 |
79 // These methods must be called on IO thread. | 77 // These methods must be called on IO thread. |
80 void OnIoThreadClientReadyInternal(int new_render_process_id, | 78 void OnIoThreadClientReadyInternal(int new_render_process_id, |
81 int new_render_frame_id); | 79 int new_render_frame_id); |
82 void AddPendingThrottleOnIoThread(int render_process_id, | 80 void AddPendingThrottleOnIoThread(int render_process_id, |
83 int render_frame_id, | 81 int render_frame_id, |
84 IoThreadClientThrottle* pending_throttle); | 82 IoThreadClientThrottle* pending_throttle); |
85 void AddExtraHeadersIfNeeded(net::URLRequest* request, | 83 void AddExtraHeadersIfNeeded(net::URLRequest* request, |
86 content::ResourceContext* resource_context); | 84 content::ResourceContext* resource_context); |
87 | 85 |
88 // Pair of render_process_id and render_frame_id. | 86 // Pair of render_process_id and render_frame_id. |
89 typedef std::pair<int, int> FrameRouteIDPair; | 87 typedef std::pair<int, int> FrameRouteIDPair; |
90 typedef std::map<FrameRouteIDPair, IoThreadClientThrottle*> | 88 typedef std::map<FrameRouteIDPair, IoThreadClientThrottle*> |
91 PendingThrottleMap; | 89 PendingThrottleMap; |
92 | 90 |
93 // Only accessed on the IO thread. | 91 // Only accessed on the IO thread. |
94 PendingThrottleMap pending_throttles_; | 92 PendingThrottleMap pending_throttles_; |
95 | 93 |
96 DISALLOW_COPY_AND_ASSIGN(AwResourceDispatcherHostDelegate); | 94 DISALLOW_COPY_AND_ASSIGN(AwResourceDispatcherHostDelegate); |
97 }; | 95 }; |
98 | 96 |
99 } // namespace android_webview | 97 } // namespace android_webview |
100 | 98 |
101 #endif // ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_H_ | 99 #endif // ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_H_ |
OLD | NEW |