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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 int64 malware_details_proceed_delay_ms_; | 118 int64 malware_details_proceed_delay_ms_; |
119 content::InterstitialPage* interstitial_page() const { | 119 content::InterstitialPage* interstitial_page() const { |
120 return interstitial_page_; | 120 return interstitial_page_; |
121 } | 121 } |
122 | 122 |
123 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, | 123 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, |
124 MalwareReportsTransitionDisabled); | 124 MalwareReportsTransitionDisabled); |
125 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, | 125 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, |
126 MalwareReportsToggling); | 126 MalwareReportsToggling); |
127 | 127 |
128 enum BlockingPageEvent { | 128 // These enums are used for histograms. Don't reorder, delete, or insert |
| 129 // elements. New elements should be added before MAX_ACTION only. |
| 130 enum Decision { |
129 SHOW, | 131 SHOW, |
130 PROCEED, | 132 PROCEED, |
131 DONT_PROCEED, | 133 DONT_PROCEED, |
| 134 PROCEEDING_DISABLED, |
| 135 MAX_DECISION |
| 136 }; |
| 137 enum Interaction { |
| 138 TOTAL_VISITS, |
132 SHOW_ADVANCED, | 139 SHOW_ADVANCED, |
| 140 SHOW_PRIVACY_POLICY, |
| 141 SHOW_DIAGNOSTIC, |
| 142 SHOW_LEARN_MORE, |
| 143 MAX_INTERACTION |
133 }; | 144 }; |
134 | 145 |
135 // Records a user action for this interstitial, using the form | 146 // Record a user decision or interaction to the appropriate UMA histogram. |
136 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. | 147 void RecordUserDecision(Decision decision); |
137 void RecordUserAction(BlockingPageEvent event); | 148 void RecordUserInteraction(Interaction interaction); |
138 | 149 |
139 // Used to query the HistoryService to see if the URL is in history. For UMA. | 150 // Used to query the HistoryService to see if the URL is in history. For UMA. |
140 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); | 151 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
141 | 152 |
142 // Checks if we should even show the malware details option. For example, we | 153 // Checks if we should even show the malware details option. For example, we |
143 // don't show it in incognito mode. | 154 // don't show it in incognito mode. |
144 bool CanShowMalwareDetailsOption(); | 155 bool CanShowMalwareDetailsOption(); |
145 | 156 |
146 // Called when the insterstitial is going away. If there is a | 157 // Called when the insterstitial is going away. If there is a |
147 // pending malware details object, we look at the user's | 158 // pending malware details object, we look at the user's |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 public: | 246 public: |
236 virtual ~SafeBrowsingBlockingPageFactory() { } | 247 virtual ~SafeBrowsingBlockingPageFactory() { } |
237 | 248 |
238 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 249 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
239 SafeBrowsingUIManager* ui_manager, | 250 SafeBrowsingUIManager* ui_manager, |
240 content::WebContents* web_contents, | 251 content::WebContents* web_contents, |
241 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 252 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
242 }; | 253 }; |
243 | 254 |
244 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 255 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
OLD | NEW |