| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 // Report an invalid TLS/SSL certificate chain to the server. Can only | 148 // Report an invalid TLS/SSL certificate chain to the server. Can only |
| 149 // be called on UI thread. | 149 // be called on UI thread. |
| 150 void ReportInvalidCertificateChain(const std::string& serialized_report, | 150 void ReportInvalidCertificateChain(const std::string& serialized_report, |
| 151 const base::Closure& callback); | 151 const base::Closure& callback); |
| 152 | 152 |
| 153 // Report permission action to SafeBrowsing servers. Can only be called on UI | 153 // Report permission action to SafeBrowsing servers. Can only be called on UI |
| 154 // thread. | 154 // thread. |
| 155 void ReportPermissionAction(const GURL& origin, | 155 void ReportPermissionAction(const GURL& origin, |
| 156 content::PermissionType permission, | 156 content::PermissionType permission, |
| 157 PermissionAction action); | 157 PermissionAction action, |
| 158 SourceUI source_ui); |
| 158 | 159 |
| 159 // Add and remove observers. These methods must be invoked on the UI thread. | 160 // Add and remove observers. These methods must be invoked on the UI thread. |
| 160 void AddObserver(Observer* observer); | 161 void AddObserver(Observer* observer); |
| 161 void RemoveObserver(Observer* remove); | 162 void RemoveObserver(Observer* remove); |
| 162 | 163 |
| 163 protected: | 164 protected: |
| 164 virtual ~SafeBrowsingUIManager(); | 165 virtual ~SafeBrowsingUIManager(); |
| 165 | 166 |
| 166 private: | 167 private: |
| 167 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; | 168 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; |
| 168 friend class SafeBrowsingUIManagerTest; | 169 friend class SafeBrowsingUIManagerTest; |
| 169 friend class TestSafeBrowsingUIManager; | 170 friend class TestSafeBrowsingUIManager; |
| 170 | 171 |
| 171 // Call protocol manager on IO thread to report hits of unsafe contents. | 172 // Call protocol manager on IO thread to report hits of unsafe contents. |
| 172 void ReportSafeBrowsingHitOnIOThread( | 173 void ReportSafeBrowsingHitOnIOThread( |
| 173 const safe_browsing::HitReport& hit_report); | 174 const safe_browsing::HitReport& hit_report); |
| 174 | 175 |
| 175 // Sends an invalid certificate chain report over the network. | 176 // Sends an invalid certificate chain report over the network. |
| 176 void ReportInvalidCertificateChainOnIOThread( | 177 void ReportInvalidCertificateChainOnIOThread( |
| 177 const std::string& serialized_report); | 178 const std::string& serialized_report); |
| 178 | 179 |
| 179 // Report permission action to SafeBrowsing servers. | 180 // Report permission action to SafeBrowsing servers. |
| 180 void ReportPermissionActionOnIOThread(const GURL& origin, | 181 void ReportPermissionActionOnIOThread(const GURL& origin, |
| 181 content::PermissionType permission, | 182 content::PermissionType permission, |
| 182 PermissionAction action); | 183 PermissionAction action, |
| 184 SourceUI source_ui); |
| 183 | 185 |
| 184 // Updates the whitelist state. Called on the UI thread. | 186 // Updates the whitelist state. Called on the UI thread. |
| 185 void AddToWhitelist(const UnsafeResource& resource); | 187 void AddToWhitelist(const UnsafeResource& resource); |
| 186 | 188 |
| 187 // Safebrowsing service. | 189 // Safebrowsing service. |
| 188 scoped_refptr<SafeBrowsingService> sb_service_; | 190 scoped_refptr<SafeBrowsingService> sb_service_; |
| 189 | 191 |
| 190 base::ObserverList<Observer> observer_list_; | 192 base::ObserverList<Observer> observer_list_; |
| 191 | 193 |
| 192 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); | 194 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); |
| 193 }; | 195 }; |
| 194 | 196 |
| 195 } // namespace safe_browsing | 197 } // namespace safe_browsing |
| 196 | 198 |
| 197 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 199 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
| OLD | NEW |