OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 18 matching lines...) Expand all Loading... |
29 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 29 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
30 #pragma once | 30 #pragma once |
31 | 31 |
32 #include <map> | 32 #include <map> |
33 #include <vector> | 33 #include <vector> |
34 | 34 |
35 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 35 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
36 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" | 36 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" |
37 #include "googleurl/src/gurl.h" | 37 #include "googleurl/src/gurl.h" |
38 | 38 |
39 class DictionaryValue; | |
40 class MessageLoop; | 39 class MessageLoop; |
41 class SafeBrowsingBlockingPageFactory; | 40 class SafeBrowsingBlockingPageFactory; |
42 class MalwareDetails; | 41 class MalwareDetails; |
43 class TabContents; | 42 class TabContents; |
44 | 43 |
| 44 namespace base { |
| 45 class DictionaryValue; |
| 46 } |
| 47 |
45 class SafeBrowsingBlockingPage : public ChromeInterstitialPage { | 48 class SafeBrowsingBlockingPage : public ChromeInterstitialPage { |
46 public: | 49 public: |
47 typedef std::vector<SafeBrowsingService::UnsafeResource> UnsafeResourceList; | 50 typedef std::vector<SafeBrowsingService::UnsafeResource> UnsafeResourceList; |
48 typedef std::map<TabContents*, UnsafeResourceList> UnsafeResourceMap; | 51 typedef std::map<TabContents*, UnsafeResourceList> UnsafeResourceMap; |
49 | 52 |
50 virtual ~SafeBrowsingBlockingPage(); | 53 virtual ~SafeBrowsingBlockingPage(); |
51 | 54 |
52 // Shows a blocking page warning the user about phishing/malware for a | 55 // Shows a blocking page warning the user about phishing/malware for a |
53 // specific resource. | 56 // specific resource. |
54 // You can call this method several times, if an interstitial is already | 57 // You can call this method several times, if an interstitial is already |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 92 |
90 private: | 93 private: |
91 enum BlockingPageEvent { | 94 enum BlockingPageEvent { |
92 SHOW, | 95 SHOW, |
93 PROCEED, | 96 PROCEED, |
94 DONT_PROCEED, | 97 DONT_PROCEED, |
95 }; | 98 }; |
96 | 99 |
97 // Fills the passed dictionary with the strings passed to JS Template when | 100 // Fills the passed dictionary with the strings passed to JS Template when |
98 // creating the HTML. | 101 // creating the HTML. |
99 void PopulateMultipleThreatStringDictionary(DictionaryValue* strings); | 102 void PopulateMultipleThreatStringDictionary(base::DictionaryValue* strings); |
100 void PopulateMalwareStringDictionary(DictionaryValue* strings); | 103 void PopulateMalwareStringDictionary(base::DictionaryValue* strings); |
101 void PopulatePhishingStringDictionary(DictionaryValue* strings); | 104 void PopulatePhishingStringDictionary(base::DictionaryValue* strings); |
102 | 105 |
103 // A helper method used by the Populate methods above used to populate common | 106 // A helper method used by the Populate methods above used to populate common |
104 // fields. | 107 // fields. |
105 void PopulateStringDictionary(DictionaryValue* strings, | 108 void PopulateStringDictionary(base::DictionaryValue* strings, |
106 const string16& title, | 109 const string16& title, |
107 const string16& headline, | 110 const string16& headline, |
108 const string16& description1, | 111 const string16& description1, |
109 const string16& description2, | 112 const string16& description2, |
110 const string16& description3); | 113 const string16& description3); |
111 | 114 |
112 // Records a user action for this interstitial, using the form | 115 // Records a user action for this interstitial, using the form |
113 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. | 116 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. |
114 void RecordUserAction(BlockingPageEvent event); | 117 void RecordUserAction(BlockingPageEvent event); |
115 | 118 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 public: | 179 public: |
177 virtual ~SafeBrowsingBlockingPageFactory() { } | 180 virtual ~SafeBrowsingBlockingPageFactory() { } |
178 | 181 |
179 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 182 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
180 SafeBrowsingService* service, | 183 SafeBrowsingService* service, |
181 TabContents* tab_contents, | 184 TabContents* tab_contents, |
182 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 185 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
183 }; | 186 }; |
184 | 187 |
185 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 188 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
OLD | NEW |