OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/string_number_conversions.h" |
13 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
14 #include "base/string_number_conversions.h" | |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/dom_operation_notification_details.h" | 18 #include "chrome/browser/dom_operation_notification_details.h" |
19 #include "chrome/browser/google/google_util.h" | 19 #include "chrome/browser/google/google_util.h" |
20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/safe_browsing/malware_details.h" | 22 #include "chrome/browser/safe_browsing/malware_details.h" |
23 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 23 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
24 #include "chrome/browser/tab_contents/tab_util.h" | 24 #include "chrome/browser/tab_contents/tab_util.h" |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 bad_url_spec, | 490 bad_url_spec, |
491 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL); | 491 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL); |
492 tab()->OpenURL(report_url, GURL(), CURRENT_TAB, PageTransition::LINK); | 492 tab()->OpenURL(report_url, GURL(), CURRENT_TAB, PageTransition::LINK); |
493 return; | 493 return; |
494 } | 494 } |
495 | 495 |
496 if (command == kShowDiagnosticCommand) { | 496 if (command == kShowDiagnosticCommand) { |
497 // We're going to take the user to Google's SafeBrowsing diagnostic page. | 497 // We're going to take the user to Google's SafeBrowsing diagnostic page. |
498 std::string diagnostic = | 498 std::string diagnostic = |
499 base::StringPrintf(kSbDiagnosticUrl, | 499 base::StringPrintf(kSbDiagnosticUrl, |
500 EscapeQueryParamValue(bad_url_spec, true).c_str()); | 500 net::EscapeQueryParamValue(bad_url_spec, true).c_str()); |
501 GURL diagnostic_url(diagnostic); | 501 GURL diagnostic_url(diagnostic); |
502 diagnostic_url = google_util::AppendGoogleLocaleParam(diagnostic_url); | 502 diagnostic_url = google_util::AppendGoogleLocaleParam(diagnostic_url); |
503 DCHECK(unsafe_resources_[element_index].threat_type == | 503 DCHECK(unsafe_resources_[element_index].threat_type == |
504 SafeBrowsingService::URL_MALWARE); | 504 SafeBrowsingService::URL_MALWARE); |
505 tab()->OpenURL(diagnostic_url, GURL(), CURRENT_TAB, PageTransition::LINK); | 505 tab()->OpenURL(diagnostic_url, GURL(), CURRENT_TAB, PageTransition::LINK); |
506 return; | 506 return; |
507 } | 507 } |
508 | 508 |
509 NOTREACHED() << "Unexpected command: " << command; | 509 NOTREACHED() << "Unexpected command: " << command; |
510 } | 510 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 // Client-side phishing detection interstitials never block the main frame | 704 // Client-side phishing detection interstitials never block the main frame |
705 // load, since they happen after the page is finished loading. | 705 // load, since they happen after the page is finished loading. |
706 if (unsafe_resources[0].threat_type == | 706 if (unsafe_resources[0].threat_type == |
707 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { | 707 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { |
708 return false; | 708 return false; |
709 } | 709 } |
710 | 710 |
711 // Otherwise, check the threat type. | 711 // Otherwise, check the threat type. |
712 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; | 712 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; |
713 } | 713 } |
OLD | NEW |