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 CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <set> | 9 #include <set> |
9 | 10 |
10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 13 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
13 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 14 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
14 | 15 |
15 class DelayedResourceQueue; | 16 class DelayedResourceQueue; |
16 class DownloadRequestLimiter; | 17 class DownloadRequestLimiter; |
17 class SafeBrowsingService; | 18 class SafeBrowsingService; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE; | 64 ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE; |
64 virtual content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( | 65 virtual content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( |
65 net::AuthChallengeInfo* auth_info, net::URLRequest* request) OVERRIDE; | 66 net::AuthChallengeInfo* auth_info, net::URLRequest* request) OVERRIDE; |
66 virtual bool HandleExternalProtocol(const GURL& url, | 67 virtual bool HandleExternalProtocol(const GURL& url, |
67 int child_id, | 68 int child_id, |
68 int route_id, | 69 int route_id, |
69 bool initiated_by_user_gesture) OVERRIDE; | 70 bool initiated_by_user_gesture) OVERRIDE; |
70 virtual bool ShouldForceDownloadResource( | 71 virtual bool ShouldForceDownloadResource( |
71 const GURL& url, const std::string& mime_type) OVERRIDE; | 72 const GURL& url, const std::string& mime_type) OVERRIDE; |
72 virtual bool ShouldInterceptResourceAsStream( | 73 virtual bool ShouldInterceptResourceAsStream( |
| 74 net::URLRequest* request, |
73 content::ResourceContext* resource_context, | 75 content::ResourceContext* resource_context, |
74 const GURL& url, | |
75 const std::string& mime_type, | 76 const std::string& mime_type, |
76 GURL* origin, | 77 GURL* origin, |
77 std::string* target_id) OVERRIDE; | 78 std::string* payload) OVERRIDE; |
78 virtual void OnStreamCreated( | 79 virtual void OnStreamCreated( |
| 80 net::URLRequest* request, |
79 content::ResourceContext* resource_context, | 81 content::ResourceContext* resource_context, |
80 int render_process_id, | 82 int render_process_id, |
81 int render_view_id, | 83 int render_view_id, |
82 const std::string& target_id, | 84 scoped_ptr<content::StreamHandle> stream) OVERRIDE; |
83 scoped_ptr<content::StreamHandle> stream, | |
84 int64 expected_content_size) OVERRIDE; | |
85 virtual void OnResponseStarted( | 85 virtual void OnResponseStarted( |
86 net::URLRequest* request, | 86 net::URLRequest* request, |
87 content::ResourceContext* resource_context, | 87 content::ResourceContext* resource_context, |
88 content::ResourceResponse* response, | 88 content::ResourceResponse* response, |
89 IPC::Sender* sender) OVERRIDE; | 89 IPC::Sender* sender) OVERRIDE; |
90 virtual void OnRequestRedirected( | 90 virtual void OnRequestRedirected( |
91 const GURL& redirect_url, | 91 const GURL& redirect_url, |
92 net::URLRequest* request, | 92 net::URLRequest* request, |
93 content::ResourceContext* resource_context, | 93 content::ResourceContext* resource_context, |
94 content::ResourceResponse* response) OVERRIDE; | 94 content::ResourceResponse* response) OVERRIDE; |
95 virtual void RequestComplete(net::URLRequest* url_request) OVERRIDE; | 95 virtual void RequestComplete(net::URLRequest* url_request) OVERRIDE; |
96 | 96 |
97 // Called on the UI thread. Allows switching out the | 97 // Called on the UI thread. Allows switching out the |
98 // ExternalProtocolHandler::Delegate for testing code. | 98 // ExternalProtocolHandler::Delegate for testing code. |
99 static void SetExternalProtocolHandlerDelegateForTesting( | 99 static void SetExternalProtocolHandlerDelegateForTesting( |
100 ExternalProtocolHandler::Delegate* delegate); | 100 ExternalProtocolHandler::Delegate* delegate); |
101 | 101 |
102 private: | 102 private: |
| 103 struct StreamTargetInfo { |
| 104 std::string extension_id; |
| 105 std::string view_id; |
| 106 }; |
| 107 |
103 void AppendStandardResourceThrottles( | 108 void AppendStandardResourceThrottles( |
104 net::URLRequest* request, | 109 net::URLRequest* request, |
105 content::ResourceContext* resource_context, | 110 content::ResourceContext* resource_context, |
106 ResourceType::Type resource_type, | 111 ResourceType::Type resource_type, |
107 ScopedVector<content::ResourceThrottle>* throttles); | 112 ScopedVector<content::ResourceThrottle>* throttles); |
108 | 113 |
109 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 114 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
110 // Append headers required to tell Gaia whether the sync interstitial | 115 // Append headers required to tell Gaia whether the sync interstitial |
111 // should be shown or not. This header is only added for valid Gaia URLs. | 116 // should be shown or not. This header is only added for valid Gaia URLs. |
112 void AppendChromeSyncGaiaHeader( | 117 void AppendChromeSyncGaiaHeader( |
113 net::URLRequest* request, | 118 net::URLRequest* request, |
114 content::ResourceContext* resource_context); | 119 content::ResourceContext* resource_context); |
115 #endif | 120 #endif |
116 | 121 |
117 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; | 122 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; |
118 scoped_refptr<SafeBrowsingService> safe_browsing_; | 123 scoped_refptr<SafeBrowsingService> safe_browsing_; |
119 scoped_refptr<extensions::UserScriptListener> user_script_listener_; | 124 scoped_refptr<extensions::UserScriptListener> user_script_listener_; |
120 prerender::PrerenderTracker* prerender_tracker_; | 125 prerender::PrerenderTracker* prerender_tracker_; |
| 126 std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_; |
121 | 127 |
122 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); | 128 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); |
123 }; | 129 }; |
124 | 130 |
125 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE
_H_ | 131 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE
_H_ |
OLD | NEW |