| 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 // The Safe Browsing service is responsible for downloading anti-phishing and | 5 // The Safe Browsing service is responsible for downloading anti-phishing and |
| 6 // anti-malware tables and checking urls against them. | 6 // anti-malware tables and checking urls against them. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
| 9 #define CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // A convenience wrapper method for IsUrlWhitelistedOrPendingForWebContents. | 128 // A convenience wrapper method for IsUrlWhitelistedOrPendingForWebContents. |
| 129 bool IsWhitelisted(const UnsafeResource& resource); | 129 bool IsWhitelisted(const UnsafeResource& resource); |
| 130 | 130 |
| 131 // Checks if we already displayed or are displaying an interstitial | 131 // Checks if we already displayed or are displaying an interstitial |
| 132 // for the top-level site |url| in a given WebContents. If | 132 // for the top-level site |url| in a given WebContents. If |
| 133 // |whitelist_only|, it returns true only if the user chose to ignore | 133 // |whitelist_only|, it returns true only if the user chose to ignore |
| 134 // the interstitial. Otherwise, it returns true if an interstitial for | 134 // the interstitial. Otherwise, it returns true if an interstitial for |
| 135 // |url| is already displaying *or* if the user has seen an | 135 // |url| is already displaying *or* if the user has seen an |
| 136 // interstitial for |url| before in this WebContents and proceeded | 136 // interstitial for |url| before in this WebContents and proceeded |
| 137 // through it. Called on the UI thread. | 137 // through it. Called on the UI thread. |
| 138 // |
| 139 // If the resource was found in the whitelist or pending for the |
| 140 // whitelist, |threat_type| will be set to the SBThreatType for which |
| 141 // the URL was first whitelisted. |
| 138 bool IsUrlWhitelistedOrPendingForWebContents( | 142 bool IsUrlWhitelistedOrPendingForWebContents( |
| 139 const GURL& url, | 143 const GURL& url, |
| 140 bool is_subresource, | 144 bool is_subresource, |
| 141 content::NavigationEntry* entry, | 145 content::NavigationEntry* entry, |
| 142 content::WebContents* web_contents, | 146 content::WebContents* web_contents, |
| 143 bool whitelist_only); | 147 bool whitelist_only, |
| 148 SBThreatType* threat_type); |
| 144 | 149 |
| 145 // The blocking page for |web_contents| on the UI thread has | 150 // The blocking page for |web_contents| on the UI thread has |
| 146 // completed, with |proceed| set to true if the user has chosen to | 151 // completed, with |proceed| set to true if the user has chosen to |
| 147 // proceed through the blocking page and false | 152 // proceed through the blocking page and false |
| 148 // otherwise. |web_contents| is the WebContents that was displaying | 153 // otherwise. |web_contents| is the WebContents that was displaying |
| 149 // the blocking page. |main_frame_url| is the top-level URL on which | 154 // the blocking page. |main_frame_url| is the top-level URL on which |
| 150 // the blocking page was displayed. If |proceed| is true, | 155 // the blocking page was displayed. If |proceed| is true, |
| 151 // |main_frame_url| is whitelisted so that the user will not see | 156 // |main_frame_url| is whitelisted so that the user will not see |
| 152 // another warning for that URL in this WebContents. | 157 // another warning for that URL in this WebContents. |
| 153 void OnBlockingPageDone(const std::vector<UnsafeResource>& resources, | 158 void OnBlockingPageDone(const std::vector<UnsafeResource>& resources, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 void ReportInvalidCertificateChainOnIOThread( | 212 void ReportInvalidCertificateChainOnIOThread( |
| 208 const std::string& serialized_report); | 213 const std::string& serialized_report); |
| 209 | 214 |
| 210 // Report permission action to SafeBrowsing servers. | 215 // Report permission action to SafeBrowsing servers. |
| 211 void ReportPermissionActionOnIOThread( | 216 void ReportPermissionActionOnIOThread( |
| 212 const PermissionReportInfo& report_info); | 217 const PermissionReportInfo& report_info); |
| 213 | 218 |
| 214 // Updates the whitelist URL set for |web_contents|. Called on the UI thread. | 219 // Updates the whitelist URL set for |web_contents|. Called on the UI thread. |
| 215 void AddToWhitelistUrlSet(const GURL& whitelist_url, | 220 void AddToWhitelistUrlSet(const GURL& whitelist_url, |
| 216 content::WebContents* web_contents, | 221 content::WebContents* web_contents, |
| 217 bool is_pending); | 222 bool is_pending, |
| 223 SBThreatType threat_type); |
| 218 | 224 |
| 219 // Removes |whitelist_url| from the pending whitelist for | 225 // Removes |whitelist_url| from the pending whitelist for |
| 220 // |web_contents|. Called on the UI thread. | 226 // |web_contents|. Called on the UI thread. |
| 221 void RemoveFromPendingWhitelistUrlSet(const GURL& whitelist_url, | 227 void RemoveFromPendingWhitelistUrlSet(const GURL& whitelist_url, |
| 222 content::WebContents* web_contents); | 228 content::WebContents* web_contents); |
| 223 | 229 |
| 224 static GURL GetMainFrameWhitelistUrlForResourceForTesting( | 230 static GURL GetMainFrameWhitelistUrlForResourceForTesting( |
| 225 const safe_browsing::SafeBrowsingUIManager::UnsafeResource& resource); | 231 const safe_browsing::SafeBrowsingUIManager::UnsafeResource& resource); |
| 226 | 232 |
| 227 // Safebrowsing service. | 233 // Safebrowsing service. |
| 228 scoped_refptr<SafeBrowsingService> sb_service_; | 234 scoped_refptr<SafeBrowsingService> sb_service_; |
| 229 | 235 |
| 230 base::ObserverList<Observer> observer_list_; | 236 base::ObserverList<Observer> observer_list_; |
| 231 | 237 |
| 232 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); | 238 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); |
| 233 }; | 239 }; |
| 234 | 240 |
| 235 } // namespace safe_browsing | 241 } // namespace safe_browsing |
| 236 | 242 |
| 237 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 243 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
| OLD | NEW |