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

Side by Side Diff: chrome/browser/ssl/ssl_blocking_page.cc

Issue 336273002: Suggest upgrading to SP3 or later for invalid certificate errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed complilation errors Created 6 years, 5 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
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 #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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "ui/base/l10n/l10n_util.h" 43 #include "ui/base/l10n/l10n_util.h"
44 #include "ui/base/resource/resource_bundle.h" 44 #include "ui/base/resource/resource_bundle.h"
45 #include "ui/base/webui/jstemplate_builder.h" 45 #include "ui/base/webui/jstemplate_builder.h"
46 #include "ui/base/webui/web_ui_util.h" 46 #include "ui/base/webui/web_ui_util.h"
47 47
48 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 48 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
49 #include "chrome/browser/captive_portal/captive_portal_service.h" 49 #include "chrome/browser/captive_portal/captive_portal_service.h"
50 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" 50 #include "chrome/browser/captive_portal/captive_portal_service_factory.h"
51 #endif 51 #endif
52 52
53 #if defined(OS_WIN)
54 #include "base/win/windows_version.h"
55 #endif
56
57 using base::ASCIIToUTF16; 53 using base::ASCIIToUTF16;
58 using base::TimeTicks; 54 using base::TimeTicks;
59 using content::InterstitialPage; 55 using content::InterstitialPage;
60 using content::NavigationController; 56 using content::NavigationController;
61 using content::NavigationEntry; 57 using content::NavigationEntry;
62 58
63 namespace { 59 namespace {
64 60
65 // Constants for the M37 Finch trial. 61 // Constants for the M37 Finch trial.
66 const char kInterstitialTrialName[] = "SSLInterstitialVersion"; 62 const char kInterstitialTrialName[] = "SSLInterstitialVersion";
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 load_time_data.SetString( 500 load_time_data.SetString(
505 "primaryParagraph", 501 "primaryParagraph",
506 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url)); 502 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url));
507 } 503 }
508 load_time_data.SetString( 504 load_time_data.SetString(
509 "openDetails", 505 "openDetails",
510 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); 506 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON));
511 load_time_data.SetString( 507 load_time_data.SetString(
512 "closeDetails", 508 "closeDetails",
513 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); 509 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON));
514
515 if (overridable_ && !strict_enforcement_) { // Overridable. 510 if (overridable_ && !strict_enforcement_) { // Overridable.
516 SSLErrorInfo error_info = 511 SSLErrorInfo error_info =
517 SSLErrorInfo::CreateError( 512 SSLErrorInfo::CreateError(
518 SSLErrorInfo::NetErrorToErrorType(cert_error_), 513 SSLErrorInfo::NetErrorToErrorType(cert_error_),
519 ssl_info_.cert.get(), 514 ssl_info_.cert.get(),
520 request_url_); 515 request_url_);
521 load_time_data.SetString( 516 load_time_data.SetString(
522 "explanationParagraph", error_info.details()); 517 "explanationParagraph", error_info.details());
523 load_time_data.SetString( 518 load_time_data.SetString(
524 "primaryButtonText", 519 "primaryButtonText",
525 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON)); 520 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON));
526 load_time_data.SetString( 521 load_time_data.SetString(
527 "finalParagraph", 522 "finalParagraph",
528 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, url)); 523 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, url));
529 } else { // Non-overridable. 524 } else { // Non-overridable.
530 load_time_data.SetBoolean("overridable", false); 525 load_time_data.SetBoolean("overridable", false);
531 load_time_data.SetString( 526 SSLErrorInfo::ErrorType type = SSLErrorInfo::CERT_INVALID;
532 "explanationParagraph", 527 // SSLErrorInfo::NetErrorToErrorType(cert_error_);
533 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE, url)); 528 if (type == SSLErrorInfo::CERT_INVALID && SSLErrorClassification::
529 IsWindowsVersionSP3OrLower()) {
530 load_time_data.SetString(
531 "explanationParagraph",
532 l10n_util::GetStringFUTF16(
533 IDS_SSL_NONOVERRIDABLE_MORE_INVALID_SP3, url));
534 } else {
535 load_time_data.SetString("explanationParagraph",
536 l10n_util::GetStringFUTF16(
537 IDS_SSL_NONOVERRIDABLE_MORE, url));
538 }
534 load_time_data.SetString( 539 load_time_data.SetString(
535 "primaryButtonText", 540 "primaryButtonText",
536 l10n_util::GetStringUTF16(IDS_SSL_NONOVERRIDABLE_RELOAD_BUTTON)); 541 l10n_util::GetStringUTF16(IDS_SSL_NONOVERRIDABLE_RELOAD_BUTTON));
537 // Customize the help link depending on the specific error type. 542 // Customize the help link depending on the specific error type.
538 // Only mark as HSTS if none of the more specific error types apply, and use 543 // Only mark as HSTS if none of the more specific error types apply, and use
539 // INVALID as a fallback if no other string is appropriate. 544 // INVALID as a fallback if no other string is appropriate.
540 SSLErrorInfo::ErrorType type =
541 SSLErrorInfo::NetErrorToErrorType(cert_error_);
542 load_time_data.SetInteger("errorType", type); 545 load_time_data.SetInteger("errorType", type);
543 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID; 546 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID;
544 switch (type) { 547 switch (type) {
545 case SSLErrorInfo::CERT_REVOKED: 548 case SSLErrorInfo::CERT_REVOKED:
546 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED; 549 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED;
547 break; 550 break;
548 case SSLErrorInfo::CERT_PINNED_KEY_MISSING: 551 case SSLErrorInfo::CERT_PINNED_KEY_MISSING:
549 help_string = IDS_SSL_NONOVERRIDABLE_PINNED; 552 help_string = IDS_SSL_NONOVERRIDABLE_PINNED;
550 break; 553 break;
551 case SSLErrorInfo::CERT_INVALID: 554 case SSLErrorInfo::CERT_INVALID:
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // sure we don't clear the captive portal flag, since the interstitial was 724 // sure we don't clear the captive portal flag, since the interstitial was
722 // potentially caused by the captive portal. 725 // potentially caused by the captive portal.
723 captive_portal_detected_ = captive_portal_detected_ || 726 captive_portal_detected_ = captive_portal_detected_ ||
724 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); 727 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL);
725 // Also keep track of non-HTTP portals and error cases. 728 // Also keep track of non-HTTP portals and error cases.
726 captive_portal_no_response_ = captive_portal_no_response_ || 729 captive_portal_no_response_ = captive_portal_no_response_ ||
727 (results->result == captive_portal::RESULT_NO_RESPONSE); 730 (results->result == captive_portal::RESULT_NO_RESPONSE);
728 } 731 }
729 #endif 732 #endif
730 } 733 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698