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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // non-empty, the request will be sent as a POST instead of a GET. | 123 // non-empty, the request will be sent as a POST instead of a GET. |
124 virtual void ReportSafeBrowsingHit(const GURL& malicious_url, | 124 virtual void ReportSafeBrowsingHit(const GURL& malicious_url, |
125 const GURL& page_url, | 125 const GURL& page_url, |
126 const GURL& referrer_url, | 126 const GURL& referrer_url, |
127 bool is_subresource, | 127 bool is_subresource, |
128 SBThreatType threat_type, | 128 SBThreatType threat_type, |
129 const std::string& post_data); | 129 const std::string& post_data); |
130 | 130 |
131 // Report an invalid TLS/SSL certificate chain to the server. Can only | 131 // Report an invalid TLS/SSL certificate chain to the server. Can only |
132 // be called on UI thread. | 132 // be called on UI thread. |
133 void ReportInvalidCertificateChain(const std::string& hostname, | 133 void ReportInvalidCertificateChain(const std::string& serialized_report, |
134 const net::SSLInfo& ssl_info, | |
135 const base::Closure& callback); | 134 const base::Closure& callback); |
136 | 135 |
137 // Add and remove observers. These methods must be invoked on the UI thread. | 136 // Add and remove observers. These methods must be invoked on the UI thread. |
138 void AddObserver(Observer* observer); | 137 void AddObserver(Observer* observer); |
139 void RemoveObserver(Observer* remove); | 138 void RemoveObserver(Observer* remove); |
140 | 139 |
141 protected: | 140 protected: |
142 virtual ~SafeBrowsingUIManager(); | 141 virtual ~SafeBrowsingUIManager(); |
143 | 142 |
144 private: | 143 private: |
145 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; | 144 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; |
146 | 145 |
147 // Used for whitelisting a render view when the user ignores our warning. | 146 // Used for whitelisting a render view when the user ignores our warning. |
148 struct WhiteListedEntry; | 147 struct WhiteListedEntry; |
149 | 148 |
150 // Call protocol manager on IO thread to report hits of unsafe contents. | 149 // Call protocol manager on IO thread to report hits of unsafe contents. |
151 void ReportSafeBrowsingHitOnIOThread(const GURL& malicious_url, | 150 void ReportSafeBrowsingHitOnIOThread(const GURL& malicious_url, |
152 const GURL& page_url, | 151 const GURL& page_url, |
153 const GURL& referrer_url, | 152 const GURL& referrer_url, |
154 bool is_subresource, | 153 bool is_subresource, |
155 SBThreatType threat_type, | 154 SBThreatType threat_type, |
156 const std::string& post_data); | 155 const std::string& post_data); |
157 | 156 |
158 // Sends an invalid certificate chain report over the network. | 157 // Sends an invalid certificate chain report over the network. |
159 void ReportInvalidCertificateChainOnIOThread(const std::string& hostname, | 158 void ReportInvalidCertificateChainOnIOThread( |
160 const net::SSLInfo& ssl_info); | 159 const std::string& serialized_report); |
161 | 160 |
162 // Adds the given entry to the whitelist. Called on the UI thread. | 161 // Adds the given entry to the whitelist. Called on the UI thread. |
163 void UpdateWhitelist(const UnsafeResource& resource); | 162 void UpdateWhitelist(const UnsafeResource& resource); |
164 | 163 |
165 // Safebrowsing service. | 164 // Safebrowsing service. |
166 scoped_refptr<SafeBrowsingService> sb_service_; | 165 scoped_refptr<SafeBrowsingService> sb_service_; |
167 | 166 |
168 // Only access this whitelist from the UI thread. | 167 // Only access this whitelist from the UI thread. |
169 std::vector<WhiteListedEntry> white_listed_entries_; | 168 std::vector<WhiteListedEntry> white_listed_entries_; |
170 | 169 |
171 ObserverList<Observer> observer_list_; | 170 ObserverList<Observer> observer_list_; |
172 | 171 |
173 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); | 172 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); |
174 }; | 173 }; |
175 | 174 |
176 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 175 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
OLD | NEW |