| Index: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
|
| ===================================================================
|
| --- chrome/browser/safe_browsing/safe_browsing_blocking_page.cc (revision 66339)
|
| +++ chrome/browser/safe_browsing/safe_browsing_blocking_page.cc (working copy)
|
| @@ -14,17 +14,21 @@
|
| #include "base/string_number_conversions.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "base/values.h"
|
| +#include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/browser_thread.h"
|
| #include "chrome/browser/dom_operation_notification_details.h"
|
| #include "chrome/browser/dom_ui/new_tab_ui.h"
|
| #include "chrome/browser/google/google_util.h"
|
| #include "chrome/browser/metrics/user_metrics.h"
|
| +#include "chrome/browser/prefs/pref_service.h"
|
| +#include "chrome/browser/profile.h"
|
| #include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
| #include "chrome/browser/tab_contents/navigation_controller.h"
|
| #include "chrome/browser/tab_contents/navigation_entry.h"
|
| #include "chrome/browser/tab_contents/tab_util.h"
|
| #include "chrome/browser/tab_contents/tab_contents.h"
|
| #include "chrome/common/jstemplate_builder.h"
|
| +#include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "grit/browser_resources.h"
|
| #include "grit/generated_resources.h"
|
| @@ -67,6 +71,8 @@
|
| static const char* const kLearnMoreCommand = "learnMore";
|
| static const char* const kProceedCommand = "proceed";
|
| static const char* const kTakeMeBackCommand = "takeMeBack";
|
| +static const char* const kDoReportCommand = "doReport";
|
| +static const char* const kDontReportCommand = "dontReport";
|
|
|
| // static
|
| SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL;
|
| @@ -282,7 +288,19 @@
|
| l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_LESS_INFO_BUTTON));
|
| strings->SetString("proceed_link",
|
| l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_PROCEED_LINK));
|
| + strings->SetString("confirm_text",
|
| + l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE));
|
| strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr");
|
| +
|
| + const PrefService::Preference* pref =
|
| + tab()->profile()->GetPrefs()->FindPreference(
|
| + prefs::kSafeBrowsingReportingEnabled);
|
| + bool value;
|
| + if (pref && pref->GetValue()->GetAsBoolean(&value) && value) {
|
| + strings->SetString("boxchecked", "yes");
|
| + } else {
|
| + strings->SetString("boxchecked", "");
|
| + }
|
| }
|
|
|
| void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary(
|
| @@ -313,6 +331,16 @@
|
| command = command.substr(1, command.length() - 2);
|
| }
|
|
|
| + if (command == kDoReportCommand) {
|
| + SetReportingPreference(true);
|
| + return;
|
| + }
|
| +
|
| + if (command == kDontReportCommand) {
|
| + SetReportingPreference(false);
|
| + return;
|
| + }
|
| +
|
| if (command == kLearnMoreCommand) {
|
| // User pressed "Learn more".
|
| GURL url;
|
| @@ -388,6 +416,11 @@
|
| NOTREACHED() << "Unexpected command: " << command;
|
| }
|
|
|
| +void SafeBrowsingBlockingPage::SetReportingPreference(bool report) {
|
| + PrefService* pref = tab()->profile()->GetPrefs();
|
| + pref->SetBoolean(prefs::kSafeBrowsingReportingEnabled, report);
|
| +}
|
| +
|
| void SafeBrowsingBlockingPage::Proceed() {
|
| RecordUserAction(PROCEED);
|
|
|
|
|