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