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/bind.h" | 11 #include "base/bind.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/string_piece.h" | |
16 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
17 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
18 #include "base/values.h" | 17 #include "base/values.h" |
19 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/dom_operation_notification_details.h" | 19 #include "chrome/browser/dom_operation_notification_details.h" |
21 #include "chrome/browser/google/google_util.h" | 20 #include "chrome/browser/google/google_util.h" |
22 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
23 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/safe_browsing/malware_details.h" | 23 #include "chrome/browser/safe_browsing/malware_details.h" |
25 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 24 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 // We are deleted after this. | 460 // We are deleted after this. |
462 return; | 461 return; |
463 } | 462 } |
464 | 463 |
465 // The "report error" and "show diagnostic" commands can have a number | 464 // The "report error" and "show diagnostic" commands can have a number |
466 // appended to them, which is the index of the element they apply to. | 465 // appended to them, which is the index of the element they apply to. |
467 int element_index = 0; | 466 int element_index = 0; |
468 size_t colon_index = command.find(':'); | 467 size_t colon_index = command.find(':'); |
469 if (colon_index != std::string::npos) { | 468 if (colon_index != std::string::npos) { |
470 DCHECK(colon_index < command.size() - 1); | 469 DCHECK(colon_index < command.size() - 1); |
471 bool result = base::StringToInt(base::StringPiece(command.begin() + | 470 bool result = base::StringToInt(command.begin() + colon_index + 1, |
472 colon_index + 1, | 471 command.end(), |
473 command.end()), | |
474 &element_index); | 472 &element_index); |
475 command = command.substr(0, colon_index); | 473 command = command.substr(0, colon_index); |
476 DCHECK(result); | 474 DCHECK(result); |
477 } | 475 } |
478 | 476 |
479 if (element_index >= static_cast<int>(unsafe_resources_.size())) { | 477 if (element_index >= static_cast<int>(unsafe_resources_.size())) { |
480 NOTREACHED(); | 478 NOTREACHED(); |
481 return; | 479 return; |
482 } | 480 } |
483 | 481 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 // Client-side phishing detection interstitials never block the main frame | 708 // Client-side phishing detection interstitials never block the main frame |
711 // load, since they happen after the page is finished loading. | 709 // load, since they happen after the page is finished loading. |
712 if (unsafe_resources[0].threat_type == | 710 if (unsafe_resources[0].threat_type == |
713 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { | 711 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { |
714 return false; | 712 return false; |
715 } | 713 } |
716 | 714 |
717 // Otherwise, check the threat type. | 715 // Otherwise, check the threat type. |
718 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; | 716 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; |
719 } | 717 } |
OLD | NEW |