OLD | NEW |
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 #include "chrome/browser/ssl/ssl_blocking_page.h" | 5 #include "chrome/browser/ssl/ssl_blocking_page.h" |
6 | 6 |
7 #include "base/build_time.h" | 7 #include "base/build_time.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 416 |
417 std::string SSLBlockingPage::GetHTMLContents() { | 417 std::string SSLBlockingPage::GetHTMLContents() { |
418 base::DictionaryValue load_time_data; | 418 base::DictionaryValue load_time_data; |
419 base::string16 url(ASCIIToUTF16(request_url_.host())); | 419 base::string16 url(ASCIIToUTF16(request_url_.host())); |
420 if (base::i18n::IsRTL()) | 420 if (base::i18n::IsRTL()) |
421 base::i18n::WrapStringWithLTRFormatting(&url); | 421 base::i18n::WrapStringWithLTRFormatting(&url); |
422 webui::SetFontAndTextDirection(&load_time_data); | 422 webui::SetFontAndTextDirection(&load_time_data); |
423 | 423 |
424 load_time_data.SetString("type", "SSL"); | 424 load_time_data.SetString("type", "SSL"); |
425 | 425 |
| 426 // Shared UI configuration for all SSL interstitials. |
426 base::Time now = base::Time::NowFromSystemTime(); | 427 base::Time now = base::Time::NowFromSystemTime(); |
427 bool bad_clock = IsErrorDueToBadClock(now, cert_error_); | 428 bool bad_clock = IsErrorDueToBadClock(now, cert_error_); |
428 | 429 |
429 load_time_data.SetString("errorCode", net::ErrorToString(cert_error_)); | 430 load_time_data.SetString("errorCode", net::ErrorToString(cert_error_)); |
| 431 load_time_data.SetString( |
| 432 "openDetails", |
| 433 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); |
| 434 load_time_data.SetString( |
| 435 "closeDetails", |
| 436 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); |
430 | 437 |
| 438 // Conditional UI configuration. |
431 if (bad_clock) { | 439 if (bad_clock) { |
432 load_time_data.SetBoolean("bad_clock", true); | 440 load_time_data.SetBoolean("bad_clock", true); |
433 load_time_data.SetBoolean("overridable", false); | 441 load_time_data.SetBoolean("overridable", false); |
434 | 442 |
435 #if defined(OS_IOS) | 443 #if defined(OS_IOS) |
436 load_time_data.SetBoolean("hide_primary_button", true); | 444 load_time_data.SetBoolean("hide_primary_button", true); |
437 #else | 445 #else |
438 load_time_data.SetBoolean("hide_primary_button", false); | 446 load_time_data.SetBoolean("hide_primary_button", false); |
439 #endif | 447 #endif |
440 | 448 |
(...skipping 15 matching lines...) Expand all Loading... |
456 l10n_util::GetStringUTF16(heading_string)); | 464 l10n_util::GetStringUTF16(heading_string)); |
457 load_time_data.SetString("primaryParagraph", | 465 load_time_data.SetString("primaryParagraph", |
458 l10n_util::GetStringFUTF16( | 466 l10n_util::GetStringFUTF16( |
459 IDS_SSL_V2_CLOCK_PRIMARY_PARAGRAPH , | 467 IDS_SSL_V2_CLOCK_PRIMARY_PARAGRAPH , |
460 url, | 468 url, |
461 base::TimeFormatFriendlyDateAndTime(now))); | 469 base::TimeFormatFriendlyDateAndTime(now))); |
462 | 470 |
463 load_time_data.SetString( | 471 load_time_data.SetString( |
464 "primaryButtonText", | 472 "primaryButtonText", |
465 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOCK_UPDATE_DATE_AND_TIME)); | 473 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOCK_UPDATE_DATE_AND_TIME)); |
| 474 load_time_data.SetString( |
| 475 "explanationParagraph", |
| 476 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOCK_EXPLANATION)); |
466 | 477 |
467 // We set the "Advanced" link to be empty so that it doesn't appear. | 478 // The interstitial template expects this string, but we're not using it. So |
468 load_time_data.SetString("openDetails", std::string()); | 479 // we send a blank string for now. |
469 | |
470 // The interstitial template expects these strings, but we're not using | |
471 // them. So we send blank strings for now. | |
472 load_time_data.SetString("explanationParagraph", std::string()); | |
473 load_time_data.SetString("finalParagraph", std::string()); | 480 load_time_data.SetString("finalParagraph", std::string()); |
474 } else { | 481 } else { |
475 load_time_data.SetBoolean("bad_clock", false); | 482 load_time_data.SetBoolean("bad_clock", false); |
476 | 483 |
477 load_time_data.SetString( | 484 load_time_data.SetString( |
478 "tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); | 485 "tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); |
479 load_time_data.SetString( | 486 load_time_data.SetString( |
480 "heading", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING)); | 487 "heading", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING)); |
481 load_time_data.SetString( | 488 load_time_data.SetString( |
482 "primaryParagraph", | 489 "primaryParagraph", |
483 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url)); | 490 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url)); |
484 load_time_data.SetString( | |
485 "openDetails", | |
486 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); | |
487 load_time_data.SetString( | |
488 "closeDetails", | |
489 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); | |
490 | 491 |
491 if (overridable_) { | 492 if (overridable_) { |
492 load_time_data.SetBoolean("overridable", true); | 493 load_time_data.SetBoolean("overridable", true); |
493 | 494 |
494 SSLErrorInfo error_info = | 495 SSLErrorInfo error_info = |
495 SSLErrorInfo::CreateError( | 496 SSLErrorInfo::CreateError( |
496 SSLErrorInfo::NetErrorToErrorType(cert_error_), | 497 SSLErrorInfo::NetErrorToErrorType(cert_error_), |
497 ssl_info_.cert.get(), | 498 ssl_info_.cert.get(), |
498 request_url_); | 499 request_url_); |
499 load_time_data.SetString("explanationParagraph", error_info.details()); | 500 load_time_data.SetString("explanationParagraph", error_info.details()); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 for (; i < 5; i++) { | 706 for (; i < 5; i++) { |
706 strings->SetString(keys[i], std::string()); | 707 strings->SetString(keys[i], std::string()); |
707 } | 708 } |
708 } | 709 } |
709 | 710 |
710 void SSLBlockingPage::OnGotHistoryCount(bool success, | 711 void SSLBlockingPage::OnGotHistoryCount(bool success, |
711 int num_visits, | 712 int num_visits, |
712 base::Time first_visit) { | 713 base::Time first_visit) { |
713 num_visits_ = num_visits; | 714 num_visits_ = num_visits; |
714 } | 715 } |
OLD | NEW |