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 // Classes for managing the SafeBrowsing interstitial pages. | 5 // Classes for managing the SafeBrowsing interstitial pages. |
6 // | 6 // |
7 // When a user is about to visit a page the SafeBrowsing system has deemed to | 7 // When a user is about to visit a page the SafeBrowsing system has deemed to |
8 // be malicious, either as malware or a phishing page, we show an interstitial | 8 // be malicious, either as malware or a phishing page, we show an interstitial |
9 // page with some options (go back, continue) to give the user a chance to avoid | 9 // page with some options (go back, continue) to give the user a chance to avoid |
10 // the harmful page. | 10 // the harmful page. |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 content::WebContents* web_contents_; | 209 content::WebContents* web_contents_; |
210 GURL url_; | 210 GURL url_; |
211 content::InterstitialPage* interstitial_page_; // Owns us | 211 content::InterstitialPage* interstitial_page_; // Owns us |
212 | 212 |
213 // Whether the interstitial should create a view. | 213 // Whether the interstitial should create a view. |
214 bool create_view_; | 214 bool create_view_; |
215 | 215 |
216 // Which type of interstitial this is. | 216 // Which type of interstitial this is. |
217 enum { | 217 enum { |
218 TYPE_MALWARE, | 218 TYPE_MALWARE, |
| 219 TYPE_HARMFUL, |
219 TYPE_PHISHING, | 220 TYPE_PHISHING, |
220 } interstitial_type_; | 221 } interstitial_type_; |
221 | 222 |
222 // The factory used to instantiate SafeBrowsingBlockingPage objects. | 223 // The factory used to instantiate SafeBrowsingBlockingPage objects. |
223 // Usefull for tests, so they can provide their own implementation of | 224 // Usefull for tests, so they can provide their own implementation of |
224 // SafeBrowsingBlockingPage. | 225 // SafeBrowsingBlockingPage. |
225 static SafeBrowsingBlockingPageFactory* factory_; | 226 static SafeBrowsingBlockingPageFactory* factory_; |
226 | 227 |
227 // How many times is this same URL in history? Used for histogramming. | 228 // How many times is this same URL in history? Used for histogramming. |
228 int num_visits_; | 229 int num_visits_; |
229 base::CancelableTaskTracker request_tracker_; | 230 base::CancelableTaskTracker request_tracker_; |
230 | 231 |
231 private: | 232 private: |
232 // Fills the passed dictionary with the values to be passed to the template | 233 // Fills the passed dictionary with the values to be passed to the template |
233 // when creating the HTML. | 234 // when creating the HTML. |
234 void PopulateMalwareLoadTimeData(base::DictionaryValue* load_time_data); | 235 void PopulateMalwareLoadTimeData(base::DictionaryValue* load_time_data); |
| 236 void PopulateHarmfulLoadTimeData(base::DictionaryValue* load_time_data); |
235 void PopulatePhishingLoadTimeData(base::DictionaryValue* load_time_data); | 237 void PopulatePhishingLoadTimeData(base::DictionaryValue* load_time_data); |
236 | 238 |
237 #if defined(ENABLE_EXTENSIONS) | 239 #if defined(ENABLE_EXTENSIONS) |
238 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 240 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
239 #endif | 241 #endif |
240 | 242 |
241 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage); | 243 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage); |
242 }; | 244 }; |
243 | 245 |
244 // Factory for creating SafeBrowsingBlockingPage. Useful for tests. | 246 // Factory for creating SafeBrowsingBlockingPage. Useful for tests. |
245 class SafeBrowsingBlockingPageFactory { | 247 class SafeBrowsingBlockingPageFactory { |
246 public: | 248 public: |
247 virtual ~SafeBrowsingBlockingPageFactory() { } | 249 virtual ~SafeBrowsingBlockingPageFactory() { } |
248 | 250 |
249 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 251 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
250 SafeBrowsingUIManager* ui_manager, | 252 SafeBrowsingUIManager* ui_manager, |
251 content::WebContents* web_contents, | 253 content::WebContents* web_contents, |
252 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 254 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
253 }; | 255 }; |
254 | 256 |
255 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 257 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
OLD | NEW |