Chromium Code Reviews| 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. | |
| 427 | |
|
felt
2014/11/04 21:59:08
nit: no need for this extra newline between the co
lgarron
2014/11/04 22:06:14
"No need" or "preferred"? (I like to keep my code
felt
2014/11/04 22:15:29
The style is to not have spaces between comments a
lgarron
2014/11/04 22:21:20
Has anyone thought about, y'know, putting this stu
| |
| 426 base::Time now = base::Time::NowFromSystemTime(); | 428 base::Time now = base::Time::NowFromSystemTime(); |
| 427 bool bad_clock = IsErrorDueToBadClock(now, cert_error_); | 429 bool bad_clock = IsErrorDueToBadClock(now, cert_error_); |
| 428 | 430 |
| 429 load_time_data.SetString("errorCode", net::ErrorToString(cert_error_)); | 431 load_time_data.SetString("errorCode", net::ErrorToString(cert_error_)); |
| 432 load_time_data.SetString( | |
|
felt
2014/11/04 21:59:08
these are indented too much
lgarron
2014/11/04 22:06:14
Yeah, the third patch took me a while to upload be
| |
| 433 "openDetails", | |
| 434 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); | |
| 435 load_time_data.SetString( | |
| 436 "closeDetails", | |
| 437 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); | |
| 438 | |
| 439 // Conditional UI configuration. | |
| 430 | 440 |
|
felt
2014/11/04 21:59:08
nit: no need for this extra newline between the co
| |
| 431 if (bad_clock) { | 441 if (bad_clock) { |
| 432 load_time_data.SetBoolean("bad_clock", true); | 442 load_time_data.SetBoolean("bad_clock", true); |
| 433 load_time_data.SetBoolean("overridable", false); | 443 load_time_data.SetBoolean("overridable", false); |
| 434 | 444 |
| 435 #if defined(OS_IOS) | 445 #if defined(OS_IOS) |
| 436 load_time_data.SetBoolean("hide_primary_button", true); | 446 load_time_data.SetBoolean("hide_primary_button", true); |
| 437 #else | 447 #else |
| 438 load_time_data.SetBoolean("hide_primary_button", false); | 448 load_time_data.SetBoolean("hide_primary_button", false); |
| 439 #endif | 449 #endif |
| 440 | 450 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 456 l10n_util::GetStringUTF16(heading_string)); | 466 l10n_util::GetStringUTF16(heading_string)); |
| 457 load_time_data.SetString("primaryParagraph", | 467 load_time_data.SetString("primaryParagraph", |
| 458 l10n_util::GetStringFUTF16( | 468 l10n_util::GetStringFUTF16( |
| 459 IDS_SSL_V2_CLOCK_PRIMARY_PARAGRAPH , | 469 IDS_SSL_V2_CLOCK_PRIMARY_PARAGRAPH , |
| 460 url, | 470 url, |
| 461 base::TimeFormatFriendlyDateAndTime(now))); | 471 base::TimeFormatFriendlyDateAndTime(now))); |
| 462 | 472 |
| 463 load_time_data.SetString( | 473 load_time_data.SetString( |
| 464 "primaryButtonText", | 474 "primaryButtonText", |
| 465 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOCK_UPDATE_DATE_AND_TIME)); | 475 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOCK_UPDATE_DATE_AND_TIME)); |
| 476 load_time_data.SetString( | |
| 477 "explanationParagraph", | |
| 478 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOCK_EXPLANATION)); | |
| 466 | 479 |
| 467 // We set the "Advanced" link to be empty so that it doesn't appear. | 480 // The interstitial template expects this string, but we're not using it. So |
| 468 load_time_data.SetString("openDetails", std::string()); | 481 // 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()); | 482 load_time_data.SetString("finalParagraph", std::string()); |
| 474 } else { | 483 } else { |
| 475 load_time_data.SetBoolean("bad_clock", false); | 484 load_time_data.SetBoolean("bad_clock", false); |
| 476 | 485 |
| 477 load_time_data.SetString( | 486 load_time_data.SetString( |
| 478 "tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); | 487 "tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); |
| 479 load_time_data.SetString( | 488 load_time_data.SetString( |
| 480 "heading", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING)); | 489 "heading", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING)); |
| 481 load_time_data.SetString( | 490 load_time_data.SetString( |
| 482 "primaryParagraph", | 491 "primaryParagraph", |
| 483 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url)); | 492 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 | 493 |
| 491 if (overridable_) { | 494 if (overridable_) { |
| 492 load_time_data.SetBoolean("overridable", true); | 495 load_time_data.SetBoolean("overridable", true); |
| 493 | 496 |
| 494 SSLErrorInfo error_info = | 497 SSLErrorInfo error_info = |
| 495 SSLErrorInfo::CreateError( | 498 SSLErrorInfo::CreateError( |
| 496 SSLErrorInfo::NetErrorToErrorType(cert_error_), | 499 SSLErrorInfo::NetErrorToErrorType(cert_error_), |
| 497 ssl_info_.cert.get(), | 500 ssl_info_.cert.get(), |
| 498 request_url_); | 501 request_url_); |
| 499 load_time_data.SetString("explanationParagraph", error_info.details()); | 502 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++) { | 708 for (; i < 5; i++) { |
| 706 strings->SetString(keys[i], std::string()); | 709 strings->SetString(keys[i], std::string()); |
| 707 } | 710 } |
| 708 } | 711 } |
| 709 | 712 |
| 710 void SSLBlockingPage::OnGotHistoryCount(bool success, | 713 void SSLBlockingPage::OnGotHistoryCount(bool success, |
| 711 int num_visits, | 714 int num_visits, |
| 712 base::Time first_visit) { | 715 base::Time first_visit) { |
| 713 num_visits_ = num_visits; | 716 num_visits_ = num_visits; |
| 714 } | 717 } |
| OLD | NEW |