OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "components/safe_browsing/base_blocking_page.h" | 5 #include "components/safe_browsing/base_blocking_page.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 return "from_data_saver"; | 259 return "from_data_saver"; |
260 case safe_browsing::ThreatSource::REMOTE: | 260 case safe_browsing::ThreatSource::REMOTE: |
261 case safe_browsing::ThreatSource::LOCAL_PVER3: | 261 case safe_browsing::ThreatSource::LOCAL_PVER3: |
262 // REMOTE and LOCAL_PVER3 can be distinguished in the logs | 262 // REMOTE and LOCAL_PVER3 can be distinguished in the logs |
263 // by platform type: Remote is mobile, local_pver3 is desktop. | 263 // by platform type: Remote is mobile, local_pver3 is desktop. |
264 return "from_device"; | 264 return "from_device"; |
265 case safe_browsing::ThreatSource::LOCAL_PVER4: | 265 case safe_browsing::ThreatSource::LOCAL_PVER4: |
266 return "from_device_v4"; | 266 return "from_device_v4"; |
267 case safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION: | 267 case safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION: |
268 return "from_client_side_detection"; | 268 return "from_client_side_detection"; |
| 269 case safe_browsing::ThreatSource::PASSWORD_PROTECTION_SERVICE: |
| 270 return "from_password_protection_service"; |
269 case safe_browsing::ThreatSource::UNKNOWN: | 271 case safe_browsing::ThreatSource::UNKNOWN: |
270 break; | 272 break; |
271 } | 273 } |
272 NOTREACHED(); | 274 NOTREACHED(); |
273 return std::string(); | 275 return std::string(); |
274 } | 276 } |
275 | 277 |
276 // static | 278 // static |
277 security_interstitials::BaseSafeBrowsingErrorUI::SBInterstitialReason | 279 security_interstitials::BaseSafeBrowsingErrorUI::SBInterstitialReason |
278 BaseBlockingPage::GetInterstitialReason( | 280 BaseBlockingPage::GetInterstitialReason( |
279 const UnsafeResourceList& unsafe_resources) { | 281 const UnsafeResourceList& unsafe_resources) { |
280 bool harmful = false; | 282 bool harmful = false; |
281 for (UnsafeResourceList::const_iterator iter = unsafe_resources.begin(); | 283 for (UnsafeResourceList::const_iterator iter = unsafe_resources.begin(); |
282 iter != unsafe_resources.end(); ++iter) { | 284 iter != unsafe_resources.end(); ++iter) { |
283 const BaseUIManager::UnsafeResource& resource = *iter; | 285 const BaseUIManager::UnsafeResource& resource = *iter; |
284 safe_browsing::SBThreatType threat_type = resource.threat_type; | 286 safe_browsing::SBThreatType threat_type = resource.threat_type; |
285 if (threat_type == SB_THREAT_TYPE_URL_MALWARE || | 287 if (threat_type == SB_THREAT_TYPE_URL_MALWARE || |
286 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL) { | 288 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL) { |
287 return BaseSafeBrowsingErrorUI::SB_REASON_MALWARE; | 289 return BaseSafeBrowsingErrorUI::SB_REASON_MALWARE; |
288 } else if (threat_type == SB_THREAT_TYPE_URL_UNWANTED) { | 290 } else if (threat_type == SB_THREAT_TYPE_URL_UNWANTED) { |
289 harmful = true; | 291 harmful = true; |
290 } else { | 292 } else { |
291 DCHECK(threat_type == SB_THREAT_TYPE_URL_PHISHING || | 293 DCHECK(threat_type == SB_THREAT_TYPE_URL_PHISHING || |
292 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); | 294 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || |
| 295 threat_type == SB_THREAT_TYPE_PASSWORD_PROTECTION_PHISHING_URL); |
293 } | 296 } |
294 } | 297 } |
295 | 298 |
296 if (harmful) | 299 if (harmful) |
297 return BaseSafeBrowsingErrorUI::SB_REASON_HARMFUL; | 300 return BaseSafeBrowsingErrorUI::SB_REASON_HARMFUL; |
298 return BaseSafeBrowsingErrorUI::SB_REASON_PHISHING; | 301 return BaseSafeBrowsingErrorUI::SB_REASON_PHISHING; |
299 } | 302 } |
300 | 303 |
301 BaseUIManager* BaseBlockingPage::ui_manager() const { | 304 BaseUIManager* BaseBlockingPage::ui_manager() const { |
302 return ui_manager_; | 305 return ui_manager_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 base::MakeUnique<security_interstitials::MetricsHelper>( | 348 base::MakeUnique<security_interstitials::MetricsHelper>( |
346 unsafe_resources[0].url, GetReportingInfo(unsafe_resources), | 349 unsafe_resources[0].url, GetReportingInfo(unsafe_resources), |
347 history_service); | 350 history_service); |
348 | 351 |
349 return base::MakeUnique<SecurityInterstitialControllerClient>( | 352 return base::MakeUnique<SecurityInterstitialControllerClient>( |
350 web_contents, std::move(metrics_helper), nullptr, /* prefs */ | 353 web_contents, std::move(metrics_helper), nullptr, /* prefs */ |
351 ui_manager->app_locale(), ui_manager->default_safe_page()); | 354 ui_manager->app_locale(), ui_manager->default_safe_page()); |
352 } | 355 } |
353 | 356 |
354 } // namespace safe_browsing | 357 } // namespace safe_browsing |
OLD | NEW |