| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 namespace base { | 46 namespace base { |
| 47 class DictionaryValue; | 47 class DictionaryValue; |
| 48 class MessageLoop; | 48 class MessageLoop; |
| 49 } | 49 } |
| 50 | 50 |
| 51 namespace content { | 51 namespace content { |
| 52 class InterstitialPage; | 52 class InterstitialPage; |
| 53 class WebContents; | 53 class WebContents; |
| 54 } | 54 } |
| 55 | 55 |
| 56 namespace extensions { |
| 57 class SamplingEvent; |
| 58 } |
| 59 |
| 56 class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate { | 60 class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate { |
| 57 public: | 61 public: |
| 58 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; | 62 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; |
| 59 typedef std::vector<UnsafeResource> UnsafeResourceList; | 63 typedef std::vector<UnsafeResource> UnsafeResourceList; |
| 60 typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap; | 64 typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap; |
| 61 | 65 |
| 62 virtual ~SafeBrowsingBlockingPage(); | 66 virtual ~SafeBrowsingBlockingPage(); |
| 63 | 67 |
| 64 // Shows a blocking page warning the user about phishing/malware for a | 68 // Shows a blocking page warning the user about phishing/malware for a |
| 65 // specific resource. | 69 // specific resource. |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 218 |
| 215 // The factory used to instanciate SafeBrowsingBlockingPage objects. | 219 // The factory used to instanciate SafeBrowsingBlockingPage objects. |
| 216 // Usefull for tests, so they can provide their own implementation of | 220 // Usefull for tests, so they can provide their own implementation of |
| 217 // SafeBrowsingBlockingPage. | 221 // SafeBrowsingBlockingPage. |
| 218 static SafeBrowsingBlockingPageFactory* factory_; | 222 static SafeBrowsingBlockingPageFactory* factory_; |
| 219 | 223 |
| 220 // How many times is this same URL in history? Used for histogramming. | 224 // How many times is this same URL in history? Used for histogramming. |
| 221 int num_visits_; | 225 int num_visits_; |
| 222 base::CancelableTaskTracker request_tracker_; | 226 base::CancelableTaskTracker request_tracker_; |
| 223 | 227 |
| 228 private: |
| 229 scoped_ptr<extensions::SamplingEvent> sampling_event_; |
| 230 |
| 224 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage); | 231 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage); |
| 225 }; | 232 }; |
| 226 | 233 |
| 227 class SafeBrowsingBlockingPageV1 : public SafeBrowsingBlockingPage { | 234 class SafeBrowsingBlockingPageV1 : public SafeBrowsingBlockingPage { |
| 228 public: | 235 public: |
| 229 // Don't instanciate this class directly, use ShowBlockingPage instead. | 236 // Don't instanciate this class directly, use ShowBlockingPage instead. |
| 230 SafeBrowsingBlockingPageV1(SafeBrowsingUIManager* ui_manager, | 237 SafeBrowsingBlockingPageV1(SafeBrowsingUIManager* ui_manager, |
| 231 content::WebContents* web_contents, | 238 content::WebContents* web_contents, |
| 232 const UnsafeResourceList& unsafe_resources); | 239 const UnsafeResourceList& unsafe_resources); |
| 233 | 240 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 public: | 315 public: |
| 309 virtual ~SafeBrowsingBlockingPageFactory() { } | 316 virtual ~SafeBrowsingBlockingPageFactory() { } |
| 310 | 317 |
| 311 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 318 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
| 312 SafeBrowsingUIManager* ui_manager, | 319 SafeBrowsingUIManager* ui_manager, |
| 313 content::WebContents* web_contents, | 320 content::WebContents* web_contents, |
| 314 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 321 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
| 315 }; | 322 }; |
| 316 | 323 |
| 317 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 324 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
| OLD | NEW |