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 // 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 17 matching lines...) Expand all Loading... | |
| 28 } // namespace base | 28 } // namespace base |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 class NavigationEntry; | 31 class NavigationEntry; |
| 32 } // namespace content | 32 } // namespace content |
| 33 | 33 |
| 34 namespace net { | 34 namespace net { |
| 35 class SSLInfo; | 35 class SSLInfo; |
| 36 } // namespace net | 36 } // namespace net |
| 37 | 37 |
| 38 enum class PermissionRequestGestureType; | |
|
kcarattini
2016/07/26 06:03:26
Where is this defined?
stefanocs
2016/07/26 06:08:31
It should be in chrome/browser/permissions/permiss
raymes
2016/07/27 01:42:05
same here
stefanocs
2016/07/27 02:58:18
Done.
| |
| 39 | |
| 38 namespace safe_browsing { | 40 namespace safe_browsing { |
| 39 | 41 |
| 40 class SafeBrowsingService; | 42 class SafeBrowsingService; |
| 41 | 43 |
| 42 // Construction needs to happen on the main thread. | 44 // Construction needs to happen on the main thread. |
| 43 class SafeBrowsingUIManager | 45 class SafeBrowsingUIManager |
| 44 : public base::RefCountedThreadSafe<SafeBrowsingUIManager> { | 46 : public base::RefCountedThreadSafe<SafeBrowsingUIManager> { |
| 45 public: | 47 public: |
| 46 // Passed a boolean indicating whether or not it is OK to proceed with | 48 // Passed a boolean indicating whether or not it is OK to proceed with |
| 47 // loading an URL. | 49 // loading an URL. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 // be called on UI thread. | 151 // be called on UI thread. |
| 150 void ReportInvalidCertificateChain(const std::string& serialized_report, | 152 void ReportInvalidCertificateChain(const std::string& serialized_report, |
| 151 const base::Closure& callback); | 153 const base::Closure& callback); |
| 152 | 154 |
| 153 // Report permission action to SafeBrowsing servers. Can only be called on UI | 155 // Report permission action to SafeBrowsing servers. Can only be called on UI |
| 154 // thread. | 156 // thread. |
| 155 void ReportPermissionAction(const GURL& origin, | 157 void ReportPermissionAction(const GURL& origin, |
| 156 content::PermissionType permission, | 158 content::PermissionType permission, |
| 157 PermissionAction action, | 159 PermissionAction action, |
| 158 PermissionSourceUI source_ui, | 160 PermissionSourceUI source_ui, |
| 159 bool user_gesture); | 161 PermissionRequestGestureType gesture_type); |
| 160 | 162 |
| 161 // Add and remove observers. These methods must be invoked on the UI thread. | 163 // Add and remove observers. These methods must be invoked on the UI thread. |
| 162 void AddObserver(Observer* observer); | 164 void AddObserver(Observer* observer); |
| 163 void RemoveObserver(Observer* remove); | 165 void RemoveObserver(Observer* remove); |
| 164 | 166 |
| 165 protected: | 167 protected: |
| 166 virtual ~SafeBrowsingUIManager(); | 168 virtual ~SafeBrowsingUIManager(); |
| 167 | 169 |
| 168 private: | 170 private: |
| 169 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; | 171 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; |
| 170 friend class SafeBrowsingUIManagerTest; | 172 friend class SafeBrowsingUIManagerTest; |
| 171 friend class TestSafeBrowsingUIManager; | 173 friend class TestSafeBrowsingUIManager; |
| 172 | 174 |
| 173 // Call protocol manager on IO thread to report hits of unsafe contents. | 175 // Call protocol manager on IO thread to report hits of unsafe contents. |
| 174 void ReportSafeBrowsingHitOnIOThread( | 176 void ReportSafeBrowsingHitOnIOThread( |
| 175 const safe_browsing::HitReport& hit_report); | 177 const safe_browsing::HitReport& hit_report); |
| 176 | 178 |
| 177 // Sends an invalid certificate chain report over the network. | 179 // Sends an invalid certificate chain report over the network. |
| 178 void ReportInvalidCertificateChainOnIOThread( | 180 void ReportInvalidCertificateChainOnIOThread( |
| 179 const std::string& serialized_report); | 181 const std::string& serialized_report); |
| 180 | 182 |
| 181 // Report permission action to SafeBrowsing servers. | 183 // Report permission action to SafeBrowsing servers. |
| 182 void ReportPermissionActionOnIOThread(const GURL& origin, | 184 void ReportPermissionActionOnIOThread( |
| 183 content::PermissionType permission, | 185 const GURL& origin, |
| 184 PermissionAction action, | 186 content::PermissionType permission, |
| 185 PermissionSourceUI source_ui, | 187 PermissionAction action, |
| 186 bool user_gesture); | 188 PermissionSourceUI source_ui, |
| 189 PermissionRequestGestureType gesture_type); | |
| 187 | 190 |
| 188 // Updates the whitelist state. Called on the UI thread. | 191 // Updates the whitelist state. Called on the UI thread. |
| 189 void AddToWhitelist(const UnsafeResource& resource); | 192 void AddToWhitelist(const UnsafeResource& resource); |
| 190 | 193 |
| 191 // Safebrowsing service. | 194 // Safebrowsing service. |
| 192 scoped_refptr<SafeBrowsingService> sb_service_; | 195 scoped_refptr<SafeBrowsingService> sb_service_; |
| 193 | 196 |
| 194 base::ObserverList<Observer> observer_list_; | 197 base::ObserverList<Observer> observer_list_; |
| 195 | 198 |
| 196 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); | 199 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); |
| 197 }; | 200 }; |
| 198 | 201 |
| 199 } // namespace safe_browsing | 202 } // namespace safe_browsing |
| 200 | 203 |
| 201 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 204 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
| OLD | NEW |