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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/macros.h" |
15 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
16 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
17 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_piece.h" | 20 #include "base/strings/string_piece.h" |
20 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
21 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
22 #include "base/time/time.h" | 23 #include "base/time/time.h" |
23 #include "base/values.h" | 24 #include "base/values.h" |
24 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 "https://www.google.com/transparencyreport/safebrowsing/"; | 74 "https://www.google.com/transparencyreport/safebrowsing/"; |
74 | 75 |
75 // Constants for the V4 phishing string upgrades. | 76 // Constants for the V4 phishing string upgrades. |
76 const char kSocialEngineeringTrial[] = "SafeBrowsingSocialEngineeringStrings"; | 77 const char kSocialEngineeringTrial[] = "SafeBrowsingSocialEngineeringStrings"; |
77 const char kSocialEngineeringEnabled[] = "Enabled"; | 78 const char kSocialEngineeringEnabled[] = "Enabled"; |
78 | 79 |
79 // After a malware interstitial where the user opted-in to the report | 80 // After a malware interstitial where the user opted-in to the report |
80 // but clicked "proceed anyway", we delay the call to | 81 // but clicked "proceed anyway", we delay the call to |
81 // ThreatDetails::FinishCollection() by this much time (in | 82 // ThreatDetails::FinishCollection() by this much time (in |
82 // milliseconds). | 83 // milliseconds). |
83 const int64 kMalwareDetailsProceedDelayMilliSeconds = 3000; | 84 const int64_t kMalwareDetailsProceedDelayMilliSeconds = 3000; |
84 | 85 |
85 // Constants for the Experience Sampling instrumentation. | 86 // Constants for the Experience Sampling instrumentation. |
86 const char kEventNameMalware[] = "safebrowsing_interstitial_"; | 87 const char kEventNameMalware[] = "safebrowsing_interstitial_"; |
87 const char kEventNameHarmful[] = "harmful_interstitial_"; | 88 const char kEventNameHarmful[] = "harmful_interstitial_"; |
88 const char kEventNamePhishing[] = "phishing_interstitial_"; | 89 const char kEventNamePhishing[] = "phishing_interstitial_"; |
89 const char kEventNameOther[] = "safebrowsing_other_interstitial_"; | 90 const char kEventNameOther[] = "safebrowsing_other_interstitial_"; |
90 | 91 |
91 // Constants for the V4 phishing string upgrades. | 92 // Constants for the V4 phishing string upgrades. |
92 const char kReportPhishingErrorUrl[] = | 93 const char kReportPhishingErrorUrl[] = |
93 "https://www.google.com/safebrowsing/report_error/"; | 94 "https://www.google.com/safebrowsing/report_error/"; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 web_contents()->GetController().GetLastCommittedEntryIndex(); | 438 web_contents()->GetController().GetLastCommittedEntryIndex(); |
438 if (navigation_entry_index_to_remove_ != -1 && | 439 if (navigation_entry_index_to_remove_ != -1 && |
439 navigation_entry_index_to_remove_ != last_committed_index && | 440 navigation_entry_index_to_remove_ != last_committed_index && |
440 !web_contents()->IsBeingDestroyed()) { | 441 !web_contents()->IsBeingDestroyed()) { |
441 CHECK(web_contents()->GetController().RemoveEntryAtIndex( | 442 CHECK(web_contents()->GetController().RemoveEntryAtIndex( |
442 navigation_entry_index_to_remove_)); | 443 navigation_entry_index_to_remove_)); |
443 navigation_entry_index_to_remove_ = -1; | 444 navigation_entry_index_to_remove_ = -1; |
444 } | 445 } |
445 } | 446 } |
446 | 447 |
447 void SafeBrowsingBlockingPage::FinishThreatDetails(int64 delay_ms, | 448 void SafeBrowsingBlockingPage::FinishThreatDetails(int64_t delay_ms, |
448 bool did_proceed, | 449 bool did_proceed, |
449 int num_visits) { | 450 int num_visits) { |
450 if (threat_details_.get() == NULL) | 451 if (threat_details_.get() == NULL) |
451 return; // Not all interstitials have threat details (eg., incognito mode). | 452 return; // Not all interstitials have threat details (eg., incognito mode). |
452 | 453 |
453 const bool enabled = | 454 const bool enabled = |
454 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled) && | 455 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled) && |
455 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingOptInAllowed); | 456 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingOptInAllowed); |
456 if (!enabled) | 457 if (!enabled) |
457 return; | 458 return; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 } else { | 725 } else { |
725 load_time_data->SetString( | 726 load_time_data->SetString( |
726 "finalParagraph", | 727 "finalParagraph", |
727 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); | 728 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); |
728 } | 729 } |
729 | 730 |
730 PopulateExtendedReportingOption(load_time_data); | 731 PopulateExtendedReportingOption(load_time_data); |
731 } | 732 } |
732 | 733 |
733 } // namespace safe_browsing | 734 } // namespace safe_browsing |
OLD | NEW |