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 "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "chrome/browser/history/history_service_factory.h" |
10 #include "chrome/browser/interstitials/chrome_controller_client.h" | 11 #include "chrome/browser/interstitials/chrome_controller_client.h" |
11 #include "chrome/browser/interstitials/chrome_metrics_helper.h" | 12 #include "chrome/browser/interstitials/chrome_metrics_helper.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/renderer_preferences_util.h" | 14 #include "chrome/browser/renderer_preferences_util.h" |
14 #include "chrome/browser/safe_browsing/threat_details.h" | 15 #include "chrome/browser/safe_browsing/threat_details.h" |
15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
16 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
17 #include "components/safe_browsing_db/safe_browsing_prefs.h" | 18 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/interstitial_page.h" | 20 #include "content/public/browser/interstitial_page.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 display_options) { | 112 display_options) { |
112 // Start computing threat details. They will be sent only | 113 // Start computing threat details. They will be sent only |
113 // if the user opts-in on the blocking page later. | 114 // if the user opts-in on the blocking page later. |
114 // If there's more than one malicious resources, it means the user | 115 // If there's more than one malicious resources, it means the user |
115 // clicked through the first warning, so we don't prepare additional | 116 // clicked through the first warning, so we don't prepare additional |
116 // reports. | 117 // reports. |
117 if (unsafe_resources.size() == 1 && | 118 if (unsafe_resources.size() == 1 && |
118 ShouldReportThreatDetails(unsafe_resources[0].threat_type) && | 119 ShouldReportThreatDetails(unsafe_resources[0].threat_type) && |
119 threat_details_.get() == NULL && | 120 threat_details_.get() == NULL && |
120 sb_error_ui()->CanShowExtendedReportingOption()) { | 121 sb_error_ui()->CanShowExtendedReportingOption()) { |
121 threat_details_ = ThreatDetails::NewThreatDetails(ui_manager, web_contents, | 122 Profile* profile = |
122 unsafe_resources[0]); | 123 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 124 threat_details_ = ThreatDetails::NewThreatDetails( |
| 125 ui_manager, web_contents, unsafe_resources[0], |
| 126 profile->GetRequestContext(), |
| 127 HistoryServiceFactory::GetForProfile( |
| 128 profile, ServiceAccessType::EXPLICIT_ACCESS)); |
123 } | 129 } |
124 } | 130 } |
125 | 131 |
126 bool SafeBrowsingBlockingPage::ShouldReportThreatDetails( | 132 bool SafeBrowsingBlockingPage::ShouldReportThreatDetails( |
127 SBThreatType threat_type) { | 133 SBThreatType threat_type) { |
128 return threat_type == SB_THREAT_TYPE_URL_PHISHING || | 134 return threat_type == SB_THREAT_TYPE_URL_PHISHING || |
129 threat_type == SB_THREAT_TYPE_URL_MALWARE || | 135 threat_type == SB_THREAT_TYPE_URL_MALWARE || |
130 threat_type == SB_THREAT_TYPE_URL_UNWANTED || | 136 threat_type == SB_THREAT_TYPE_URL_UNWANTED || |
131 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || | 137 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || |
132 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL; | 138 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 web_contents, unsafe_resources[0].url, | 269 web_contents, unsafe_resources[0].url, |
264 GetReportingInfo(unsafe_resources), | 270 GetReportingInfo(unsafe_resources), |
265 GetSamplingEventName(GetInterstitialReason(unsafe_resources))); | 271 GetSamplingEventName(GetInterstitialReason(unsafe_resources))); |
266 | 272 |
267 return base::MakeUnique<SecurityInterstitialControllerClient>( | 273 return base::MakeUnique<SecurityInterstitialControllerClient>( |
268 web_contents, std::move(metrics_helper), profile->GetPrefs(), | 274 web_contents, std::move(metrics_helper), profile->GetPrefs(), |
269 ui_manager->app_locale(), ui_manager->default_safe_page()); | 275 ui_manager->app_locale(), ui_manager->default_safe_page()); |
270 } | 276 } |
271 | 277 |
272 } // namespace safe_browsing | 278 } // namespace safe_browsing |
OLD | NEW |