| 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 | |
| 71 // Shows a blocking page warning the user about phishing/malware for a | 64 // Shows a blocking page warning the user about phishing/malware for a |
| 72 // specific resource. | 65 // specific resource. |
| 73 // You can call this method several times, if an interstitial is already | 66 // You can call this method several times, if an interstitial is already |
| 74 // showing, the new one will be queued and displayed if the user decides | 67 // showing, the new one will be queued and displayed if the user decides |
| 75 // to proceed on the currently showing interstitial. | 68 // to proceed on the currently showing interstitial. |
| 76 static void ShowBlockingPage( | 69 static void ShowBlockingPage( |
| 77 SafeBrowsingUIManager* ui_manager, const UnsafeResource& resource); | 70 SafeBrowsingUIManager* ui_manager, const UnsafeResource& resource); |
| 78 | 71 |
| 79 // Makes the passed |factory| the factory used to instanciate | 72 // Makes the passed |factory| the factory used to instanciate |
| 80 // SafeBrowsingBlockingPage objects. Useful for tests. | 73 // SafeBrowsingBlockingPage objects. Useful for tests. |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 public: | 308 public: |
| 316 virtual ~SafeBrowsingBlockingPageFactory() { } | 309 virtual ~SafeBrowsingBlockingPageFactory() { } |
| 317 | 310 |
| 318 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 311 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
| 319 SafeBrowsingUIManager* ui_manager, | 312 SafeBrowsingUIManager* ui_manager, |
| 320 content::WebContents* web_contents, | 313 content::WebContents* web_contents, |
| 321 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 314 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
| 322 }; | 315 }; |
| 323 | 316 |
| 324 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 317 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
| OLD | NEW |