| Index: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
|
| diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
|
| index 1e9f7be9634f14030a2c7b3b343d743f1cbc85aa..fca41dfc0595a710f4d42595d0336123a2c50b3f 100644
|
| --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
|
| +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
|
| @@ -231,6 +231,8 @@ void SafeBrowsingBlockingPage::PopulateStringDictionary(
|
| strings->SetString("description1", description1);
|
| strings->SetString("description2", description2);
|
| strings->SetString("description3", description3);
|
| + strings->SetBoolean("proceedDisabled",
|
| + IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled));
|
| }
|
|
|
| void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
|
| @@ -380,19 +382,10 @@ void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
|
| l10n_util::GetStringFUTF16(
|
| IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE,
|
| UTF8ToUTF16(privacy_link)));
|
| -
|
| - Profile* profile = Profile::FromBrowserContext(
|
| - web_contents_->GetBrowserContext());
|
| - const PrefService::Preference* pref =
|
| - profile->GetPrefs()->FindPreference(
|
| - prefs::kSafeBrowsingReportingEnabled);
|
| -
|
| - bool value;
|
| - if (pref && pref->GetValue()->GetAsBoolean(&value) && value) {
|
| + if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled))
|
| strings->SetString(kBoxChecked, "yes");
|
| - } else {
|
| + else
|
| strings->SetString(kBoxChecked, "");
|
| - }
|
| }
|
| }
|
|
|
| @@ -468,18 +461,23 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) {
|
| return;
|
| }
|
|
|
| + bool proceed_blocked = false;
|
| if (command == kProceedCommand) {
|
| - interstitial_page_->Proceed();
|
| - // We are deleted after this.
|
| - return;
|
| + if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) {
|
| + proceed_blocked = true;
|
| + } else {
|
| + interstitial_page_->Proceed();
|
| + // |this| has been deleted after Proceed() returns.
|
| + return;
|
| + }
|
| }
|
|
|
| - if (command == kTakeMeBackCommand) {
|
| + if (command == kTakeMeBackCommand || proceed_blocked) {
|
| if (is_main_frame_load_blocked_) {
|
| // If the load is blocked, we want to close the interstitial and discard
|
| // the pending entry.
|
| interstitial_page_->DontProceed();
|
| - // We are deleted after this.
|
| + // |this| has been deleted after DontProceed() returns.
|
| return;
|
| }
|
|
|
| @@ -680,13 +678,7 @@ void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) {
|
| if (malware_details_ == NULL)
|
| return; // Not all interstitials have malware details (eg phishing).
|
|
|
| - Profile* profile = Profile::FromBrowserContext(
|
| - web_contents_->GetBrowserContext());
|
| - const PrefService::Preference* pref =
|
| - profile->GetPrefs()->FindPreference(prefs::kSafeBrowsingReportingEnabled);
|
| -
|
| - bool value;
|
| - if (pref && pref->GetValue()->GetAsBoolean(&value) && value) {
|
| + if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled)) {
|
| // Finish the malware details collection, send it over.
|
| BrowserThread::PostDelayedTask(
|
| BrowserThread::IO, FROM_HERE,
|
| @@ -695,6 +687,12 @@ void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) {
|
| }
|
| }
|
|
|
| +bool SafeBrowsingBlockingPage::IsPrefEnabled(const char* pref) {
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_contents_->GetBrowserContext());
|
| + return profile->GetPrefs()->GetBoolean(pref);
|
| +}
|
| +
|
| // static
|
| void SafeBrowsingBlockingPage::NotifySafeBrowsingService(
|
| SafeBrowsingService* sb_service,
|
|
|