| 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 0a0a8d9d2dadb1eab4168294d768731b47fe606c..d580f8649f34d1c120499d1cbdbdba3f843a62e6 100644
|
| --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
|
| +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
|
| @@ -240,6 +240,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(
|
| @@ -389,19 +391,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, "");
|
| - }
|
| }
|
| }
|
|
|
| @@ -477,18 +470,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;
|
| }
|
|
|
| @@ -678,7 +676,10 @@ void SafeBrowsingBlockingPage::RecordUserAction(BlockingPageEvent event) {
|
| action.append("Proceed");
|
| break;
|
| case DONT_PROCEED:
|
| - action.append("DontProceed");
|
| + if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled))
|
| + action.append("ForcedDontProceed");
|
| + else
|
| + action.append("DontProceed");
|
| break;
|
| default:
|
| NOTREACHED() << "Unexpected event: " << event;
|
| @@ -739,13 +740,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,
|
| @@ -754,6 +749,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,
|
|
|