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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // on IO thread. If shutdown is true, the manager is disabled permanently. | 118 // on IO thread. If shutdown is true, the manager is disabled permanently. |
119 void StopOnIOThread(bool shutdown); | 119 void StopOnIOThread(bool shutdown); |
120 | 120 |
121 // Called on the UI thread to display an interstitial page. | 121 // Called on the UI thread to display an interstitial page. |
122 // |url| is the url of the resource that matches a safe browsing list. | 122 // |url| is the url of the resource that matches a safe browsing list. |
123 // If the request contained a chain of redirects, |url| is the last url | 123 // If the request contained a chain of redirects, |url| is the last url |
124 // in the chain, and |original_url| is the first one (the root of the | 124 // in the chain, and |original_url| is the first one (the root of the |
125 // chain). Otherwise, |original_url| = |url|. | 125 // chain). Otherwise, |original_url| = |url|. |
126 virtual void DisplayBlockingPage(const UnsafeResource& resource); | 126 virtual void DisplayBlockingPage(const UnsafeResource& resource); |
127 | 127 |
128 // A wrapper method for IsUrlWhitelistedForWebContents, for convenience. | 128 // A convenience wrapper method for IsUrlWhitelistedOrPendingForWebContents. |
129 bool IsWhitelisted(const UnsafeResource& resource); | 129 bool IsWhitelisted(const UnsafeResource& resource); |
130 | 130 |
131 // Returns true if we already displayed an interstitial for that top-level | 131 // Checks if we already displayed an interstitial for that top-level |
132 // site in a given WebContents. Called on the UI thread. | 132 // site in a given WebContents. If |whitelist_only|, it returns true only if |
133 bool IsUrlWhitelistedForWebContents(const GURL& url, | 133 // the user chose to ignore the interstitial; otherwise it returns true as |
134 bool is_subresource, | 134 // long as the user has seen an interstitial (regardless of response). |
135 content::NavigationEntry* entry, | 135 // Called on the UI thread. |
136 content::WebContents* web_contents); | 136 bool IsUrlWhitelistedOrPendingForWebContents( |
| 137 const GURL& url, |
| 138 bool is_subresource, |
| 139 content::NavigationEntry* entry, |
| 140 content::WebContents* web_contents, |
| 141 bool whitelist_only); |
137 | 142 |
138 // The blocking page on the UI thread has completed. | 143 // The blocking page on the UI thread has completed. |
139 void OnBlockingPageDone(const std::vector<UnsafeResource>& resources, | 144 void OnBlockingPageDone(const std::vector<UnsafeResource>& resources, |
140 bool proceed); | 145 bool proceed); |
141 | 146 |
142 // Log the user perceived delay caused by SafeBrowsing. This delay is the time | 147 // Log the user perceived delay caused by SafeBrowsing. This delay is the time |
143 // delta starting from when we would have started reading data from the | 148 // delta starting from when we would have started reading data from the |
144 // network, and ending when the SafeBrowsing check completes indicating that | 149 // network, and ending when the SafeBrowsing check completes indicating that |
145 // the current page is 'safe'. | 150 // the current page is 'safe'. |
146 void LogPauseDelay(base::TimeDelta time); | 151 void LogPauseDelay(base::TimeDelta time); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 const safe_browsing::HitReport& hit_report); | 187 const safe_browsing::HitReport& hit_report); |
183 | 188 |
184 // Sends an invalid certificate chain report over the network. | 189 // Sends an invalid certificate chain report over the network. |
185 void ReportInvalidCertificateChainOnIOThread( | 190 void ReportInvalidCertificateChainOnIOThread( |
186 const std::string& serialized_report); | 191 const std::string& serialized_report); |
187 | 192 |
188 // Report permission action to SafeBrowsing servers. | 193 // Report permission action to SafeBrowsing servers. |
189 void ReportPermissionActionOnIOThread( | 194 void ReportPermissionActionOnIOThread( |
190 const PermissionReportInfo& report_info); | 195 const PermissionReportInfo& report_info); |
191 | 196 |
192 // Updates the whitelist state. Called on the UI thread. | 197 // Updates the whitelist URL set. Called on the UI thread. |
193 void AddToWhitelist(const UnsafeResource& resource); | 198 void AddToWhitelistUrlSet(const UnsafeResource& resource, bool is_pending); |
194 | 199 |
195 // Safebrowsing service. | 200 // Safebrowsing service. |
196 scoped_refptr<SafeBrowsingService> sb_service_; | 201 scoped_refptr<SafeBrowsingService> sb_service_; |
197 | 202 |
198 base::ObserverList<Observer> observer_list_; | 203 base::ObserverList<Observer> observer_list_; |
199 | 204 |
200 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); | 205 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); |
201 }; | 206 }; |
202 | 207 |
203 } // namespace safe_browsing | 208 } // namespace safe_browsing |
204 | 209 |
205 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 210 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
OLD | NEW |