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

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

Issue 4175003: Re-design the malware interstitial page. The change is mostly about: make the... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
« no previous file with comments | « chrome/browser/resources/safe_browsing_malware_block.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 26 matching lines...) Expand all
37 static const char* const kSbDiagnosticUrl = 37 static const char* const kSbDiagnosticUrl =
38 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=googlechrome"; 38 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=googlechrome";
39 #else 39 #else
40 static const char* const kSbDiagnosticUrl = 40 static const char* const kSbDiagnosticUrl =
41 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=chromium"; 41 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=chromium";
42 #endif 42 #endif
43 43
44 static const char* const kSbReportPhishingUrl = 44 static const char* const kSbReportPhishingUrl =
45 "http://www.google.com/safebrowsing/report_error/"; 45 "http://www.google.com/safebrowsing/report_error/";
46 46
47 // URL for the "Learn more" link on the malware blocking page. 47 // URL for the "Learn more" link on the multi threat malware blocking page.
48 static const char* const kLearnMoreMalwareUrl = 48 static const char* const kLearnMoreMalwareUrl =
49 "http://www.google.com/support/bin/answer.py?answer=45449&topic=360" 49 "http://www.google.com/support/bin/answer.py?answer=45449&topic=360"
50 "&sa=X&oi=malwarewarninglink&resnum=1&ct=help"; 50 "&sa=X&oi=malwarewarninglink&resnum=1&ct=help";
51 51
52 // URL for the "Learn more" link on the phishing blocking page. 52 // URL for the "Learn more" link on the phishing blocking page.
53 static const char* const kLearnMorePhishingUrl = 53 static const char* const kLearnMorePhishingUrl =
54 "http://www.google.com/support/bin/answer.py?answer=106318"; 54 "http://www.google.com/support/bin/answer.py?answer=106318";
55 55
56 static const wchar_t* const kSbDiagnosticHtml = 56 static const wchar_t* const kSbDiagnosticHtml =
57 L"<a href=\"\" onClick=\"sendCommand('showDiagnostic'); return false;\" " 57 L"<a href=\"\" onclick=\"sendCommand('showDiagnostic'); return false;\" "
58 L"onMouseDown=\"return false;\">%ls</a>"; 58 L"onmousedown=\"return false;\">%ls</a>";
59
60 static const wchar_t* const kPLinkHtml =
61 L"<a href=\"\" onclick=\"sendCommand('proceed'); return false;\" "
62 L"onmousedown=\"return false;\">%ls</a>";
59 63
60 // The commands returned by the page when the user performs an action. 64 // The commands returned by the page when the user performs an action.
61 static const char* const kShowDiagnosticCommand = "showDiagnostic"; 65 static const char* const kShowDiagnosticCommand = "showDiagnostic";
62 static const char* const kReportErrorCommand = "reportError"; 66 static const char* const kReportErrorCommand = "reportError";
63 static const char* const kLearnMoreCommand = "learnMore"; 67 static const char* const kLearnMoreCommand = "learnMore";
64 static const char* const kProceedCommand = "proceed"; 68 static const char* const kProceedCommand = "proceed";
65 static const char* const kTakeMeBackCommand = "takeMeBack"; 69 static const char* const kTakeMeBackCommand = "takeMeBack";
66 70
67 // static 71 // static
68 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; 72 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 L""); 206 L"");
203 } else if (malware) { 207 } else if (malware) {
204 // Just malware. 208 // Just malware.
205 PopulateStringDictionary( 209 PopulateStringDictionary(
206 strings, 210 strings,
207 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_TITLE), 211 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_TITLE),
208 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_HEADLINE), 212 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_HEADLINE),
209 l10n_util::GetStringF(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION1, 213 l10n_util::GetStringF(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION1,
210 UTF8ToWide(tab()->GetURL().host())), 214 UTF8ToWide(tab()->GetURL().host())),
211 l10n_util::GetString(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION2), 215 l10n_util::GetString(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION2),
212 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION3)); 216 l10n_util::GetString(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION3));
213 } else { 217 } else {
214 // Just phishing. 218 // Just phishing.
215 PopulateStringDictionary( 219 PopulateStringDictionary(
216 strings, 220 strings,
217 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE), 221 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE),
218 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_HEADLINE), 222 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_HEADLINE),
219 l10n_util::GetStringF(IDS_SAFE_BROWSING_MULTI_PHISHING_DESCRIPTION1, 223 l10n_util::GetStringF(IDS_SAFE_BROWSING_MULTI_PHISHING_DESCRIPTION1,
220 UTF8ToWide(tab()->GetURL().host())), 224 UTF8ToWide(tab()->GetURL().host())),
221 L"", L""); 225 L"", L"");
222 } 226 }
223 227
224 strings->SetString("confirm_text", 228 strings->SetString("confirm_text",
225 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE)); 229 l10n_util::GetStringUTF16(
230 IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION_AGREE));
226 strings->SetString("continue_button", 231 strings->SetString("continue_button",
227 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON)); 232 l10n_util::GetStringUTF16(
233 IDS_SAFE_BROWSING_MULTI_MALWARE_PROCEED_BUTTON));
228 strings->SetString("back_button", 234 strings->SetString("back_button",
229 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)); 235 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
230 strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); 236 strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr");
231 } 237 }
232 238
233 void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary( 239 void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
234 DictionaryValue* strings) { 240 DictionaryValue* strings) {
235 std::wstring link = StringPrintf(kSbDiagnosticHtml, 241 std::wstring diagnostic_link = StringPrintf(kSbDiagnosticHtml,
236 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str()); 242 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str());
237 243
238 strings->SetString("badURL", url().host()); 244 strings->SetString("badURL", url().host());
239 // Check to see if we're blocking the main page, or a sub-resource on the 245 // Check to see if we're blocking the main page, or a sub-resource on the
240 // main page. 246 // main page.
241 std::wstring description1, description2; 247 std::wstring description1, description3, description5;
242 if (is_main_frame_) { 248 if (is_main_frame_) {
243 description1 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION1, 249 description1 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION1,
244 UTF8ToWide(url().host())); 250 UTF8ToWide(url().host()));
245 description2 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION2,
246 link,
247 UTF8ToWide(url().host()));
248 } else { 251 } else {
249 description1 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION4, 252 description1 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION4,
250 UTF8ToWide(tab()->GetURL().host()), 253 UTF8ToWide(tab()->GetURL().host()),
251 UTF8ToWide(url().host())); 254 UTF8ToWide(url().host()));
252 description2 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION5,
253 link,
254 UTF8ToWide(url().host()));
255 } 255 }
256 256
257 std::wstring proceed_link = StringPrintf(kPLinkHtml,
258 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_LINK).c_str());
259 description3 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION3,
260 proceed_link);
261
257 PopulateStringDictionary( 262 PopulateStringDictionary(
258 strings, 263 strings,
259 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_TITLE), 264 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_TITLE),
260 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_HEADLINE), 265 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_HEADLINE),
261 description1, description2, 266 description1,
262 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION3)); 267 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION2),
268 description3);
263 269
264 strings->SetString("confirm_text", 270 description5 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION5,
265 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE)); 271 UTF8ToWide(url().host()),
266 strings->SetString("continue_button", 272 UTF8ToWide(url().host()),
267 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON)); 273 diagnostic_link);
274
275 strings->SetString("description5", WideToUTF16Hack(description5));
276
268 strings->SetString("back_button", 277 strings->SetString("back_button",
269 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)); 278 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
279 strings->SetString("more_info_button",
280 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_MORE_INFO_BUTTON));
281 strings->SetString("less_info_button",
282 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_LESS_INFO_BUTTON));
283 strings->SetString("proceed_link",
284 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_PROCEED_LINK));
270 strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); 285 strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr");
271 } 286 }
272 287
273 void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary( 288 void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary(
274 DictionaryValue* strings) { 289 DictionaryValue* strings) {
275 PopulateStringDictionary( 290 PopulateStringDictionary(
276 strings, 291 strings,
277 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE), 292 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE),
278 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_HEADLINE), 293 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_HEADLINE),
279 l10n_util::GetStringF(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION1, 294 l10n_util::GetStringF(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION1,
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); 547 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap();
533 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); 548 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource);
534 } 549 }
535 550
536 // static 551 // static
537 bool SafeBrowsingBlockingPage::IsMainPage( 552 bool SafeBrowsingBlockingPage::IsMainPage(
538 const UnsafeResourceList& unsafe_resources) { 553 const UnsafeResourceList& unsafe_resources) {
539 return unsafe_resources.size() == 1 && 554 return unsafe_resources.size() == 1 &&
540 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; 555 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME;
541 } 556 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/safe_browsing_malware_block.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698