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..0f6b6666957c8f5ad524af628f5f6627fc738914 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("proceed_disabled", |
James Hawkins
2012/06/29 17:31:51
s/proceed_disabled/proceedDisabled/
Joao da Silva
2012/07/02 10:08:40
Done.
|
+ 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,13 +461,18 @@ 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(); |
+ // We are deleted after this. |
James Hawkins
2012/06/29 17:31:51
nit: Don't use pronouns in comments (we). Pronoun
Joao da Silva
2012/07/02 10:08:40
Done.
|
+ 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. |
@@ -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, |