OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_policy.h" | 5 #include "chrome/browser/ssl/ssl_policy.h" |
6 | 6 |
7 #include "base/singleton.h" | 7 #include "base/singleton.h" |
8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/cert_store.h" | 10 #include "chrome/browser/cert_store.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 error_handler_->manager()->AllowShowInsecureContentForURL(main_frame_url_); | 69 error_handler_->manager()->AllowShowInsecureContentForURL(main_frame_url_); |
70 // Reload the page. | 70 // Reload the page. |
71 error_handler_->GetWebContents()->controller()->Reload(true); | 71 error_handler_->GetWebContents()->controller()->Reload(true); |
72 } | 72 } |
73 | 73 |
74 static void ShowErrorPage(SSLPolicy* policy, SSLManager::CertError* error) { | 74 static void ShowErrorPage(SSLPolicy* policy, SSLManager::CertError* error) { |
75 SSLErrorInfo error_info = policy->GetSSLErrorInfo(error); | 75 SSLErrorInfo error_info = policy->GetSSLErrorInfo(error); |
76 | 76 |
77 // Let's build the html error page. | 77 // Let's build the html error page. |
78 DictionaryValue strings; | 78 DictionaryValue strings; |
79 strings.SetString(L"title", l10n_util::GetString(IDS_SSL_ERROR_PAGE_TITLE)); | 79 strings.SetString( |
80 strings.SetString(L"headLine", error_info.title()); | 80 ASCIIToUTF16("title"), |
81 strings.SetString(L"description", error_info.details()); | 81 WideToUTF16Hack(l10n_util::GetString(IDS_SSL_ERROR_PAGE_TITLE))); |
82 strings.SetString(L"moreInfoTitle", | 82 strings.SetString(ASCIIToUTF16("headLine"), |
83 l10n_util::GetString(IDS_CERT_ERROR_EXTRA_INFO_TITLE)); | 83 WideToUTF16Hack(error_info.title())); |
| 84 strings.SetString(ASCIIToUTF16("description"), |
| 85 WideToUTF16Hack(error_info.details())); |
| 86 strings.SetString( |
| 87 ASCIIToUTF16("moreInfoTitle"), |
| 88 WideToUTF16Hack(l10n_util::GetString(IDS_CERT_ERROR_EXTRA_INFO_TITLE))); |
84 SSLBlockingPage::SetExtraInfo(&strings, error_info.extra_information()); | 89 SSLBlockingPage::SetExtraInfo(&strings, error_info.extra_information()); |
85 | 90 |
86 strings.SetString(L"back", l10n_util::GetString(IDS_SSL_ERROR_PAGE_BACK)); | 91 strings.SetString( |
| 92 ASCIIToUTF16("back"), |
| 93 WideToUTF16Hack(l10n_util::GetString(IDS_SSL_ERROR_PAGE_BACK))); |
87 | 94 |
88 strings.SetString(L"textdirection", | 95 strings.SetString( |
| 96 ASCIIToUTF16("textdirection"), |
89 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? | 97 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? |
90 L"rtl" : L"ltr"); | 98 ASCIIToUTF16("rtl") : ASCIIToUTF16("ltr")); |
91 | 99 |
92 static const StringPiece html( | 100 static const StringPiece html( |
93 ResourceBundle::GetSharedInstance().GetRawDataResource( | 101 ResourceBundle::GetSharedInstance().GetRawDataResource( |
94 IDR_SSL_ERROR_HTML)); | 102 IDR_SSL_ERROR_HTML)); |
95 | 103 |
96 std::string html_text(jstemplate_builder::GetTemplateHtml(html, &strings, | 104 std::string html_text(jstemplate_builder::GetTemplateHtml(html, &strings, |
97 "template_root")); | 105 "template_root")); |
98 | 106 |
99 WebContents* tab = error->GetWebContents(); | 107 WebContents* tab = error->GetWebContents(); |
100 int cert_id = CertStore::GetSharedInstance()->StoreCert( | 108 int cert_id = CertStore::GetSharedInstance()->StoreCert( |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 void SSLPolicy::OnFatalCertError(const GURL& main_frame_url, | 492 void SSLPolicy::OnFatalCertError(const GURL& main_frame_url, |
485 SSLManager::CertError* error) { | 493 SSLManager::CertError* error) { |
486 if (error->resource_type() != ResourceType::MAIN_FRAME) { | 494 if (error->resource_type() != ResourceType::MAIN_FRAME) { |
487 error->DenyRequest(); | 495 error->DenyRequest(); |
488 return; | 496 return; |
489 } | 497 } |
490 error->CancelRequest(); | 498 error->CancelRequest(); |
491 ShowErrorPage(this, error); | 499 ShowErrorPage(this, error); |
492 // No need to degrade our security indicators because we didn't continue. | 500 // No need to degrade our security indicators because we didn't continue. |
493 } | 501 } |
OLD | NEW |