| 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 <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Implements ResourceDispatcherHostDelegate. Currently used by the Prerender | 28 // Implements ResourceDispatcherHostDelegate. Currently used by the Prerender |
| 29 // system to abort requests and add to the load flags when a request begins. | 29 // system to abort requests and add to the load flags when a request begins. |
| 30 class ChromeResourceDispatcherHostDelegate | 30 class ChromeResourceDispatcherHostDelegate |
| 31 : public content::ResourceDispatcherHostDelegate { | 31 : public content::ResourceDispatcherHostDelegate { |
| 32 public: | 32 public: |
| 33 // This class does not take ownership of the tracker but merely holds a | 33 // This class does not take ownership of the tracker but merely holds a |
| 34 // reference to it to avoid accessing g_browser_process. | 34 // reference to it to avoid accessing g_browser_process. |
| 35 // |prerender_tracker| must outlive |this|. | 35 // |prerender_tracker| must outlive |this|. |
| 36 explicit ChromeResourceDispatcherHostDelegate( | 36 explicit ChromeResourceDispatcherHostDelegate( |
| 37 prerender::PrerenderTracker* prerender_tracker); | 37 prerender::PrerenderTracker* prerender_tracker); |
| 38 virtual ~ChromeResourceDispatcherHostDelegate(); | 38 ~ChromeResourceDispatcherHostDelegate() override; |
| 39 | 39 |
| 40 // ResourceDispatcherHostDelegate implementation. | 40 // ResourceDispatcherHostDelegate implementation. |
| 41 virtual bool ShouldBeginRequest( | 41 bool ShouldBeginRequest(const std::string& method, |
| 42 const std::string& method, | 42 const GURL& url, |
| 43 const GURL& url, | 43 content::ResourceType resource_type, |
| 44 content::ResourceType resource_type, | 44 content::ResourceContext* resource_context) override; |
| 45 content::ResourceContext* resource_context) override; | 45 void RequestBeginning( |
| 46 virtual void RequestBeginning( | |
| 47 net::URLRequest* request, | 46 net::URLRequest* request, |
| 48 content::ResourceContext* resource_context, | 47 content::ResourceContext* resource_context, |
| 49 content::AppCacheService* appcache_service, | 48 content::AppCacheService* appcache_service, |
| 50 content::ResourceType resource_type, | 49 content::ResourceType resource_type, |
| 51 ScopedVector<content::ResourceThrottle>* throttles) override; | 50 ScopedVector<content::ResourceThrottle>* throttles) override; |
| 52 virtual void DownloadStarting( | 51 void DownloadStarting( |
| 53 net::URLRequest* request, | 52 net::URLRequest* request, |
| 54 content::ResourceContext* resource_context, | 53 content::ResourceContext* resource_context, |
| 55 int child_id, | 54 int child_id, |
| 56 int route_id, | 55 int route_id, |
| 57 int request_id, | 56 int request_id, |
| 58 bool is_content_initiated, | 57 bool is_content_initiated, |
| 59 bool must_download, | 58 bool must_download, |
| 60 ScopedVector<content::ResourceThrottle>* throttles) override; | 59 ScopedVector<content::ResourceThrottle>* throttles) override; |
| 61 virtual content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( | 60 content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( |
| 62 net::AuthChallengeInfo* auth_info, net::URLRequest* request) override; | 61 net::AuthChallengeInfo* auth_info, |
| 63 virtual bool HandleExternalProtocol(const GURL& url, | 62 net::URLRequest* request) override; |
| 64 int child_id, | 63 bool HandleExternalProtocol(const GURL& url, |
| 65 int route_id) override; | 64 int child_id, |
| 66 virtual bool ShouldForceDownloadResource( | 65 int route_id) override; |
| 67 const GURL& url, const std::string& mime_type) override; | 66 bool ShouldForceDownloadResource(const GURL& url, |
| 68 virtual bool ShouldInterceptResourceAsStream( | 67 const std::string& mime_type) override; |
| 69 net::URLRequest* request, | 68 bool ShouldInterceptResourceAsStream(net::URLRequest* request, |
| 70 const std::string& mime_type, | 69 const std::string& mime_type, |
| 71 GURL* origin, | 70 GURL* origin, |
| 72 std::string* payload) override; | 71 std::string* payload) override; |
| 73 virtual void OnStreamCreated( | 72 void OnStreamCreated(net::URLRequest* request, |
| 74 net::URLRequest* request, | 73 scoped_ptr<content::StreamInfo> stream) override; |
| 75 scoped_ptr<content::StreamInfo> stream) override; | 74 void OnResponseStarted(net::URLRequest* request, |
| 76 virtual void OnResponseStarted( | 75 content::ResourceContext* resource_context, |
| 77 net::URLRequest* request, | 76 content::ResourceResponse* response, |
| 78 content::ResourceContext* resource_context, | 77 IPC::Sender* sender) override; |
| 79 content::ResourceResponse* response, | 78 void OnRequestRedirected(const GURL& redirect_url, |
| 80 IPC::Sender* sender) override; | 79 net::URLRequest* request, |
| 81 virtual void OnRequestRedirected( | 80 content::ResourceContext* resource_context, |
| 82 const GURL& redirect_url, | 81 content::ResourceResponse* response) override; |
| 83 net::URLRequest* request, | 82 void RequestComplete(net::URLRequest* url_request) override; |
| 84 content::ResourceContext* resource_context, | |
| 85 content::ResourceResponse* response) override; | |
| 86 virtual void RequestComplete(net::URLRequest* url_request) override; | |
| 87 | 83 |
| 88 // Called on the UI thread. Allows switching out the | 84 // Called on the UI thread. Allows switching out the |
| 89 // ExternalProtocolHandler::Delegate for testing code. | 85 // ExternalProtocolHandler::Delegate for testing code. |
| 90 static void SetExternalProtocolHandlerDelegateForTesting( | 86 static void SetExternalProtocolHandlerDelegateForTesting( |
| 91 ExternalProtocolHandler::Delegate* delegate); | 87 ExternalProtocolHandler::Delegate* delegate); |
| 92 | 88 |
| 93 private: | 89 private: |
| 94 #if defined(ENABLE_EXTENSIONS) | 90 #if defined(ENABLE_EXTENSIONS) |
| 95 struct StreamTargetInfo { | 91 struct StreamTargetInfo { |
| 96 std::string extension_id; | 92 std::string extension_id; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 117 #if defined(ENABLE_EXTENSIONS) | 113 #if defined(ENABLE_EXTENSIONS) |
| 118 scoped_refptr<extensions::UserScriptListener> user_script_listener_; | 114 scoped_refptr<extensions::UserScriptListener> user_script_listener_; |
| 119 std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_; | 115 std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_; |
| 120 #endif | 116 #endif |
| 121 prerender::PrerenderTracker* prerender_tracker_; | 117 prerender::PrerenderTracker* prerender_tracker_; |
| 122 | 118 |
| 123 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); | 119 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); |
| 124 }; | 120 }; |
| 125 | 121 |
| 126 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE
_H_ | 122 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE
_H_ |
| OLD | NEW |