Chromium Code Reviews| 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 <memory> | |
| 9 #include <set> | 10 #include <set> |
| 10 | 11 |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 15 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 15 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 16 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| 16 | 17 |
| 17 class DelayedResourceQueue; | 18 class DelayedResourceQueue; |
| 18 class DownloadRequestLimiter; | 19 class DownloadRequestLimiter; |
| 19 | 20 |
| 20 namespace extensions { | 21 namespace extensions { |
| 21 class UserScriptListener; | 22 class UserScriptListener; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace safe_browsing { | 25 namespace safe_browsing { |
| 25 class SafeBrowsingService; | 26 class SafeBrowsingService; |
| 26 } | 27 } |
| 27 | 28 |
| 29 namespace content { | |
| 30 class NavigationData; | |
| 31 } | |
| 32 | |
| 28 // Implements ResourceDispatcherHostDelegate. Currently used by the Prerender | 33 // Implements ResourceDispatcherHostDelegate. Currently used by the Prerender |
| 29 // system to abort requests and add to the load flags when a request begins. | 34 // system to abort requests and add to the load flags when a request begins. |
| 30 class ChromeResourceDispatcherHostDelegate | 35 class ChromeResourceDispatcherHostDelegate |
| 31 : public content::ResourceDispatcherHostDelegate { | 36 : public content::ResourceDispatcherHostDelegate { |
| 32 public: | 37 public: |
| 33 ChromeResourceDispatcherHostDelegate(); | 38 ChromeResourceDispatcherHostDelegate(); |
| 34 ~ChromeResourceDispatcherHostDelegate() override; | 39 ~ChromeResourceDispatcherHostDelegate() override; |
| 35 | 40 |
| 36 // ResourceDispatcherHostDelegate implementation. | 41 // ResourceDispatcherHostDelegate implementation. |
| 37 bool ShouldBeginRequest(const std::string& method, | 42 bool ShouldBeginRequest(const std::string& method, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 void RequestComplete(net::URLRequest* url_request) override; | 89 void RequestComplete(net::URLRequest* url_request) override; |
| 85 bool ShouldEnableLoFiMode( | 90 bool ShouldEnableLoFiMode( |
| 86 const net::URLRequest& url_request, | 91 const net::URLRequest& url_request, |
| 87 content::ResourceContext* resource_context) override; | 92 content::ResourceContext* resource_context) override; |
| 88 | 93 |
| 89 // Called on the UI thread. Allows switching out the | 94 // Called on the UI thread. Allows switching out the |
| 90 // ExternalProtocolHandler::Delegate for testing code. | 95 // ExternalProtocolHandler::Delegate for testing code. |
| 91 static void SetExternalProtocolHandlerDelegateForTesting( | 96 static void SetExternalProtocolHandlerDelegateForTesting( |
| 92 ExternalProtocolHandler::Delegate* delegate); | 97 ExternalProtocolHandler::Delegate* delegate); |
| 93 | 98 |
| 99 std::unique_ptr<content::NavigationData> GetNavigationData( | |
|
nasko
2016/04/26 20:18:39
Keep the ordering the same as the inherited interf
RyanSturm
2016/04/27 23:27:46
Done.
| |
| 100 net::URLRequest* request) const override; | |
| 101 | |
| 94 private: | 102 private: |
| 95 #if defined(ENABLE_EXTENSIONS) | 103 #if defined(ENABLE_EXTENSIONS) |
| 96 struct StreamTargetInfo { | 104 struct StreamTargetInfo { |
| 97 std::string extension_id; | 105 std::string extension_id; |
| 98 std::string view_id; | 106 std::string view_id; |
| 99 }; | 107 }; |
| 100 #endif | 108 #endif |
| 101 | 109 |
| 102 void AppendStandardResourceThrottles( | 110 void AppendStandardResourceThrottles( |
| 103 net::URLRequest* request, | 111 net::URLRequest* request, |
| 104 content::ResourceContext* resource_context, | 112 content::ResourceContext* resource_context, |
| 105 content::ResourceType resource_type, | 113 content::ResourceType resource_type, |
| 106 ScopedVector<content::ResourceThrottle>* throttles); | 114 ScopedVector<content::ResourceThrottle>* throttles); |
| 107 | 115 |
| 108 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; | 116 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; |
| 109 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_; | 117 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_; |
| 110 #if defined(ENABLE_EXTENSIONS) | 118 #if defined(ENABLE_EXTENSIONS) |
| 111 scoped_refptr<extensions::UserScriptListener> user_script_listener_; | 119 scoped_refptr<extensions::UserScriptListener> user_script_listener_; |
| 112 std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_; | 120 std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_; |
| 113 #endif | 121 #endif |
| 114 | 122 |
| 115 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); | 123 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); |
| 116 }; | 124 }; |
| 117 | 125 |
| 118 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE _H_ | 126 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE _H_ |
| OLD | NEW |