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_LOADER_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 5 #ifndef CHROME_BROWSER_LOADER_SAFE_BROWSING_RESOURCE_THROTTLE_H_ |
| 6 #define CHROME_BROWSER_LOADER_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 6 #define CHROME_BROWSER_LOADER_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 #include "net/log/net_log_event_type.h" |
| 22 | 22 |
| 23 class ResourceDispatcherHost; | 23 class ResourceDispatcherHost; |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| 26 class URLRequest; | 26 class URLRequest; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace safe_browsing { | |
| 30 class V4LocalDatabaseManager; | |
| 31 } | |
| 32 | |
| 29 // SafeBrowsingResourceThrottle checks that URLs are "safe" before | 33 // SafeBrowsingResourceThrottle checks that URLs are "safe" before |
| 30 // navigating to them. To be considered "safe", a URL must not appear in the | 34 // navigating to them. To be considered "safe", a URL must not appear in the |
| 31 // malware/phishing blacklists (see SafeBrowsingService for details). | 35 // malware/phishing blacklists (see SafeBrowsingService for details). |
| 32 // | 36 // |
| 33 // On desktop (ifdef SAFE_BROWSING_DB_LOCAL) | 37 // On desktop (ifdef SAFE_BROWSING_DB_LOCAL) |
| 34 // ----------------------------------------- | 38 // ----------------------------------------- |
| 35 // This check is done before requesting the original URL, and additionally | 39 // This check is done before requesting the original URL, and additionally |
| 36 // before following any subsequent redirect. In the common case the check | 40 // before following any subsequent redirect. In the common case the check |
| 37 // completes synchronously (no match in the in-memory DB), so the request's | 41 // completes synchronously (no match in the in-memory DB), so the request's |
| 38 // flow is un-interrupted. However if the URL fails this quick check, it | 42 // flow is un-interrupted. However if the URL fails this quick check, it |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 | 168 |
| 165 // Timer to abort the safe browsing check if it takes too long. | 169 // Timer to abort the safe browsing check if it takes too long. |
| 166 base::OneShotTimer timer_; | 170 base::OneShotTimer timer_; |
| 167 | 171 |
| 168 // The redirect chain for this resource | 172 // The redirect chain for this resource |
| 169 std::vector<GURL> redirect_urls_; | 173 std::vector<GURL> redirect_urls_; |
| 170 | 174 |
| 171 // If in DEFERRED_UNCHECKED_REDIRECT state, this is the | 175 // If in DEFERRED_UNCHECKED_REDIRECT state, this is the |
| 172 // URL we still need to check before resuming. | 176 // URL we still need to check before resuming. |
| 173 GURL unchecked_redirect_url_; | 177 GURL unchecked_redirect_url_; |
| 174 GURL url_being_checked_; | 178 GURL url_being_checked_; |
|
mmenke
2016/09/28 01:55:59
While you're here, should be include url.h.
vakh (use Gerrit instead)
2016/09/28 22:13:35
Done.
| |
| 175 | 179 |
| 176 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_; | 180 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_; |
| 177 scoped_refptr<safe_browsing::SafeBrowsingUIManager> ui_manager_; | 181 scoped_refptr<safe_browsing::SafeBrowsingUIManager> ui_manager_; |
| 178 const net::URLRequest* request_; | 182 const net::URLRequest* request_; |
| 179 const content::ResourceType resource_type_; | 183 const content::ResourceType resource_type_; |
| 180 net::NetLogWithSource net_log_with_source_; | 184 net::NetLogWithSource net_log_with_source_; |
| 185 scoped_refptr<safe_browsing::V4LocalDatabaseManager> | |
| 186 v4_local_database_manager_; | |
| 181 | 187 |
| 182 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottle); | 188 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottle); |
| 183 }; | 189 }; |
| 184 | 190 |
| 185 #endif // CHROME_BROWSER_LOADER_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 191 #endif // CHROME_BROWSER_LOADER_SAFE_BROWSING_RESOURCE_THROTTLE_H_ |
| OLD | NEW |