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 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR)); | 430 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR)); |
431 strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); | 431 strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); |
432 } | 432 } |
433 | 433 |
434 void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { | 434 void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { |
435 std::string command(cmd); // Make a local copy so we can modify it. | 435 std::string command(cmd); // Make a local copy so we can modify it. |
436 // The Jasonified response has quotes, remove them. | 436 // The Jasonified response has quotes, remove them. |
437 if (command.length() > 1 && command[0] == '"') { | 437 if (command.length() > 1 && command[0] == '"') { |
438 command = command.substr(1, command.length() - 2); | 438 command = command.substr(1, command.length() - 2); |
439 } | 439 } |
440 RecordUserReactionTime(cmd); | 440 RecordUserReactionTime(command); |
441 if (command == kDoReportCommand) { | 441 if (command == kDoReportCommand) { |
442 SetReportingPreference(true); | 442 SetReportingPreference(true); |
443 return; | 443 return; |
444 } | 444 } |
445 | 445 |
446 if (command == kDontReportCommand) { | 446 if (command == kDontReportCommand) { |
447 SetReportingPreference(false); | 447 SetReportingPreference(false); |
448 return; | 448 return; |
449 } | 449 } |
450 | 450 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 // Client-side phishing detection interstitials never block the main frame | 814 // Client-side phishing detection interstitials never block the main frame |
815 // load, since they happen after the page is finished loading. | 815 // load, since they happen after the page is finished loading. |
816 if (unsafe_resources[0].threat_type == | 816 if (unsafe_resources[0].threat_type == |
817 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { | 817 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { |
818 return false; | 818 return false; |
819 } | 819 } |
820 | 820 |
821 // Otherwise, check the threat type. | 821 // Otherwise, check the threat type. |
822 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; | 822 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; |
823 } | 823 } |
OLD | NEW |