Chromium Code Reviews| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 SHOW_ADVANCED, | 132 SHOW_ADVANCED, |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 // Records a user action for this interstitial, using the form | 135 // Records a user action for this interstitial, using the form |
| 136 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. | 136 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. |
| 137 void RecordUserAction(BlockingPageEvent event); | 137 void RecordUserAction(BlockingPageEvent event); |
| 138 | 138 |
| 139 // Used to query the HistoryService to see if the URL is in history. For UMA. | 139 // 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); | 140 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
| 141 | 141 |
| 142 // Records the time it took for the user to react to the | |
| 143 // interstitial. We won't double-count if this method is called | |
| 144 // multiple times. | |
| 145 void RecordUserReactionTime(const std::string& command); | |
| 146 | |
| 147 // Checks if we should even show the malware details option. For example, we | 142 // Checks if we should even show the malware details option. For example, we |
| 148 // don't show it in incognito mode. | 143 // don't show it in incognito mode. |
| 149 bool CanShowMalwareDetailsOption(); | 144 bool CanShowMalwareDetailsOption(); |
| 150 | 145 |
| 151 // Called when the insterstitial is going away. If there is a | 146 // Called when the insterstitial is going away. If there is a |
| 152 // pending malware details object, we look at the user's | 147 // pending malware details object, we look at the user's |
| 153 // preferences, and if the option to send malware details is | 148 // preferences, and if the option to send malware details is |
| 154 // enabled, the report is scheduled to be sent on the |ui_manager_|. | 149 // enabled, the report is scheduled to be sent on the |ui_manager_|. |
| 155 void FinishMalwareDetails(int64 delay_ms); | 150 void FinishMalwareDetails(int64 delay_ms); |
| 156 | 151 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 // blocking page is shown. The object will be sent when the warning | 192 // blocking page is shown. The object will be sent when the warning |
| 198 // is gone (if the user enables the feature). | 193 // is gone (if the user enables the feature). |
| 199 scoped_refptr<MalwareDetails> malware_details_; | 194 scoped_refptr<MalwareDetails> malware_details_; |
| 200 | 195 |
| 201 bool proceeded_; | 196 bool proceeded_; |
| 202 | 197 |
| 203 content::WebContents* web_contents_; | 198 content::WebContents* web_contents_; |
| 204 GURL url_; | 199 GURL url_; |
| 205 content::InterstitialPage* interstitial_page_; // Owns us | 200 content::InterstitialPage* interstitial_page_; // Owns us |
| 206 | 201 |
| 207 // Time when the interstitial was show. This variable is set in | |
| 208 // GetHTMLContents() which is called right before the interstitial | |
| 209 // is shown to the user. Will return is_null() once we reported the | |
| 210 // user action. | |
| 211 base::TimeTicks interstitial_show_time_; | |
| 212 | |
| 213 // Whether the user has expanded the "see more" section of the page already | 202 // Whether the user has expanded the "see more" section of the page already |
| 214 // during this interstitial page. | 203 // during this interstitial page. |
| 215 bool has_expanded_see_more_section_; | 204 bool has_expanded_see_more_section_; |
|
mattm
2014/09/16 07:29:54
Can remove this too?
felt
2014/09/16 14:56:35
Done.
| |
| 216 | 205 |
| 217 // Whether the interstitial should create a view. | 206 // Whether the interstitial should create a view. |
| 218 bool create_view_; | 207 bool create_view_; |
| 219 | 208 |
| 220 // Which type of interstitial this is. | 209 // Which type of interstitial this is. |
| 221 enum { | 210 enum { |
| 222 TYPE_MALWARE, | 211 TYPE_MALWARE, |
| 223 TYPE_PHISHING, | 212 TYPE_PHISHING, |
| 224 TYPE_MALWARE_AND_PHISHING, | 213 TYPE_MALWARE_AND_PHISHING, |
| 225 } interstitial_type_; | 214 } interstitial_type_; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 251 public: | 240 public: |
| 252 virtual ~SafeBrowsingBlockingPageFactory() { } | 241 virtual ~SafeBrowsingBlockingPageFactory() { } |
| 253 | 242 |
| 254 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 243 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
| 255 SafeBrowsingUIManager* ui_manager, | 244 SafeBrowsingUIManager* ui_manager, |
| 256 content::WebContents* web_contents, | 245 content::WebContents* web_contents, |
| 257 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 246 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
| 258 }; | 247 }; |
| 259 | 248 |
| 260 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 249 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
| OLD | NEW |