| 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_blocking_page.h" | 5 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 6 | 6 |
| 7 #include "base/string_piece.h" | 7 #include "base/string_piece.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/cert_store.h" | 10 #include "chrome/browser/cert_store.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // The page is closed without the user having chosen what to do, default to | 37 // The page is closed without the user having chosen what to do, default to |
| 38 // deny. | 38 // deny. |
| 39 NotifyDenyCertificate(); | 39 NotifyDenyCertificate(); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 std::string SSLBlockingPage::GetHTMLContents() { | 43 std::string SSLBlockingPage::GetHTMLContents() { |
| 44 // Let's build the html error page. | 44 // Let's build the html error page. |
| 45 DictionaryValue strings; | 45 DictionaryValue strings; |
| 46 SSLErrorInfo error_info = delegate_->GetSSLErrorInfo(error_); | 46 SSLErrorInfo error_info = delegate_->GetSSLErrorInfo(error_); |
| 47 strings.SetString(L"title", | 47 strings.SetString( |
| 48 l10n_util::GetString(IDS_SSL_BLOCKING_PAGE_TITLE)); | 48 ASCIIToUTF16("title"), |
| 49 strings.SetString(L"headLine", error_info.title()); | 49 WideToUTF16Hack(l10n_util::GetString(IDS_SSL_BLOCKING_PAGE_TITLE))); |
| 50 strings.SetString(L"description", error_info.details()); | 50 strings.SetString(ASCIIToUTF16("headLine"), |
| 51 WideToUTF16Hack(error_info.title())); |
| 52 strings.SetString(ASCIIToUTF16("description"), |
| 53 WideToUTF16Hack(error_info.details())); |
| 51 | 54 |
| 52 strings.SetString(L"moreInfoTitle", | 55 strings.SetString( |
| 53 l10n_util::GetString(IDS_CERT_ERROR_EXTRA_INFO_TITLE)); | 56 ASCIIToUTF16("moreInfoTitle"), |
| 57 WideToUTF16Hack(l10n_util::GetString(IDS_CERT_ERROR_EXTRA_INFO_TITLE))); |
| 54 SetExtraInfo(&strings, error_info.extra_information()); | 58 SetExtraInfo(&strings, error_info.extra_information()); |
| 55 | 59 |
| 56 strings.SetString(L"proceed", | 60 strings.SetString( |
| 57 l10n_util::GetString(IDS_SSL_BLOCKING_PAGE_PROCEED)); | 61 ASCIIToUTF16("proceed"), |
| 58 strings.SetString(L"exit", | 62 WideToUTF16Hack(l10n_util::GetString(IDS_SSL_BLOCKING_PAGE_PROCEED))); |
| 59 l10n_util::GetString(IDS_SSL_BLOCKING_PAGE_EXIT)); | 63 strings.SetString( |
| 64 ASCIIToUTF16("exit"), |
| 65 WideToUTF16Hack(l10n_util::GetString(IDS_SSL_BLOCKING_PAGE_EXIT))); |
| 60 | 66 |
| 61 strings.SetString(L"textdirection", | 67 strings.SetString( |
| 68 ASCIIToUTF16("textdirection"), |
| 62 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? | 69 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? |
| 63 L"rtl" : L"ltr"); | 70 ASCIIToUTF16("rtl") : ASCIIToUTF16("ltr")); |
| 64 | 71 |
| 65 static const StringPiece html( | 72 static const StringPiece html( |
| 66 ResourceBundle::GetSharedInstance().GetRawDataResource( | 73 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 67 IDR_SSL_ROAD_BLOCK_HTML)); | 74 IDR_SSL_ROAD_BLOCK_HTML)); |
| 68 | 75 |
| 69 return jstemplate_builder::GetTemplateHtml(html, &strings, "template_root"); | 76 return jstemplate_builder::GetTemplateHtml(html, &strings, "template_root"); |
| 70 } | 77 } |
| 71 | 78 |
| 72 void SSLBlockingPage::UpdateEntry(NavigationEntry* entry) { | 79 void SSLBlockingPage::UpdateEntry(NavigationEntry* entry) { |
| 73 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 131 |
| 125 delegate_->OnAllowCertificate(error_); | 132 delegate_->OnAllowCertificate(error_); |
| 126 delegate_has_been_notified_ = true; | 133 delegate_has_been_notified_ = true; |
| 127 } | 134 } |
| 128 | 135 |
| 129 // static | 136 // static |
| 130 void SSLBlockingPage::SetExtraInfo( | 137 void SSLBlockingPage::SetExtraInfo( |
| 131 DictionaryValue* strings, | 138 DictionaryValue* strings, |
| 132 const std::vector<std::wstring>& extra_info) { | 139 const std::vector<std::wstring>& extra_info) { |
| 133 DCHECK(extra_info.size() < 5); // We allow 5 paragraphs max. | 140 DCHECK(extra_info.size() < 5); // We allow 5 paragraphs max. |
| 134 const std::wstring keys[5] = { | 141 const string16 keys[5] = { |
| 135 L"moreInfo1", L"moreInfo2", L"moreInfo3", L"moreInfo4", L"moreInfo5" | 142 ASCIIToUTF16("moreInfo1"), ASCIIToUTF16("moreInfo2"), |
| 143 ASCIIToUTF16("moreInfo3"), ASCIIToUTF16("moreInfo4"), |
| 144 ASCIIToUTF16("moreInfo5") |
| 136 }; | 145 }; |
| 137 int i; | 146 int i; |
| 138 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 147 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
| 139 strings->SetString(keys[i], extra_info[i]); | 148 strings->SetString(keys[i], WideToUTF16Hack(extra_info[i])); |
| 140 } | 149 } |
| 141 for (;i < 5; i++) { | 150 for (;i < 5; i++) { |
| 142 strings->SetString(keys[i], L""); | 151 strings->SetString(keys[i], ASCIIToUTF16("")); |
| 143 } | 152 } |
| 144 } | 153 } |
| 145 | |
| OLD | NEW |