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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 | 55 |
56 class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate { | 56 class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate { |
57 public: | 57 public: |
58 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; | 58 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; |
59 typedef std::vector<UnsafeResource> UnsafeResourceList; | 59 typedef std::vector<UnsafeResource> UnsafeResourceList; |
60 typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap; | 60 typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap; |
61 | 61 |
62 virtual ~SafeBrowsingBlockingPage(); | 62 virtual ~SafeBrowsingBlockingPage(); |
63 | 63 |
| 64 // Creates a blocking page. Use ShowBlockingPage if you don't need to access |
| 65 // the blocking page directly. |
| 66 static SafeBrowsingBlockingPage* CreateBlockingPage( |
| 67 SafeBrowsingUIManager* ui_manager, |
| 68 content::WebContents* web_contents, |
| 69 const UnsafeResource& unsafe_resource); |
| 70 |
64 // Shows a blocking page warning the user about phishing/malware for a | 71 // Shows a blocking page warning the user about phishing/malware for a |
65 // specific resource. | 72 // specific resource. |
66 // You can call this method several times, if an interstitial is already | 73 // You can call this method several times, if an interstitial is already |
67 // showing, the new one will be queued and displayed if the user decides | 74 // showing, the new one will be queued and displayed if the user decides |
68 // to proceed on the currently showing interstitial. | 75 // to proceed on the currently showing interstitial. |
69 static void ShowBlockingPage( | 76 static void ShowBlockingPage( |
70 SafeBrowsingUIManager* ui_manager, const UnsafeResource& resource); | 77 SafeBrowsingUIManager* ui_manager, const UnsafeResource& resource); |
71 | 78 |
72 // Makes the passed |factory| the factory used to instanciate | 79 // Makes the passed |factory| the factory used to instanciate |
73 // SafeBrowsingBlockingPage objects. Useful for tests. | 80 // SafeBrowsingBlockingPage objects. Useful for tests. |
(...skipping 234 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 |