| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 renderer_preferences_util::UpdateFromSystemSettings( | 317 renderer_preferences_util::UpdateFromSystemSettings( |
| 318 prefs, profile, web_contents()); | 318 prefs, profile, web_contents()); |
| 319 } | 319 } |
| 320 | 320 |
| 321 void SafeBrowsingBlockingPage::OnProceed() { | 321 void SafeBrowsingBlockingPage::OnProceed() { |
| 322 proceeded_ = true; | 322 proceeded_ = true; |
| 323 // Send the threat details, if we opted to. | 323 // Send the threat details, if we opted to. |
| 324 FinishThreatDetails(threat_details_proceed_delay_ms_, true, /* did_proceed */ | 324 FinishThreatDetails(threat_details_proceed_delay_ms_, true, /* did_proceed */ |
| 325 controller()->metrics_helper()->NumVisits()); | 325 controller()->metrics_helper()->NumVisits()); |
| 326 | 326 |
| 327 ui_manager_->OnBlockingPageDone(unsafe_resources_, true); | 327 ui_manager_->OnBlockingPageDone(unsafe_resources_, true, web_contents(), |
| 328 main_frame_url_); |
| 328 | 329 |
| 329 // Check to see if some new notifications of unsafe resources have been | 330 // Check to see if some new notifications of unsafe resources have been |
| 330 // received while we were showing the interstitial. | 331 // received while we were showing the interstitial. |
| 331 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); | 332 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); |
| 332 UnsafeResourceMap::iterator iter = unsafe_resource_map->find(web_contents()); | 333 UnsafeResourceMap::iterator iter = unsafe_resource_map->find(web_contents()); |
| 333 SafeBrowsingBlockingPage* blocking_page = NULL; | 334 SafeBrowsingBlockingPage* blocking_page = NULL; |
| 334 if (iter != unsafe_resource_map->end() && !iter->second.empty()) { | 335 if (iter != unsafe_resource_map->end() && !iter->second.empty()) { |
| 335 // All queued unsafe resources should be for the same page: | 336 // All queued unsafe resources should be for the same page: |
| 336 content::NavigationEntry* entry = | 337 content::NavigationEntry* entry = |
| 337 iter->second[0].GetNavigationEntryForResource(); | 338 iter->second[0].GetNavigationEntryForResource(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 366 | 367 |
| 367 if (!IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { | 368 if (!IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { |
| 368 controller()->metrics_helper()->RecordUserDecision( | 369 controller()->metrics_helper()->RecordUserDecision( |
| 369 security_interstitials::MetricsHelper::DONT_PROCEED); | 370 security_interstitials::MetricsHelper::DONT_PROCEED); |
| 370 } | 371 } |
| 371 | 372 |
| 372 // Send the malware details, if we opted to. | 373 // Send the malware details, if we opted to. |
| 373 FinishThreatDetails(0, false /* did_proceed */, | 374 FinishThreatDetails(0, false /* did_proceed */, |
| 374 controller()->metrics_helper()->NumVisits()); // No delay | 375 controller()->metrics_helper()->NumVisits()); // No delay |
| 375 | 376 |
| 376 ui_manager_->OnBlockingPageDone(unsafe_resources_, false); | 377 ui_manager_->OnBlockingPageDone(unsafe_resources_, false, web_contents(), |
| 378 main_frame_url_); |
| 377 | 379 |
| 378 // The user does not want to proceed, clear the queued unsafe resources | 380 // The user does not want to proceed, clear the queued unsafe resources |
| 379 // notifications we received while the interstitial was showing. | 381 // notifications we received while the interstitial was showing. |
| 380 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); | 382 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); |
| 381 UnsafeResourceMap::iterator iter = unsafe_resource_map->find(web_contents()); | 383 UnsafeResourceMap::iterator iter = unsafe_resource_map->find(web_contents()); |
| 382 if (iter != unsafe_resource_map->end() && !iter->second.empty()) { | 384 if (iter != unsafe_resource_map->end() && !iter->second.empty()) { |
| 383 ui_manager_->OnBlockingPageDone(iter->second, false); | 385 ui_manager_->OnBlockingPageDone(iter->second, false, web_contents(), |
| 386 main_frame_url_); |
| 384 unsafe_resource_map->erase(iter); | 387 unsafe_resource_map->erase(iter); |
| 385 } | 388 } |
| 386 | 389 |
| 387 // We don't remove the navigation entry if the tab is being destroyed as this | 390 // We don't remove the navigation entry if the tab is being destroyed as this |
| 388 // would trigger a navigation that would cause trouble as the render view host | 391 // would trigger a navigation that would cause trouble as the render view host |
| 389 // for the tab has by then already been destroyed. We also don't delete the | 392 // for the tab has by then already been destroyed. We also don't delete the |
| 390 // current entry if it has been committed again, which is possible on a page | 393 // current entry if it has been committed again, which is possible on a page |
| 391 // that had a subresource warning. | 394 // that had a subresource warning. |
| 392 int last_committed_index = | 395 int last_committed_index = |
| 393 web_contents()->GetController().GetLastCommittedEntryIndex(); | 396 web_contents()->GetController().GetLastCommittedEntryIndex(); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, | 760 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, |
| 758 GetFormattedHostName())); | 761 GetFormattedHostName())); |
| 759 load_time_data->SetString( | 762 load_time_data->SetString( |
| 760 "finalParagraph", | 763 "finalParagraph", |
| 761 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); | 764 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); |
| 762 | 765 |
| 763 PopulateExtendedReportingOption(load_time_data); | 766 PopulateExtendedReportingOption(load_time_data); |
| 764 } | 767 } |
| 765 | 768 |
| 766 } // namespace safe_browsing | 769 } // namespace safe_browsing |
| OLD | NEW |