| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 136 |
| 136 // Called on the IO thread if the request turned out to be for a prerendered | 137 // Called on the IO thread if the request turned out to be for a prerendered |
| 137 // page. | 138 // page. |
| 138 void Cancel(); | 139 void Cancel(); |
| 139 | 140 |
| 140 // Resumes the request, by continuing the deferred action (either starting the | 141 // Resumes the request, by continuing the deferred action (either starting the |
| 141 // request, or following a redirect). | 142 // request, or following a redirect). |
| 142 void ResumeRequest(); | 143 void ResumeRequest(); |
| 143 | 144 |
| 144 // For marking network events. |name| and |value| can be null. | 145 // For marking network events. |name| and |value| can be null. |
| 145 void BeginNetLogEvent(net::NetLog::EventType type, | 146 void BeginNetLogEvent(net::NetLogEventType type, |
| 146 const GURL& url, | 147 const GURL& url, |
| 147 const char* name, | 148 const char* name, |
| 148 const char* value); | 149 const char* value); |
| 149 void EndNetLogEvent(net::NetLog::EventType type, | 150 void EndNetLogEvent(net::NetLogEventType type, |
| 150 const char* name, | 151 const char* name, |
| 151 const char* value); | 152 const char* value); |
| 152 | 153 |
| 153 State state_; | 154 State state_; |
| 154 DeferState defer_state_; | 155 DeferState defer_state_; |
| 155 | 156 |
| 156 // The result of the most recent safe browsing check. Only valid to read this | 157 // The result of the most recent safe browsing check. Only valid to read this |
| 157 // when state_ != STATE_CHECKING_URL. | 158 // when state_ != STATE_CHECKING_URL. |
| 158 safe_browsing::SBThreatType threat_type_; | 159 safe_browsing::SBThreatType threat_type_; |
| 159 | 160 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 173 | 174 |
| 174 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_; | 175 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_; |
| 175 scoped_refptr<safe_browsing::SafeBrowsingUIManager> ui_manager_; | 176 scoped_refptr<safe_browsing::SafeBrowsingUIManager> ui_manager_; |
| 176 const net::URLRequest* request_; | 177 const net::URLRequest* request_; |
| 177 const content::ResourceType resource_type_; | 178 const content::ResourceType resource_type_; |
| 178 net::BoundNetLog bound_net_log_; | 179 net::BoundNetLog bound_net_log_; |
| 179 | 180 |
| 180 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottle); | 181 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottle); |
| 181 }; | 182 }; |
| 182 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 183 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_H_ |
| OLD | NEW |