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

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

Issue 10905117: Safebrowsing malware interstitial UI tweaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 static const char* const kShowDiagnosticCommand = "showDiagnostic"; 98 static const char* const kShowDiagnosticCommand = "showDiagnostic";
99 static const char* const kReportErrorCommand = "reportError"; 99 static const char* const kReportErrorCommand = "reportError";
100 static const char* const kLearnMoreCommand = "learnMore"; 100 static const char* const kLearnMoreCommand = "learnMore";
101 static const char* const kLearnMoreCommandV2 = "learnMore2"; 101 static const char* const kLearnMoreCommandV2 = "learnMore2";
102 static const char* const kShowPrivacyCommand = "showPrivacy"; 102 static const char* const kShowPrivacyCommand = "showPrivacy";
103 static const char* const kProceedCommand = "proceed"; 103 static const char* const kProceedCommand = "proceed";
104 static const char* const kTakeMeBackCommand = "takeMeBack"; 104 static const char* const kTakeMeBackCommand = "takeMeBack";
105 static const char* const kDoReportCommand = "doReport"; 105 static const char* const kDoReportCommand = "doReport";
106 static const char* const kDontReportCommand = "dontReport"; 106 static const char* const kDontReportCommand = "dontReport";
107 static const char* const kDisplayCheckBox = "displaycheckbox"; 107 static const char* const kDisplayCheckBox = "displaycheckbox";
108 static const char* const kDisplayShowDiagnostic = "displayShowDiagnostic";
109 static const char* const kBoxChecked = "boxchecked"; 108 static const char* const kBoxChecked = "boxchecked";
110 static const char* const kExpandedSeeMore = "expandedSeeMore"; 109 static const char* const kExpandedSeeMore = "expandedSeeMore";
111 // Special command that we use when the user navigated away from the 110 // Special command that we use when the user navigated away from the
112 // page. E.g., closed the tab or the window. This is only used by 111 // page. E.g., closed the tab or the window. This is only used by
113 // RecordUserReactionTime. 112 // RecordUserReactionTime.
114 static const char* const kNavigatedAwayMetaCommand = "closed"; 113 static const char* const kNavigatedAwayMetaCommand = "closed";
115 114
116 // static 115 // static
117 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; 116 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL;
118 117
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 interstitial_show_time_ = base::TimeTicks::Now(); 1039 interstitial_show_time_ = base::TimeTicks::Now();
1041 return jstemplate_builder::GetTemplatesHtml(html, &strings, "template-root"); 1040 return jstemplate_builder::GetTemplatesHtml(html, &strings, "template-root");
1042 } 1041 }
1043 1042
1044 void SafeBrowsingBlockingPageV2::PopulateStringDictionary( 1043 void SafeBrowsingBlockingPageV2::PopulateStringDictionary(
1045 DictionaryValue* strings, 1044 DictionaryValue* strings,
1046 const string16& title, 1045 const string16& title,
1047 const string16& headline, 1046 const string16& headline,
1048 const string16& description1, 1047 const string16& description1,
1049 const string16& description2, 1048 const string16& description2,
1050 const string16& description3, 1049 const string16& description3) {
1051 const string16& description4) {
1052 strings->SetString("title", title); 1050 strings->SetString("title", title);
1053 strings->SetString("headLine", headline); 1051 strings->SetString("headLine", headline);
1054 strings->SetString("description1", description1); 1052 strings->SetString("description1", description1);
1055 strings->SetString("description2", description2); 1053 strings->SetString("description2", description2);
1056 strings->SetString("description3", description3); 1054 strings->SetString("description3", description3);
1057 strings->SetString("description4", description4);
1058 strings->SetBoolean("proceedDisabled", 1055 strings->SetBoolean("proceedDisabled",
1059 IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)); 1056 IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled));
1057 strings->SetBoolean("isMainFrame", is_main_frame_load_blocked_);
1060 1058
1061 strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); 1059 strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr");
1062 strings->SetString("back_button", 1060 strings->SetString("back_button",
1063 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)); 1061 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
1064 strings->SetString("seeMore", l10n_util::GetStringUTF16( 1062 strings->SetString("seeMore", l10n_util::GetStringUTF16(
1065 IDS_SAFE_BROWSING_MALWARE_V2_SEE_MORE)); 1063 IDS_SAFE_BROWSING_MALWARE_V2_SEE_MORE));
1066 strings->SetString("seeLess", l10n_util::GetStringUTF16(
1067 IDS_SAFE_BROWSING_MALWARE_V2_SEE_LESS));
1068 } 1064 }
1069 1065
1070 void SafeBrowsingBlockingPageV2::PopulateMultipleThreatStringDictionary( 1066 void SafeBrowsingBlockingPageV2::PopulateMultipleThreatStringDictionary(
1071 DictionaryValue* strings) { 1067 DictionaryValue* strings) {
1072 NOTREACHED(); 1068 NOTREACHED();
1073 } 1069 }
1074 1070
1075 void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary( 1071 void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary(
1076 DictionaryValue* strings) { 1072 DictionaryValue* strings) {
1077 std::string diagnostic_link = base::StringPrintf(kSbDiagnosticHtml, 1073 std::string diagnostic_link = base::StringPrintf(kSbDiagnosticHtml,
1078 l10n_util::GetStringUTF8( 1074 l10n_util::GetStringUTF8(
1079 IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str()); 1075 IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str());
1080 1076
1081 // Check to see if we're blocking the main page, or a sub-resource on the 1077 // Check to see if we're blocking the main page, or a sub-resource on the
1082 // main page. 1078 // main page.
1083 string16 headline, description1, description2, description3, description4; 1079 string16 headline, description1, description2, description3;
1084 1080
1085 1081
1082 description3 = l10n_util::GetStringUTF16(
1083 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION3);
1086 if (is_main_frame_load_blocked_) { 1084 if (is_main_frame_load_blocked_) {
1087 headline = l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_HEADLINE); 1085 headline = l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_HEADLINE);
1088 description1 = l10n_util::GetStringFUTF16( 1086 description1 = l10n_util::GetStringFUTF16(
1089 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION1, 1087 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION1,
1090 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), 1088 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
1091 UTF8ToUTF16(url_.host())); 1089 UTF8ToUTF16(url_.host()));
1092 description2 = l10n_util::GetStringUTF16( 1090 description2 = l10n_util::GetStringUTF16(
1093 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION2); 1091 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION2);
1094 description3 = l10n_util::GetStringUTF16( 1092 strings->SetString("details", l10n_util::GetStringUTF16(
1095 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION3); 1093 IDS_SAFE_BROWSING_MALWARE_V2_DETAILS));
1096 description4 = l10n_util::GetStringUTF16(
1097 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION4);
1098 strings->SetBoolean(kDisplayShowDiagnostic, true);
1099 } else { 1094 } else {
1100 headline = l10n_util::GetStringUTF16( 1095 headline = l10n_util::GetStringUTF16(
1101 IDS_SAFE_BROWSING_MALWARE_V2_HEADLINE_SUBRESOURCE); 1096 IDS_SAFE_BROWSING_MALWARE_V2_HEADLINE_SUBRESOURCE);
1102 description1 = l10n_util::GetStringFUTF16( 1097 description1 = l10n_util::GetStringFUTF16(
1103 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION1_SUBRESOURCE, 1098 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION1_SUBRESOURCE,
1104 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), 1099 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
1105 UTF8ToUTF16(web_contents_->GetURL().host())); 1100 UTF8ToUTF16(web_contents_->GetURL().host()));
1106 description2 = l10n_util::GetStringUTF16( 1101 description2 = l10n_util::GetStringFUTF16(
1107 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION2_SUBRESOURCE); 1102 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION2_SUBRESOURCE,
1108 description3 = l10n_util::GetStringUTF16( 1103 UTF8ToUTF16(url_.host()));
1109 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION3_SUBRESOURCE); 1104 strings->SetString("details", l10n_util::GetStringFUTF16(
1110 description4 = l10n_util::GetStringFUTF16( 1105 IDS_SAFE_BROWSING_MALWARE_V2_DETAILS_SUBRESOURCE,
1111 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION4_SUBRESOURCE, 1106 UTF8ToUTF16(url_.host())));
1112 UTF8ToUTF16(url_.host()));
1113 strings->SetBoolean(kDisplayShowDiagnostic, false);
1114 } 1107 }
1115 1108
1116 PopulateStringDictionary( 1109 PopulateStringDictionary(
1117 strings, 1110 strings,
1118 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_TITLE), 1111 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_TITLE),
1119 headline, 1112 headline,
1120 description1, 1113 description1,
1121 description2, 1114 description2,
1122 description3, 1115 description3);
1123 description4);
1124 1116
1125 if (!CanShowMalwareDetailsOption()) { 1117 if (!CanShowMalwareDetailsOption()) {
1126 strings->SetBoolean(kDisplayCheckBox, false); 1118 strings->SetBoolean(kDisplayCheckBox, false);
1127 } else { 1119 } else {
1128 // Show the checkbox for sending malware details. 1120 // Show the checkbox for sending malware details.
1129 strings->SetBoolean(kDisplayCheckBox, true); 1121 strings->SetBoolean(kDisplayCheckBox, true);
1130 1122
1131 std::string privacy_link = base::StringPrintf( 1123 std::string privacy_link = base::StringPrintf(
1132 kPrivacyLinkHtml, 1124 kPrivacyLinkHtml,
1133 l10n_util::GetStringUTF8( 1125 l10n_util::GetStringUTF8(
1134 IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE_V2).c_str()); 1126 IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE_V2).c_str());
1135 1127
1136 strings->SetString("confirm_text", 1128 strings->SetString("confirm_text",
1137 l10n_util::GetStringFUTF16( 1129 l10n_util::GetStringFUTF16(
1138 IDS_SAFE_BROWSING_MALWARE_V2_REPORTING_AGREE, 1130 IDS_SAFE_BROWSING_MALWARE_V2_REPORTING_AGREE,
1139 UTF8ToUTF16(privacy_link))); 1131 UTF8ToUTF16(privacy_link)));
1140 if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled)) 1132 if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled))
1141 strings->SetString(kBoxChecked, "yes"); 1133 strings->SetString(kBoxChecked, "yes");
1142 else 1134 else
1143 strings->SetString(kBoxChecked, ""); 1135 strings->SetString(kBoxChecked, "");
1144 } 1136 }
1145 1137
1138 strings->SetString("proceed",
1139 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_PROCEED_LINK));
1146 strings->SetString("learnMore", 1140 strings->SetString("learnMore",
1147 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); 1141 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE));
1148 strings->SetString("details",
1149 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_DETAILS));
1150 } 1142 }
1151 1143
1152 void SafeBrowsingBlockingPageV2::PopulatePhishingStringDictionary( 1144 void SafeBrowsingBlockingPageV2::PopulatePhishingStringDictionary(
1153 DictionaryValue* strings) { 1145 DictionaryValue* strings) {
1154 NOTREACHED(); 1146 NOTREACHED();
1155 } 1147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698