OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const SafeBrowsingService::UnsafeResource& resource); | 59 const SafeBrowsingService::UnsafeResource& resource); |
60 | 60 |
61 // Makes the passed |factory| the factory used to instanciate | 61 // Makes the passed |factory| the factory used to instanciate |
62 // SafeBrowsingBlockingPage objects. Usefull for tests. | 62 // SafeBrowsingBlockingPage objects. Usefull for tests. |
63 static void RegisterFactory(SafeBrowsingBlockingPageFactory* factory) { | 63 static void RegisterFactory(SafeBrowsingBlockingPageFactory* factory) { |
64 factory_ = factory; | 64 factory_ = factory; |
65 } | 65 } |
66 | 66 |
67 // InterstitialPage method: | 67 // InterstitialPage method: |
68 virtual std::string GetHTMLContents(); | 68 virtual std::string GetHTMLContents(); |
| 69 virtual void SetReportingPreference(bool report); |
69 virtual void Proceed(); | 70 virtual void Proceed(); |
70 virtual void DontProceed(); | 71 virtual void DontProceed(); |
71 | 72 |
72 protected: | 73 protected: |
73 friend class SafeBrowsingBlockingPageTest; | 74 friend class SafeBrowsingBlockingPageTest; |
74 | 75 |
75 // InterstitialPage method: | 76 // InterstitialPage method: |
76 virtual void CommandReceived(const std::string& command); | 77 virtual void CommandReceived(const std::string& command); |
77 | 78 |
78 // Don't instanciate this class directly, use ShowBlockingPage instead. | 79 // Don't instanciate this class directly, use ShowBlockingPage instead. |
(...skipping 20 matching lines...) Expand all Loading... |
99 const string16& title, | 100 const string16& title, |
100 const string16& headline, | 101 const string16& headline, |
101 const string16& description1, | 102 const string16& description1, |
102 const string16& description2, | 103 const string16& description2, |
103 const string16& description3); | 104 const string16& description3); |
104 | 105 |
105 // Records a user action for this interstitial, using the form | 106 // Records a user action for this interstitial, using the form |
106 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. | 107 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. |
107 void RecordUserAction(BlockingPageEvent event); | 108 void RecordUserAction(BlockingPageEvent event); |
108 | 109 |
109 // See if we should even show the malware details option. For example, we | 110 // Checks if we should even show the malware details option. For example, we |
110 // don't show it in incognito mode. | 111 // don't show it in incognito mode. |
111 bool CanShowMalwareDetailsOption(); | 112 bool CanShowMalwareDetailsOption(); |
112 | 113 |
113 // Called when the insterstitial is going away. If there is a | 114 // Called when the insterstitial is going away. If there is a |
114 // pending malware details object, we look at the user's | 115 // pending malware details object, we look at the user's |
115 // preferences, and if the option to send malware details is | 116 // preferences, and if the option to send malware details is |
116 // enabled, the report is scheduled to be sent on the |sb_service_|. | 117 // enabled, the report is scheduled to be sent on the |sb_service_|. |
117 void FinishMalwareDetails(); | 118 void FinishMalwareDetails(); |
118 | 119 |
119 // A list of SafeBrowsingService::UnsafeResource for a tab that the user | 120 // A list of SafeBrowsingService::UnsafeResource for a tab that the user |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 public: | 166 public: |
166 virtual ~SafeBrowsingBlockingPageFactory() { } | 167 virtual ~SafeBrowsingBlockingPageFactory() { } |
167 | 168 |
168 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 169 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
169 SafeBrowsingService* service, | 170 SafeBrowsingService* service, |
170 TabContents* tab_contents, | 171 TabContents* tab_contents, |
171 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 172 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
172 }; | 173 }; |
173 | 174 |
174 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 175 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
OLD | NEW |