| 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_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 15 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 16 #include "chrome/browser/safe_browsing/ui_manager.h" | 16 #include "chrome/browser/safe_browsing/ui_manager.h" |
| 17 #include "components/safe_browsing_db/database_manager.h" | 17 #include "components/safe_browsing_db/database_manager.h" |
| 18 #include "content/public/browser/resource_throttle.h" | 18 #include "content/public/browser/resource_throttle.h" |
| 19 #include "content/public/common/resource_type.h" | 19 #include "content/public/common/resource_type.h" |
| 20 #include "net/log/net_log.h" | 20 #include "net/log/net_log.h" |
| 21 #include "net/log/net_log_event_type.h" |
| 21 | 22 |
| 22 class ResourceDispatcherHost; | 23 class ResourceDispatcherHost; |
| 23 | 24 |
| 24 namespace net { | 25 namespace net { |
| 25 class URLRequest; | 26 class URLRequest; |
| 26 } | 27 } |
| 27 | 28 |
| 28 // SafeBrowsingResourceThrottle checks that URLs are "safe" before | 29 // SafeBrowsingResourceThrottle checks that URLs are "safe" before |
| 29 // navigating to them. To be considered "safe", a URL must not appear in the | 30 // navigating to them. To be considered "safe", a URL must not appear in the |
| 30 // malware/phishing blacklists (see SafeBrowsingService for details). | 31 // malware/phishing blacklists (see SafeBrowsingService for details). |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 137 |
| 137 // Called on the IO thread if the request turned out to be for a prerendered | 138 // Called on the IO thread if the request turned out to be for a prerendered |
| 138 // page. | 139 // page. |
| 139 void Cancel(); | 140 void Cancel(); |
| 140 | 141 |
| 141 // Resumes the request, by continuing the deferred action (either starting the | 142 // Resumes the request, by continuing the deferred action (either starting the |
| 142 // request, or following a redirect). | 143 // request, or following a redirect). |
| 143 void ResumeRequest(); | 144 void ResumeRequest(); |
| 144 | 145 |
| 145 // For marking network events. |name| and |value| can be null. | 146 // For marking network events. |name| and |value| can be null. |
| 146 void BeginNetLogEvent(net::NetLog::EventType type, | 147 void BeginNetLogEvent(net::NetLogEventType type, |
| 147 const GURL& url, | 148 const GURL& url, |
| 148 const char* name, | 149 const char* name, |
| 149 const char* value); | 150 const char* value); |
| 150 void EndNetLogEvent(net::NetLog::EventType type, | 151 void EndNetLogEvent(net::NetLogEventType type, |
| 151 const char* name, | 152 const char* name, |
| 152 const char* value); | 153 const char* value); |
| 153 | 154 |
| 154 State state_; | 155 State state_; |
| 155 DeferState defer_state_; | 156 DeferState defer_state_; |
| 156 | 157 |
| 157 // The result of the most recent safe browsing check. Only valid to read this | 158 // The result of the most recent safe browsing check. Only valid to read this |
| 158 // when state_ != STATE_CHECKING_URL. | 159 // when state_ != STATE_CHECKING_URL. |
| 159 safe_browsing::SBThreatType threat_type_; | 160 safe_browsing::SBThreatType threat_type_; |
| 160 | 161 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 174 | 175 |
| 175 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_; | 176 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_; |
| 176 scoped_refptr<safe_browsing::SafeBrowsingUIManager> ui_manager_; | 177 scoped_refptr<safe_browsing::SafeBrowsingUIManager> ui_manager_; |
| 177 const net::URLRequest* request_; | 178 const net::URLRequest* request_; |
| 178 const content::ResourceType resource_type_; | 179 const content::ResourceType resource_type_; |
| 179 net::BoundNetLog bound_net_log_; | 180 net::BoundNetLog bound_net_log_; |
| 180 | 181 |
| 181 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottle); | 182 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottle); |
| 182 }; | 183 }; |
| 183 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 184 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ |
| OLD | NEW |