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 // Implementation of the SafeBrowsingBlockingPage class. | 5 // Implementation of the SafeBrowsingBlockingPage class. |
6 | 6 |
7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 navigation_entry_index_to_remove_ = -1; | 202 navigation_entry_index_to_remove_ = -1; |
203 } | 203 } |
204 | 204 |
205 // Start computing malware details. They will be sent only | 205 // Start computing malware details. They will be sent only |
206 // if the user opts-in on the blocking page later. | 206 // if the user opts-in on the blocking page later. |
207 // If there's more than one malicious resources, it means the user | 207 // If there's more than one malicious resources, it means the user |
208 // clicked through the first warning, so we don't prepare additional | 208 // clicked through the first warning, so we don't prepare additional |
209 // reports. | 209 // reports. |
210 if (unsafe_resources.size() == 1 && | 210 if (unsafe_resources.size() == 1 && |
211 unsafe_resources[0].threat_type == SafeBrowsingService::URL_MALWARE && | 211 unsafe_resources[0].threat_type == SafeBrowsingService::URL_MALWARE && |
212 malware_details_ == NULL && | 212 malware_details_.get() == NULL && |
213 CanShowMalwareDetailsOption()) { | 213 CanShowMalwareDetailsOption()) { |
214 malware_details_ = MalwareDetails::NewMalwareDetails( | 214 malware_details_ = MalwareDetails::NewMalwareDetails( |
215 sb_service_, web_contents, unsafe_resources[0]); | 215 sb_service_, web_contents, unsafe_resources[0]); |
216 } | 216 } |
217 | 217 |
218 interstitial_page_ = InterstitialPage::Create( | 218 interstitial_page_ = InterstitialPage::Create( |
219 web_contents, IsMainPageLoadBlocked(unsafe_resources), url_, this); | 219 web_contents, IsMainPageLoadBlocked(unsafe_resources), url_, this); |
220 } | 220 } |
221 | 221 |
222 bool SafeBrowsingBlockingPage::CanShowMalwareDetailsOption() { | 222 bool SafeBrowsingBlockingPage::CanShowMalwareDetailsOption() { |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 recorded = false; | 684 recorded = false; |
685 } else { | 685 } else { |
686 recorded = false; | 686 recorded = false; |
687 } | 687 } |
688 } | 688 } |
689 if (recorded) // Making sure we don't double-count reaction times. | 689 if (recorded) // Making sure we don't double-count reaction times. |
690 interstitial_show_time_ = base::TimeTicks(); // Resets the show time. | 690 interstitial_show_time_ = base::TimeTicks(); // Resets the show time. |
691 } | 691 } |
692 | 692 |
693 void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) { | 693 void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) { |
694 if (malware_details_ == NULL) | 694 if (malware_details_.get() == NULL) |
695 return; // Not all interstitials have malware details (eg phishing). | 695 return; // Not all interstitials have malware details (eg phishing). |
696 | 696 |
697 if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled)) { | 697 if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled)) { |
698 // Finish the malware details collection, send it over. | 698 // Finish the malware details collection, send it over. |
699 BrowserThread::PostDelayedTask( | 699 BrowserThread::PostDelayedTask( |
700 BrowserThread::IO, FROM_HERE, | 700 BrowserThread::IO, FROM_HERE, |
701 base::Bind(&MalwareDetails::FinishCollection, malware_details_.get()), | 701 base::Bind(&MalwareDetails::FinishCollection, malware_details_.get()), |
702 base::TimeDelta::FromMilliseconds(delay_ms)); | 702 base::TimeDelta::FromMilliseconds(delay_ms)); |
703 } | 703 } |
704 } | 704 } |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 | 1175 |
1176 strings->SetString("details", ""); | 1176 strings->SetString("details", ""); |
1177 strings->SetString("confirm_text", ""); | 1177 strings->SetString("confirm_text", ""); |
1178 strings->SetString(kBoxChecked, ""); | 1178 strings->SetString(kBoxChecked, ""); |
1179 strings->SetString("report_error", | 1179 strings->SetString("report_error", |
1180 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); | 1180 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); |
1181 strings->SetBoolean(kDisplayCheckBox, false); | 1181 strings->SetBoolean(kDisplayCheckBox, false); |
1182 strings->SetString("learnMore", | 1182 strings->SetString("learnMore", |
1183 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); | 1183 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); |
1184 } | 1184 } |
OLD | NEW |