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 |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 | 596 |
597 // We don't remove the navigation entry if the tab is being destroyed as this | 597 // We don't remove the navigation entry if the tab is being destroyed as this |
598 // would trigger a navigation that would cause trouble as the render view host | 598 // would trigger a navigation that would cause trouble as the render view host |
599 // for the tab has by then already been destroyed. We also don't delete the | 599 // for the tab has by then already been destroyed. We also don't delete the |
600 // current entry if it has been committed again, which is possible on a page | 600 // current entry if it has been committed again, which is possible on a page |
601 // that had a subresource warning. | 601 // that had a subresource warning. |
602 int last_committed_index = | 602 int last_committed_index = |
603 tab()->GetController().last_committed_entry_index(); | 603 tab()->GetController().last_committed_entry_index(); |
604 if (navigation_entry_index_to_remove_ != -1 && | 604 if (navigation_entry_index_to_remove_ != -1 && |
605 navigation_entry_index_to_remove_ != last_committed_index && | 605 navigation_entry_index_to_remove_ != last_committed_index && |
606 !tab()->is_being_destroyed()) { | 606 !tab()->IsBeingDestroyed()) { |
607 tab()->GetController().RemoveEntryAtIndex( | 607 tab()->GetController().RemoveEntryAtIndex( |
608 navigation_entry_index_to_remove_); | 608 navigation_entry_index_to_remove_); |
609 navigation_entry_index_to_remove_ = -1; | 609 navigation_entry_index_to_remove_ = -1; |
610 } | 610 } |
611 InterstitialPage::DontProceed(); | 611 InterstitialPage::DontProceed(); |
612 // We are now deleted. | 612 // We are now deleted. |
613 } | 613 } |
614 | 614 |
615 void SafeBrowsingBlockingPage::RecordUserAction(BlockingPageEvent event) { | 615 void SafeBrowsingBlockingPage::RecordUserAction(BlockingPageEvent event) { |
616 // Determine the interstitial type from the blocked resources. | 616 // Determine the interstitial type from the blocked resources. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 // Client-side phishing detection interstitials never block the main frame | 732 // Client-side phishing detection interstitials never block the main frame |
733 // load, since they happen after the page is finished loading. | 733 // load, since they happen after the page is finished loading. |
734 if (unsafe_resources[0].threat_type == | 734 if (unsafe_resources[0].threat_type == |
735 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { | 735 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { |
736 return false; | 736 return false; |
737 } | 737 } |
738 | 738 |
739 // Otherwise, check the threat type. | 739 // Otherwise, check the threat type. |
740 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; | 740 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; |
741 } | 741 } |
OLD | NEW |