| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER
_DRIVER_FACTORY_H_ | 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER
_DRIVER_FACTORY_H_ |
| 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER
_DRIVER_FACTORY_H_ | 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER
_DRIVER_FACTORY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
| 16 #include "components/safe_browsing_db/util.h" |
| 16 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class WebContents; | 21 class WebContents; |
| 21 class RenderFrameHost; | 22 class RenderFrameHost; |
| 22 } // namespace content | 23 } // namespace content |
| 23 | 24 |
| 24 namespace safe_browsing { | |
| 25 enum class ThreatPatternType; | |
| 26 } | |
| 27 | |
| 28 namespace subresource_filter { | 25 namespace subresource_filter { |
| 29 | 26 |
| 30 using HostSet = std::set<std::string>; | 27 using HostSet = std::set<std::string>; |
| 31 | 28 |
| 32 class ContentSubresourceFilterDriver; | 29 class ContentSubresourceFilterDriver; |
| 33 class SubresourceFilterClient; | 30 class SubresourceFilterClient; |
| 34 enum class ActivationState; | 31 enum class ActivationState; |
| 35 | 32 |
| 36 // Controls the activation of subresource filtering for each page load in a | 33 // Controls the activation of subresource filtering for each page load in a |
| 37 // WebContents and manufactures the per-frame ContentSubresourceFilterDrivers. | 34 // WebContents and manufactures the per-frame ContentSubresourceFilterDrivers. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // filtering for the lifetime of this WebContents. | 68 // filtering for the lifetime of this WebContents. |
| 72 void AddHostOfURLToWhitelistSet(const GURL& url); | 69 void AddHostOfURLToWhitelistSet(const GURL& url); |
| 73 | 70 |
| 74 // Called when Safe Browsing detects that the |url| corresponding to the load | 71 // Called when Safe Browsing detects that the |url| corresponding to the load |
| 75 // of the main frame belongs to the blacklist with |threat_type|. If the | 72 // of the main frame belongs to the blacklist with |threat_type|. If the |
| 76 // blacklist is the Safe Browsing Social Engineering ads landing, then |url| | 73 // blacklist is the Safe Browsing Social Engineering ads landing, then |url| |
| 77 // and |redirects| are saved. | 74 // and |redirects| are saved. |
| 78 void OnMainResourceMatchedSafeBrowsingBlacklist( | 75 void OnMainResourceMatchedSafeBrowsingBlacklist( |
| 79 const GURL& url, | 76 const GURL& url, |
| 80 const std::vector<GURL>& redirect_urls, | 77 const std::vector<GURL>& redirect_urls, |
| 81 safe_browsing::ThreatPatternType threat_type); | 78 safe_browsing::SBThreatType threat_type, |
| 79 safe_browsing::ThreatPatternType threat_type_metadata); |
| 82 | 80 |
| 83 // Reloads the page and inserts the url to the whitelist. | 81 // Reloads the page and inserts the url to the whitelist. |
| 84 void OnReloadRequested(); | 82 void OnReloadRequested(); |
| 85 | 83 |
| 86 // Checks if all preconditions are fulfilled and if so, activates filtering | 84 // Checks if all preconditions are fulfilled and if so, activates filtering |
| 87 // for the given |render_frame_host|. |url| is used to check web site specific | 85 // for the given |render_frame_host|. |url| is used to check web site specific |
| 88 // preconditions and should be the web URL of the page where caller is | 86 // preconditions and should be the web URL of the page where caller is |
| 89 // intended to activate the Safe Browsing Subresource Filter. | 87 // intended to activate the Safe Browsing Subresource Filter. |
| 90 // TODO(melandory) While due to crbug.com/621856 we cannot yet get rid of | 88 // TODO(melandory) While due to crbug.com/621856 we cannot yet get rid of |
| 91 // SubresourceFilterNavigationThrottle, it would still make sense to change | 89 // SubresourceFilterNavigationThrottle, it would still make sense to change |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 HostSet whitelisted_hosts_; | 144 HostSet whitelisted_hosts_; |
| 147 | 145 |
| 148 ActivationState activation_state_; | 146 ActivationState activation_state_; |
| 149 | 147 |
| 150 DISALLOW_COPY_AND_ASSIGN(ContentSubresourceFilterDriverFactory); | 148 DISALLOW_COPY_AND_ASSIGN(ContentSubresourceFilterDriverFactory); |
| 151 }; | 149 }; |
| 152 | 150 |
| 153 } // namespace subresource_filter | 151 } // namespace subresource_filter |
| 154 | 152 |
| 155 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FIL
TER_DRIVER_FACTORY_H_ | 153 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FIL
TER_DRIVER_FACTORY_H_ |
| OLD | NEW |