Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 navigation_entry_index_to_remove_ = -1; 219 navigation_entry_index_to_remove_ = -1;
220 } 220 }
221 221
222 // Start computing malware details. They will be sent only 222 // Start computing malware details. They will be sent only
223 // if the user opts-in on the blocking page later. 223 // if the user opts-in on the blocking page later.
224 // If there's more than one malicious resources, it means the user 224 // If there's more than one malicious resources, it means the user
225 // clicked through the first warning, so we don't prepare additional 225 // clicked through the first warning, so we don't prepare additional
226 // reports. 226 // reports.
227 if (unsafe_resources.size() == 1 && 227 if (unsafe_resources.size() == 1 &&
228 unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE && 228 unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE &&
229 malware_details_ == NULL && 229 malware_details_.get() == NULL && CanShowMalwareDetailsOption()) {
230 CanShowMalwareDetailsOption()) {
231 malware_details_ = MalwareDetails::NewMalwareDetails( 230 malware_details_ = MalwareDetails::NewMalwareDetails(
232 ui_manager_, web_contents, unsafe_resources[0]); 231 ui_manager_, web_contents, unsafe_resources[0]);
233 } 232 }
234 233
235 interstitial_page_ = InterstitialPage::Create( 234 interstitial_page_ = InterstitialPage::Create(
236 web_contents, IsMainPageLoadBlocked(unsafe_resources), url_, this); 235 web_contents, IsMainPageLoadBlocked(unsafe_resources), url_, this);
237 } 236 }
238 237
239 bool SafeBrowsingBlockingPage::CanShowMalwareDetailsOption() { 238 bool SafeBrowsingBlockingPage::CanShowMalwareDetailsOption() {
240 return (!web_contents_->GetBrowserContext()->IsOffTheRecord() && 239 return (!web_contents_->GetBrowserContext()->IsOffTheRecord() &&
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 recorded = false; 694 recorded = false;
696 } else { 695 } else {
697 recorded = false; 696 recorded = false;
698 } 697 }
699 } 698 }
700 if (recorded) // Making sure we don't double-count reaction times. 699 if (recorded) // Making sure we don't double-count reaction times.
701 interstitial_show_time_ = base::TimeTicks(); // Resets the show time. 700 interstitial_show_time_ = base::TimeTicks(); // Resets the show time.
702 } 701 }
703 702
704 void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) { 703 void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) {
705 if (malware_details_ == NULL) 704 if (malware_details_.get() == NULL)
706 return; // Not all interstitials have malware details (eg phishing). 705 return; // Not all interstitials have malware details (eg phishing).
707 706
708 if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled)) { 707 if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled)) {
709 // Finish the malware details collection, send it over. 708 // Finish the malware details collection, send it over.
710 BrowserThread::PostDelayedTask( 709 BrowserThread::PostDelayedTask(
711 BrowserThread::IO, FROM_HERE, 710 BrowserThread::IO, FROM_HERE,
712 base::Bind(&MalwareDetails::FinishCollection, malware_details_.get()), 711 base::Bind(&MalwareDetails::FinishCollection, malware_details_.get()),
713 base::TimeDelta::FromMilliseconds(delay_ms)); 712 base::TimeDelta::FromMilliseconds(delay_ms));
714 } 713 }
715 } 714 }
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 strings->SetString("details", std::string()); 1123 strings->SetString("details", std::string());
1125 strings->SetString("confirm_text", std::string()); 1124 strings->SetString("confirm_text", std::string());
1126 strings->SetString(kBoxChecked, std::string()); 1125 strings->SetString(kBoxChecked, std::string());
1127 strings->SetString( 1126 strings->SetString(
1128 "report_error", 1127 "report_error",
1129 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); 1128 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR));
1130 strings->SetBoolean(kDisplayCheckBox, false); 1129 strings->SetBoolean(kDisplayCheckBox, false);
1131 strings->SetString("learnMore", 1130 strings->SetString("learnMore",
1132 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); 1131 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE));
1133 } 1132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698