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( |
73 content::ResourceContext* resource_context, | 74 net::URLRequest* request, |
74 const GURL& url, | |
75 const std::string& mime_type, | 75 const std::string& mime_type, |
76 GURL* origin, | 76 GURL* origin, |
77 std::string* target_id) OVERRIDE; | 77 std::string* payload) OVERRIDE; |
78 virtual void OnStreamCreated( | 78 virtual void OnStreamCreated( |
79 content::ResourceContext* resource_context, | 79 net::URLRequest* request, |
80 int render_process_id, | 80 scoped_ptr<content::StreamHandle> stream) OVERRIDE; |
81 int render_view_id, | |
82 const std::string& target_id, | |
83 scoped_ptr<content::StreamHandle> stream, | |
84 int64 expected_content_size) OVERRIDE; | |
85 virtual void OnResponseStarted( | 81 virtual void OnResponseStarted( |
86 net::URLRequest* request, | 82 net::URLRequest* request, |
87 content::ResourceContext* resource_context, | 83 content::ResourceContext* resource_context, |
88 content::ResourceResponse* response, | 84 content::ResourceResponse* response, |
89 IPC::Sender* sender) OVERRIDE; | 85 IPC::Sender* sender) OVERRIDE; |
90 virtual void OnRequestRedirected( | 86 virtual void OnRequestRedirected( |
91 const GURL& redirect_url, | 87 const GURL& redirect_url, |
92 net::URLRequest* request, | 88 net::URLRequest* request, |
93 content::ResourceContext* resource_context, | 89 content::ResourceContext* resource_context, |
94 content::ResourceResponse* response) OVERRIDE; | 90 content::ResourceResponse* response) OVERRIDE; |
95 virtual void RequestComplete(net::URLRequest* url_request) OVERRIDE; | 91 virtual void RequestComplete(net::URLRequest* url_request) OVERRIDE; |
96 | 92 |
97 // Called on the UI thread. Allows switching out the | 93 // Called on the UI thread. Allows switching out the |
98 // ExternalProtocolHandler::Delegate for testing code. | 94 // ExternalProtocolHandler::Delegate for testing code. |
99 static void SetExternalProtocolHandlerDelegateForTesting( | 95 static void SetExternalProtocolHandlerDelegateForTesting( |
100 ExternalProtocolHandler::Delegate* delegate); | 96 ExternalProtocolHandler::Delegate* delegate); |
101 | 97 |
102 private: | 98 private: |
| 99 struct StreamTargetInfo { |
| 100 std::string extension_id; |
| 101 std::string view_id; |
| 102 }; |
| 103 |
103 void AppendStandardResourceThrottles( | 104 void AppendStandardResourceThrottles( |
104 net::URLRequest* request, | 105 net::URLRequest* request, |
105 content::ResourceContext* resource_context, | 106 content::ResourceContext* resource_context, |
106 ResourceType::Type resource_type, | 107 ResourceType::Type resource_type, |
107 ScopedVector<content::ResourceThrottle>* throttles); | 108 ScopedVector<content::ResourceThrottle>* throttles); |
108 | 109 |
109 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 110 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
110 // Append headers required to tell Gaia whether the sync interstitial | 111 // 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. | 112 // should be shown or not. This header is only added for valid Gaia URLs. |
112 void AppendChromeSyncGaiaHeader( | 113 void AppendChromeSyncGaiaHeader( |
113 net::URLRequest* request, | 114 net::URLRequest* request, |
114 content::ResourceContext* resource_context); | 115 content::ResourceContext* resource_context); |
115 #endif | 116 #endif |
116 | 117 |
117 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; | 118 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; |
118 scoped_refptr<SafeBrowsingService> safe_browsing_; | 119 scoped_refptr<SafeBrowsingService> safe_browsing_; |
119 scoped_refptr<extensions::UserScriptListener> user_script_listener_; | 120 scoped_refptr<extensions::UserScriptListener> user_script_listener_; |
120 prerender::PrerenderTracker* prerender_tracker_; | 121 prerender::PrerenderTracker* prerender_tracker_; |
| 122 std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_; |
121 | 123 |
122 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); | 124 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); |
123 }; | 125 }; |
124 | 126 |
125 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE
_H_ | 127 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE
_H_ |
OLD | NEW |