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

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

Issue 445493002: Delete the Safe Browsing V2 interstitial and Finch trial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing binary files Created 6 years, 4 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 PHISHING_PROCEED_CROSS_SITE, 137 PHISHING_PROCEED_CROSS_SITE,
138 MAX_DETAILED_ACTION 138 MAX_DETAILED_ACTION
139 }; 139 };
140 140
141 void RecordDetailedUserAction(DetailedDecision decision) { 141 void RecordDetailedUserAction(DetailedDecision decision) {
142 UMA_HISTOGRAM_ENUMERATION("SB2.InterstitialActionDetails", 142 UMA_HISTOGRAM_ENUMERATION("SB2.InterstitialActionDetails",
143 decision, 143 decision,
144 MAX_DETAILED_ACTION); 144 MAX_DETAILED_ACTION);
145 } 145 }
146 146
147 // Constants for the M37 Finch trial.
148 const char kV3StudyName[] = "MalwareInterstitialVersion";
149 const char kCondV2[] = "V2";
150 const char kCondV3[] = "V3";
151 const char kCondV3Advice[] = "V3Advice";
152 const char kCondV3Social[] = "V3Social";
153 const char kCondV3NotRecommend[] = "V3NotRecommend";
154 const char kCondV3History[] = "V3History";
155
156 // Default to V3 unless a flag or field trial says otherwise. Flags override
157 // field trial settings.
158 const char* GetTrialCondition() {
159 if (CommandLine::ForCurrentProcess()->HasSwitch(
160 switches::kMalwareInterstitialV2)) {
161 return kCondV2;
162 }
163 if (CommandLine::ForCurrentProcess()->HasSwitch(
164 switches::kMalwareInterstitialV3)) {
165 return kCondV3;
166 }
167 if (CommandLine::ForCurrentProcess()->HasSwitch(
168 switches::kMalwareInterstitialV3Advice)) {
169 return kCondV3Advice;
170 }
171 if (CommandLine::ForCurrentProcess()->HasSwitch(
172 switches::kMalwareInterstitialV3Social)) {
173 return kCondV3Social;
174 }
175 if (CommandLine::ForCurrentProcess()->HasSwitch(
176 switches::kMalwareInterstitialV3NotRecommend)) {
177 return kCondV3NotRecommend;
178 }
179 if (CommandLine::ForCurrentProcess()->HasSwitch(
180 switches::kMalwareInterstitialV3History)) {
181 return kCondV3History;
182 }
183
184 // Make sure that the return value is one of the expected types instead of
185 // directly returning base::FieldTrialList::FindFullName.
186 if (base::FieldTrialList::FindFullName(kV3StudyName) == kCondV2)
187 return kCondV2;
188 if (base::FieldTrialList::FindFullName(kV3StudyName) == kCondV3)
189 return kCondV3;
190 if (base::FieldTrialList::FindFullName(kV3StudyName) == kCondV3Advice)
191 return kCondV3Advice;
192 if (base::FieldTrialList::FindFullName(kV3StudyName) == kCondV3Social)
193 return kCondV3Social;
194 if (base::FieldTrialList::FindFullName(kV3StudyName) == kCondV3NotRecommend)
195 return kCondV3NotRecommend;
196 if (base::FieldTrialList::FindFullName(kV3StudyName) == kCondV3History)
197 return kCondV3History;
198 return kCondV3;
199 }
200
201 } // namespace 147 } // namespace
202 148
203 // static 149 // static
204 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; 150 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL;
205 151
206 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we 152 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we
207 // don't leak it. 153 // don't leak it.
208 class SafeBrowsingBlockingPageFactoryImpl 154 class SafeBrowsingBlockingPageFactoryImpl
209 : public SafeBrowsingBlockingPageFactory { 155 : public SafeBrowsingBlockingPageFactory {
210 public: 156 public:
211 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( 157 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
212 SafeBrowsingUIManager* ui_manager, 158 SafeBrowsingUIManager* ui_manager,
213 WebContents* web_contents, 159 WebContents* web_contents,
214 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) 160 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources)
215 OVERRIDE { 161 OVERRIDE {
216 // Only use the V2 page if the interstitial is for a single malware or 162 return new SafeBrowsingBlockingPage(ui_manager, web_contents,
217 // phishing resource.
218 if ((GetTrialCondition() == kCondV2) && (unsafe_resources.size() == 1) &&
219 (unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE ||
220 unsafe_resources[0].threat_type ==
221 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL ||
222 unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_PHISHING ||
223 unsafe_resources[0].threat_type ==
224 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL)) {
225 return new SafeBrowsingBlockingPageV2(ui_manager, web_contents,
226 unsafe_resources);
227 }
228 return new SafeBrowsingBlockingPageV3(ui_manager, web_contents,
229 unsafe_resources); 163 unsafe_resources);
230 } 164 }
231 165
232 private: 166 private:
233 friend struct base::DefaultLazyInstanceTraits< 167 friend struct base::DefaultLazyInstanceTraits<
234 SafeBrowsingBlockingPageFactoryImpl>; 168 SafeBrowsingBlockingPageFactoryImpl>;
235 169
236 SafeBrowsingBlockingPageFactoryImpl() { } 170 SafeBrowsingBlockingPageFactoryImpl() { }
237 171
238 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageFactoryImpl); 172 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageFactoryImpl);
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 // load, since they happen after the page is finished loading. 857 // load, since they happen after the page is finished loading.
924 if (unsafe_resources[0].threat_type == 858 if (unsafe_resources[0].threat_type ==
925 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) { 859 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) {
926 return false; 860 return false;
927 } 861 }
928 862
929 // Otherwise, check the threat type. 863 // Otherwise, check the threat type.
930 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; 864 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource;
931 } 865 }
932 866
933 SafeBrowsingBlockingPageV2::SafeBrowsingBlockingPageV2( 867 std::string SafeBrowsingBlockingPage::GetHTMLContents() {
934 SafeBrowsingUIManager* ui_manager,
935 WebContents* web_contents,
936 const UnsafeResourceList& unsafe_resources)
937 : SafeBrowsingBlockingPage(ui_manager, web_contents, unsafe_resources) {
938 }
939
940 std::string SafeBrowsingBlockingPageV2::GetHTMLContents() {
941 // Load the HTML page and create the template components.
942 base::DictionaryValue strings;
943 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
944 std::string html;
945
946 if (unsafe_resources_.empty()) {
947 NOTREACHED();
948 return std::string();
949 }
950
951 if (unsafe_resources_.size() > 1) {
952 NOTREACHED();
953 } else {
954 SBThreatType threat_type = unsafe_resources_[0].threat_type;
955 if (threat_type == SB_THREAT_TYPE_URL_MALWARE ||
956 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL) {
957 PopulateMalwareStringDictionary(&strings);
958 } else { // Phishing.
959 DCHECK(threat_type == SB_THREAT_TYPE_URL_PHISHING ||
960 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL);
961 PopulatePhishingStringDictionary(&strings);
962 }
963 html = rb.GetRawDataResource(IDR_SAFE_BROWSING_MALWARE_BLOCK_V2).
964 as_string();
965 }
966 interstitial_show_time_ = base::TimeTicks::Now();
967 return webui::GetTemplatesHtml(html, &strings, "template-root");
968 }
969
970 void SafeBrowsingBlockingPageV2::PopulateStringDictionary(
971 base::DictionaryValue* strings,
972 const base::string16& title,
973 const base::string16& headline,
974 const base::string16& description1,
975 const base::string16& description2,
976 const base::string16& description3) {
977 strings->SetString("title", title);
978 strings->SetString("headLine", headline);
979 strings->SetString("description1", description1);
980 strings->SetString("description2", description2);
981 strings->SetString("description3", description3);
982 strings->SetBoolean("proceedDisabled",
983 IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled));
984 strings->SetBoolean("isMainFrame", is_main_frame_load_blocked_);
985 strings->SetBoolean("isPhishing", interstitial_type_ == TYPE_PHISHING);
986
987 strings->SetString("back_button",
988 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
989 strings->SetString("seeMore", l10n_util::GetStringUTF16(
990 IDS_SAFE_BROWSING_MALWARE_V2_SEE_MORE));
991 strings->SetString("proceed",
992 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_PROCEED_LINK));
993 webui::SetFontAndTextDirection(strings);
994 }
995
996 void SafeBrowsingBlockingPageV2::PopulateMultipleThreatStringDictionary(
997 base::DictionaryValue* strings) {
998 NOTREACHED();
999 }
1000
1001 void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary(
1002 base::DictionaryValue* strings) {
1003 // Check to see if we're blocking the main page, or a sub-resource on the
1004 // main page.
1005 base::string16 headline, description1, description2, description3;
1006
1007
1008 description3 = l10n_util::GetStringUTF16(
1009 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION3);
1010 if (is_main_frame_load_blocked_) {
1011 headline = l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_HEADLINE);
1012 description1 = l10n_util::GetStringFUTF16(
1013 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION1,
1014 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
1015 base::UTF8ToUTF16(url_.host()));
1016 description2 = l10n_util::GetStringUTF16(
1017 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION2);
1018 strings->SetString("details", l10n_util::GetStringUTF16(
1019 IDS_SAFE_BROWSING_MALWARE_V2_DETAILS));
1020 } else {
1021 headline = l10n_util::GetStringUTF16(
1022 IDS_SAFE_BROWSING_MALWARE_V2_HEADLINE_SUBRESOURCE);
1023 description1 = l10n_util::GetStringFUTF16(
1024 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION1_SUBRESOURCE,
1025 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
1026 base::UTF8ToUTF16(web_contents_->GetURL().host()));
1027 description2 = l10n_util::GetStringFUTF16(
1028 IDS_SAFE_BROWSING_MALWARE_V2_DESCRIPTION2_SUBRESOURCE,
1029 base::UTF8ToUTF16(url_.host()));
1030 strings->SetString("details", l10n_util::GetStringFUTF16(
1031 IDS_SAFE_BROWSING_MALWARE_V2_DETAILS_SUBRESOURCE,
1032 base::UTF8ToUTF16(url_.host())));
1033 }
1034
1035 PopulateStringDictionary(
1036 strings,
1037 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_TITLE),
1038 headline,
1039 description1,
1040 description2,
1041 description3);
1042
1043 if (!CanShowMalwareDetailsOption()) {
1044 strings->SetBoolean(kDisplayCheckBox, false);
1045 strings->SetString("confirm_text", std::string());
1046 strings->SetString(kBoxChecked, std::string());
1047 } else {
1048 // Show the checkbox for sending malware details.
1049 strings->SetBoolean(kDisplayCheckBox, true);
1050
1051 std::string privacy_link = base::StringPrintf(
1052 kPrivacyLinkHtml,
1053 l10n_util::GetStringUTF8(
1054 IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE_V2).c_str());
1055
1056 strings->SetString("confirm_text",
1057 l10n_util::GetStringFUTF16(
1058 IDS_SAFE_BROWSING_MALWARE_V2_REPORTING_AGREE,
1059 base::UTF8ToUTF16(privacy_link)));
1060 Profile* profile = Profile::FromBrowserContext(
1061 web_contents_->GetBrowserContext());
1062 if (profile->GetPrefs()->HasPrefPath(
1063 prefs::kSafeBrowsingExtendedReportingEnabled)) {
1064 reporting_checkbox_checked_ =
1065 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled);
1066 } else if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled) ||
1067 IsPrefEnabled(prefs::kSafeBrowsingDownloadFeedbackEnabled)) {
1068 reporting_checkbox_checked_ = true;
1069 }
1070 strings->SetString(kBoxChecked,
1071 reporting_checkbox_checked_ ? "yes" : std::string());
1072 }
1073
1074 strings->SetString("report_error", base::string16());
1075 strings->SetString("learnMore",
1076 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE));
1077 }
1078
1079 void SafeBrowsingBlockingPageV2::PopulatePhishingStringDictionary(
1080 base::DictionaryValue* strings) {
1081 PopulateStringDictionary(
1082 strings,
1083 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_TITLE),
1084 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_HEADLINE),
1085 l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_PHISHING_V2_DESCRIPTION1,
1086 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
1087 base::UTF8ToUTF16(url_.host())),
1088 base::string16(),
1089 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_DESCRIPTION2));
1090
1091 strings->SetString("details", std::string());
1092 strings->SetString("confirm_text", std::string());
1093 strings->SetString(kBoxChecked, std::string());
1094 strings->SetString(
1095 "report_error",
1096 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR));
1097 strings->SetBoolean(kDisplayCheckBox, false);
1098 strings->SetString("learnMore",
1099 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE));
1100 }
1101
1102 SafeBrowsingBlockingPageV3::SafeBrowsingBlockingPageV3(
1103 SafeBrowsingUIManager* ui_manager,
1104 WebContents* web_contents,
1105 const UnsafeResourceList& unsafe_resources)
1106 : SafeBrowsingBlockingPage(ui_manager, web_contents, unsafe_resources),
1107 trial_condition_(GetTrialCondition()) {
1108 }
1109
1110 std::string SafeBrowsingBlockingPageV3::GetHTMLContents() {
1111 DCHECK(!unsafe_resources_.empty()); 868 DCHECK(!unsafe_resources_.empty());
1112 869
1113 // Fill in the shared values. 870 // Fill in the shared values.
1114 base::DictionaryValue load_time_data; 871 base::DictionaryValue load_time_data;
1115 webui::SetFontAndTextDirection(&load_time_data); 872 webui::SetFontAndTextDirection(&load_time_data);
1116 load_time_data.SetBoolean("ssl", false); 873 load_time_data.SetBoolean("ssl", false);
1117 load_time_data.SetString( 874 load_time_data.SetString(
1118 "tabTitle", l10n_util::GetStringUTF16(IDS_SAFEBROWSING_V3_TITLE)); 875 "tabTitle", l10n_util::GetStringUTF16(IDS_SAFEBROWSING_V3_TITLE));
1119 load_time_data.SetString( 876 load_time_data.SetString(
1120 "openDetails", 877 "openDetails",
(...skipping 15 matching lines...) Expand all
1136 893
1137 interstitial_show_time_ = base::TimeTicks::Now(); 894 interstitial_show_time_ = base::TimeTicks::Now();
1138 895
1139 base::StringPiece html( 896 base::StringPiece html(
1140 ResourceBundle::GetSharedInstance().GetRawDataResource( 897 ResourceBundle::GetSharedInstance().GetRawDataResource(
1141 IRD_SSL_INTERSTITIAL_V2_HTML)); 898 IRD_SSL_INTERSTITIAL_V2_HTML));
1142 webui::UseVersion2 version; 899 webui::UseVersion2 version;
1143 return webui::GetI18nTemplateHtml(html, &load_time_data); 900 return webui::GetI18nTemplateHtml(html, &load_time_data);
1144 } 901 }
1145 902
1146 void SafeBrowsingBlockingPageV3::PopulateMalwareLoadTimeData( 903 void SafeBrowsingBlockingPage::PopulateMalwareLoadTimeData(
1147 base::DictionaryValue* load_time_data) { 904 base::DictionaryValue* load_time_data) {
1148 load_time_data->SetString("trialCondition", trial_condition_);
1149 load_time_data->SetBoolean("phishing", false); 905 load_time_data->SetBoolean("phishing", false);
1150 load_time_data->SetString( 906 load_time_data->SetString(
1151 "heading", l10n_util::GetStringUTF16(IDS_MALWARE_V3_HEADING)); 907 "heading", l10n_util::GetStringUTF16(IDS_MALWARE_V3_HEADING));
1152 load_time_data->SetString( 908 load_time_data->SetString(
1153 "primaryParagraph", 909 "primaryParagraph",
1154 l10n_util::GetStringFUTF16( 910 l10n_util::GetStringFUTF16(
1155 IDS_MALWARE_V3_PRIMARY_PARAGRAPH, 911 IDS_MALWARE_V3_PRIMARY_PARAGRAPH,
1156 base::UTF8ToUTF16(url_.host()))); 912 base::UTF8ToUTF16(url_.host())));
1157 if (trial_condition_ == kCondV3History) { 913 load_time_data->SetString(
1158 load_time_data->SetString( 914 "explanationParagraph",
1159 "explanationParagraph", 915 is_main_frame_load_blocked_ ?
1160 is_main_frame_load_blocked_ ? 916 l10n_util::GetStringFUTF16(
1161 l10n_util::GetStringFUTF16( 917 IDS_MALWARE_V3_EXPLANATION_PARAGRAPH,
1162 IDS_MALWARE_V3_EXPLANATION_PARAGRAPH_HISTORY, 918 base::UTF8ToUTF16(url_.host())) :
1163 base::UTF8ToUTF16(url_.host())) : 919 l10n_util::GetStringFUTF16(
1164 l10n_util::GetStringFUTF16( 920 IDS_MALWARE_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE,
1165 IDS_MALWARE_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE_HISTORY, 921 base::UTF8ToUTF16(web_contents_->GetURL().host()),
1166 base::UTF8ToUTF16(web_contents_->GetURL().host()), 922 base::UTF8ToUTF16(url_.host())));
1167 base::UTF8ToUTF16(url_.host()))); 923 load_time_data->SetString(
1168 } else if (trial_condition_ == kCondV3Advice) { 924 "finalParagraph",
1169 load_time_data->SetString( 925 l10n_util::GetStringUTF16(IDS_MALWARE_V3_PROCEED_PARAGRAPH));
1170 "explanationParagraph",
1171 is_main_frame_load_blocked_ ?
1172 l10n_util::GetStringFUTF16(
1173 IDS_MALWARE_V3_EXPLANATION_PARAGRAPH_ADVICE,
1174 base::UTF8ToUTF16(url_.host())) :
1175 l10n_util::GetStringFUTF16(
1176 IDS_MALWARE_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE_ADVICE,
1177 base::UTF8ToUTF16(web_contents_->GetURL().host()),
1178 base::UTF8ToUTF16(url_.host())));
1179 load_time_data->SetString(
1180 "adviceHeading",
1181 l10n_util::GetStringUTF16(IDS_MALWARE_V3_ADVICE_HEADING));
1182 } else {
1183 load_time_data->SetString(
1184 "explanationParagraph",
1185 is_main_frame_load_blocked_ ?
1186 l10n_util::GetStringFUTF16(
1187 IDS_MALWARE_V3_EXPLANATION_PARAGRAPH,
1188 base::UTF8ToUTF16(url_.host())) :
1189 l10n_util::GetStringFUTF16(
1190 IDS_MALWARE_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE,
1191 base::UTF8ToUTF16(web_contents_->GetURL().host()),
1192 base::UTF8ToUTF16(url_.host())));
1193 }
1194 if (trial_condition_ == kCondV3Social) {
1195 load_time_data->SetString(
1196 "finalParagraph",
1197 l10n_util::GetStringUTF16(IDS_MALWARE_V3_PROCEED_PARAGRAPH_SOCIAL));
1198 } else if (trial_condition_ == kCondV3NotRecommend) {
1199 load_time_data->SetString(
1200 "finalParagraph",
1201 l10n_util::GetStringUTF16(
1202 IDS_MALWARE_V3_PROCEED_PARAGRAPH_NOT_RECOMMEND));
1203 } else {
1204 load_time_data->SetString(
1205 "finalParagraph",
1206 l10n_util::GetStringUTF16(IDS_MALWARE_V3_PROCEED_PARAGRAPH));
1207 }
1208 926
1209 load_time_data->SetBoolean(kDisplayCheckBox, CanShowMalwareDetailsOption()); 927 load_time_data->SetBoolean(kDisplayCheckBox, CanShowMalwareDetailsOption());
1210 if (CanShowMalwareDetailsOption()) { 928 if (CanShowMalwareDetailsOption()) {
1211 std::string privacy_link = base::StringPrintf( 929 std::string privacy_link = base::StringPrintf(
1212 kPrivacyLinkHtml, 930 kPrivacyLinkHtml,
1213 l10n_util::GetStringUTF8( 931 l10n_util::GetStringUTF8(
1214 IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE_V2).c_str()); 932 IDS_SAFE_BROWSING_PRIVACY_POLICY_PAGE).c_str());
1215 load_time_data->SetString( 933 load_time_data->SetString(
1216 "optInLink", 934 "optInLink",
1217 l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MALWARE_V2_REPORTING_AGREE, 935 l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE,
1218 base::UTF8ToUTF16(privacy_link))); 936 base::UTF8ToUTF16(privacy_link)));
1219 Profile* profile = Profile::FromBrowserContext( 937 Profile* profile = Profile::FromBrowserContext(
1220 web_contents_->GetBrowserContext()); 938 web_contents_->GetBrowserContext());
1221 if (profile->GetPrefs()->HasPrefPath( 939 if (profile->GetPrefs()->HasPrefPath(
1222 prefs::kSafeBrowsingExtendedReportingEnabled)) { 940 prefs::kSafeBrowsingExtendedReportingEnabled)) {
1223 reporting_checkbox_checked_ = 941 reporting_checkbox_checked_ =
1224 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled); 942 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled);
1225 } else if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled) || 943 } else if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled) ||
1226 IsPrefEnabled(prefs::kSafeBrowsingDownloadFeedbackEnabled)) { 944 IsPrefEnabled(prefs::kSafeBrowsingDownloadFeedbackEnabled)) {
1227 reporting_checkbox_checked_ = true; 945 reporting_checkbox_checked_ = true;
1228 } 946 }
1229 load_time_data->SetBoolean( 947 load_time_data->SetBoolean(
1230 kBoxChecked, reporting_checkbox_checked_); 948 kBoxChecked, reporting_checkbox_checked_);
1231 } 949 }
1232 } 950 }
1233 951
1234 void SafeBrowsingBlockingPageV3::PopulatePhishingLoadTimeData( 952 void SafeBrowsingBlockingPage::PopulatePhishingLoadTimeData(
1235 base::DictionaryValue* load_time_data) { 953 base::DictionaryValue* load_time_data) {
1236 load_time_data->SetString("trialCondition", std::string());
1237 load_time_data->SetBoolean("phishing", true); 954 load_time_data->SetBoolean("phishing", true);
1238 load_time_data->SetString( 955 load_time_data->SetString(
1239 "heading", 956 "heading",
1240 l10n_util::GetStringUTF16(IDS_PHISHING_V3_HEADING)); 957 l10n_util::GetStringUTF16(IDS_PHISHING_V3_HEADING));
1241 load_time_data->SetString( 958 load_time_data->SetString(
1242 "primaryParagraph", 959 "primaryParagraph",
1243 l10n_util::GetStringFUTF16( 960 l10n_util::GetStringFUTF16(
1244 IDS_PHISHING_V3_PRIMARY_PARAGRAPH, 961 IDS_PHISHING_V3_PRIMARY_PARAGRAPH,
1245 base::UTF8ToUTF16(url_.host()))); 962 base::UTF8ToUTF16(url_.host())));
1246 load_time_data->SetString( 963 load_time_data->SetString(
1247 "explanationParagraph", 964 "explanationParagraph",
1248 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH, 965 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH,
1249 base::UTF8ToUTF16(url_.host()))); 966 base::UTF8ToUTF16(url_.host())));
1250 load_time_data->SetString( 967 load_time_data->SetString(
1251 "finalParagraph", 968 "finalParagraph",
1252 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); 969 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH));
1253 } 970 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698