OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // The page is closed without the user having chosen what to do, default to | 61 // The page is closed without the user having chosen what to do, default to |
62 // deny. | 62 // deny. |
63 NotifyDenyCertificate(); | 63 NotifyDenyCertificate(); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 std::string SSLBlockingPage::GetHTMLContents() { | 67 std::string SSLBlockingPage::GetHTMLContents() { |
68 // Let's build the html error page. | 68 // Let's build the html error page. |
69 DictionaryValue strings; | 69 DictionaryValue strings; |
70 SSLErrorInfo error_info = delegate_->GetSSLErrorInfo(handler_); | 70 SSLErrorInfo error_info = delegate_->GetSSLErrorInfo(handler_); |
71 strings.SetString("headLine", WideToUTF16Hack(error_info.title())); | 71 strings.SetString("headLine", error_info.title()); |
72 strings.SetString("description", WideToUTF16Hack(error_info.details())); | 72 strings.SetString("description", error_info.details()); |
73 | 73 |
74 strings.SetString("moreInfoTitle", | 74 strings.SetString("moreInfoTitle", |
75 l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_TITLE)); | 75 l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_TITLE)); |
76 SetExtraInfo(&strings, error_info.extra_information()); | 76 SetExtraInfo(&strings, error_info.extra_information()); |
77 | 77 |
78 int resource_id; | 78 int resource_id; |
79 if (error_level_ == ERROR_OVERRIDABLE) { | 79 if (error_level_ == ERROR_OVERRIDABLE) { |
80 resource_id = IDR_SSL_ROAD_BLOCK_HTML; | 80 resource_id = IDR_SSL_ROAD_BLOCK_HTML; |
81 strings.SetString("title", | 81 strings.SetString("title", |
82 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_TITLE)); | 82 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_TITLE)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void SSLBlockingPage::NotifyAllowCertificate() { | 151 void SSLBlockingPage::NotifyAllowCertificate() { |
152 DCHECK(!delegate_has_been_notified_); | 152 DCHECK(!delegate_has_been_notified_); |
153 | 153 |
154 delegate_->OnAllowCertificate(handler_); | 154 delegate_->OnAllowCertificate(handler_); |
155 delegate_has_been_notified_ = true; | 155 delegate_has_been_notified_ = true; |
156 } | 156 } |
157 | 157 |
158 // static | 158 // static |
159 void SSLBlockingPage::SetExtraInfo( | 159 void SSLBlockingPage::SetExtraInfo( |
160 DictionaryValue* strings, | 160 DictionaryValue* strings, |
161 const std::vector<std::wstring>& extra_info) { | 161 const std::vector<string16>& extra_info) { |
162 DCHECK(extra_info.size() < 5); // We allow 5 paragraphs max. | 162 DCHECK(extra_info.size() < 5); // We allow 5 paragraphs max. |
163 const char* keys[5] = { | 163 const char* keys[5] = { |
164 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" | 164 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" |
165 }; | 165 }; |
166 int i; | 166 int i; |
167 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 167 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
168 strings->SetString(keys[i], WideToUTF16Hack(extra_info[i])); | 168 strings->SetString(keys[i], extra_info[i]); |
169 } | 169 } |
170 for (; i < 5; i++) { | 170 for (; i < 5; i++) { |
171 strings->SetString(keys[i], ""); | 171 strings->SetString(keys[i], ""); |
172 } | 172 } |
173 } | 173 } |
OLD | NEW |