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 #if defined(ENABLE_EXTENSIONS) |
| 57 namespace extensions { |
| 58 class ExperienceSamplingEvent; |
| 59 } |
| 60 #endif |
| 61 |
56 class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate { | 62 class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate { |
57 public: | 63 public: |
58 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; | 64 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; |
59 typedef std::vector<UnsafeResource> UnsafeResourceList; | 65 typedef std::vector<UnsafeResource> UnsafeResourceList; |
60 typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap; | 66 typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap; |
61 | 67 |
62 virtual ~SafeBrowsingBlockingPage(); | 68 virtual ~SafeBrowsingBlockingPage(); |
63 | 69 |
64 // Creates a blocking page. Use ShowBlockingPage if you don't need to access | 70 // Creates a blocking page. Use ShowBlockingPage if you don't need to access |
65 // the blocking page directly. | 71 // the blocking page directly. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 232 |
227 // The factory used to instantiate SafeBrowsingBlockingPage objects. | 233 // The factory used to instantiate SafeBrowsingBlockingPage objects. |
228 // Usefull for tests, so they can provide their own implementation of | 234 // Usefull for tests, so they can provide their own implementation of |
229 // SafeBrowsingBlockingPage. | 235 // SafeBrowsingBlockingPage. |
230 static SafeBrowsingBlockingPageFactory* factory_; | 236 static SafeBrowsingBlockingPageFactory* factory_; |
231 | 237 |
232 // How many times is this same URL in history? Used for histogramming. | 238 // How many times is this same URL in history? Used for histogramming. |
233 int num_visits_; | 239 int num_visits_; |
234 base::CancelableTaskTracker request_tracker_; | 240 base::CancelableTaskTracker request_tracker_; |
235 | 241 |
| 242 private: |
| 243 #if defined(ENABLE_EXTENSIONS) |
| 244 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
| 245 #endif |
| 246 |
236 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage); | 247 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage); |
237 }; | 248 }; |
238 | 249 |
239 class SafeBrowsingBlockingPageV1 : public SafeBrowsingBlockingPage { | 250 class SafeBrowsingBlockingPageV1 : public SafeBrowsingBlockingPage { |
240 public: | 251 public: |
241 // Don't instantiate this class directly, use ShowBlockingPage instead. | 252 // Don't instantiate this class directly, use ShowBlockingPage instead. |
242 SafeBrowsingBlockingPageV1(SafeBrowsingUIManager* ui_manager, | 253 SafeBrowsingBlockingPageV1(SafeBrowsingUIManager* ui_manager, |
243 content::WebContents* web_contents, | 254 content::WebContents* web_contents, |
244 const UnsafeResourceList& unsafe_resources); | 255 const UnsafeResourceList& unsafe_resources); |
245 | 256 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 public: | 331 public: |
321 virtual ~SafeBrowsingBlockingPageFactory() { } | 332 virtual ~SafeBrowsingBlockingPageFactory() { } |
322 | 333 |
323 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 334 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
324 SafeBrowsingUIManager* ui_manager, | 335 SafeBrowsingUIManager* ui_manager, |
325 content::WebContents* web_contents, | 336 content::WebContents* web_contents, |
326 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 337 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
327 }; | 338 }; |
328 | 339 |
329 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 340 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
OLD | NEW |