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 <memory> |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 15 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 16 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 16 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| 17 | 17 |
| 18 class DelayedResourceQueue; | 18 class DelayedResourceQueue; |
| 19 class DownloadRequestLimiter; | 19 class DownloadRequestLimiter; |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 class UserScriptListener; | 22 class UserScriptListener; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace safe_browsing { | 25 namespace safe_browsing { |
| 26 class SafeBrowsingService; | 26 class SafeBrowsingService; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace content { | |
| 30 class NavigationData; | |
| 31 } | |
| 32 | |
| 29 // Implements ResourceDispatcherHostDelegate. Currently used by the Prerender | 33 // Implements ResourceDispatcherHostDelegate. Currently used by the Prerender |
| 30 // 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. |
| 31 class ChromeResourceDispatcherHostDelegate | 35 class ChromeResourceDispatcherHostDelegate |
| 32 : public content::ResourceDispatcherHostDelegate { | 36 : public content::ResourceDispatcherHostDelegate { |
| 33 public: | 37 public: |
| 34 ChromeResourceDispatcherHostDelegate(); | 38 ChromeResourceDispatcherHostDelegate(); |
| 35 ~ChromeResourceDispatcherHostDelegate() override; | 39 ~ChromeResourceDispatcherHostDelegate() override; |
| 36 | 40 |
| 37 // ResourceDispatcherHostDelegate implementation. | 41 // ResourceDispatcherHostDelegate implementation. |
| 38 bool ShouldBeginRequest(const std::string& method, | 42 bool ShouldBeginRequest(const std::string& method, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 content::ResourceResponse* response, | 83 content::ResourceResponse* response, |
| 80 IPC::Sender* sender) override; | 84 IPC::Sender* sender) override; |
| 81 void OnRequestRedirected(const GURL& redirect_url, | 85 void OnRequestRedirected(const GURL& redirect_url, |
| 82 net::URLRequest* request, | 86 net::URLRequest* request, |
| 83 content::ResourceContext* resource_context, | 87 content::ResourceContext* resource_context, |
| 84 content::ResourceResponse* response) override; | 88 content::ResourceResponse* response) override; |
| 85 void RequestComplete(net::URLRequest* url_request) override; | 89 void RequestComplete(net::URLRequest* url_request) override; |
| 86 bool ShouldEnableLoFiMode( | 90 bool ShouldEnableLoFiMode( |
| 87 const net::URLRequest& url_request, | 91 const net::URLRequest& url_request, |
| 88 content::ResourceContext* resource_context) override; | 92 content::ResourceContext* resource_context) override; |
| 93 std::unique_ptr<content::NavigationData> GetNavigationData( | |
| 94 net::URLRequest* request) const override; | |
|
bengr
2016/04/29 21:14:21
Forward declare URLRequest.
RyanSturm
2016/05/02 19:52:19
Done.
| |
| 89 | 95 |
| 90 // Called on the UI thread. Allows switching out the | 96 // Called on the UI thread. Allows switching out the |
| 91 // ExternalProtocolHandler::Delegate for testing code. | 97 // ExternalProtocolHandler::Delegate for testing code. |
| 92 static void SetExternalProtocolHandlerDelegateForTesting( | 98 static void SetExternalProtocolHandlerDelegateForTesting( |
| 93 ExternalProtocolHandler::Delegate* delegate); | 99 ExternalProtocolHandler::Delegate* delegate); |
| 94 | 100 |
| 95 private: | 101 private: |
| 96 #if defined(ENABLE_EXTENSIONS) | 102 #if defined(ENABLE_EXTENSIONS) |
| 97 struct StreamTargetInfo { | 103 struct StreamTargetInfo { |
| 98 std::string extension_id; | 104 std::string extension_id; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 110 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_; | 116 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_; |
| 111 #if defined(ENABLE_EXTENSIONS) | 117 #if defined(ENABLE_EXTENSIONS) |
| 112 scoped_refptr<extensions::UserScriptListener> user_script_listener_; | 118 scoped_refptr<extensions::UserScriptListener> user_script_listener_; |
| 113 std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_; | 119 std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_; |
| 114 #endif | 120 #endif |
| 115 | 121 |
| 116 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); | 122 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); |
| 117 }; | 123 }; |
| 118 | 124 |
| 119 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE _H_ | 125 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE _H_ |
| OLD | NEW |