Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/string16.h" | |
| 9 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| 10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 11 #include "base/values.h" | 12 #include "base/values.h" |
| 12 #include "chrome/browser/dom_operation_notification_details.h" | 13 #include "chrome/browser/dom_operation_notification_details.h" |
| 13 #include "chrome/browser/ssl/ssl_error_info.h" | 14 #include "chrome/browser/ssl/ssl_error_info.h" |
| 14 #include "chrome/browser/tab_contents/tab_util.h" | 15 #include "chrome/browser/tab_contents/tab_util.h" |
| 15 #include "chrome/common/jstemplate_builder.h" | 16 #include "chrome/common/jstemplate_builder.h" |
| 16 #include "content/browser/cert_store.h" | 17 #include "content/browser/cert_store.h" |
| 17 #include "content/browser/renderer_host/render_view_host.h" | 18 #include "content/browser/renderer_host/render_view_host.h" |
| 18 #include "content/browser/ssl/ssl_cert_error_handler.h" | 19 #include "content/browser/ssl/ssl_cert_error_handler.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 | 83 |
| 83 int resource_id; | 84 int resource_id; |
| 84 if (overridable_) { | 85 if (overridable_) { |
| 85 resource_id = IDR_SSL_ROAD_BLOCK_HTML; | 86 resource_id = IDR_SSL_ROAD_BLOCK_HTML; |
| 86 strings.SetString("title", | 87 strings.SetString("title", |
| 87 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_TITLE)); | 88 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_TITLE)); |
| 88 strings.SetString("proceed", | 89 strings.SetString("proceed", |
| 89 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_PROCEED)); | 90 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_PROCEED)); |
| 90 strings.SetString("exit", | 91 strings.SetString("exit", |
| 91 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_EXIT)); | 92 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_EXIT)); |
| 93 strings.SetString("description", | |
| 94 error_info.details() + ASCIIToUTF16(" ") + | |
|
Ryan Sleevi
2011/12/11 21:18:34
I didn't think it was permissible to concatenate t
| |
| 95 l10n_util::GetStringUTF16( | |
| 96 IDS_SSL_BLOCKING_PAGE_SHOULD_NOT_PROCEED)); | |
| 92 } else { | 97 } else { |
| 93 resource_id = IDR_SSL_ERROR_HTML; | 98 resource_id = IDR_SSL_ERROR_HTML; |
| 94 strings.SetString("title", | 99 strings.SetString("title", |
| 95 l10n_util::GetStringUTF16(IDS_SSL_ERROR_PAGE_TITLE)); | 100 l10n_util::GetStringUTF16(IDS_SSL_ERROR_PAGE_TITLE)); |
| 96 strings.SetString("back", | 101 strings.SetString("back", |
| 97 l10n_util::GetStringUTF16(IDS_SSL_ERROR_PAGE_BACK)); | 102 l10n_util::GetStringUTF16(IDS_SSL_ERROR_PAGE_BACK)); |
| 98 } | 103 } |
| 99 | 104 |
| 100 strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); | 105 strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); |
| 101 | 106 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 DCHECK(!callback_.is_null()); | 166 DCHECK(!callback_.is_null()); |
| 162 | 167 |
| 163 callback_.Run(handler_, true); | 168 callback_.Run(handler_, true); |
| 164 callback_.Reset(); | 169 callback_.Reset(); |
| 165 } | 170 } |
| 166 | 171 |
| 167 // static | 172 // static |
| 168 void SSLBlockingPage::SetExtraInfo( | 173 void SSLBlockingPage::SetExtraInfo( |
| 169 DictionaryValue* strings, | 174 DictionaryValue* strings, |
| 170 const std::vector<string16>& extra_info) { | 175 const std::vector<string16>& extra_info) { |
| 171 DCHECK(extra_info.size() < 5); // We allow 5 paragraphs max. | 176 DCHECK_LT(extra_info.size(), 5U); // We allow 5 paragraphs max. |
| 172 const char* keys[5] = { | 177 const char* keys[5] = { |
| 173 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" | 178 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" |
| 174 }; | 179 }; |
| 175 int i; | 180 int i; |
| 176 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 181 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
| 177 strings->SetString(keys[i], extra_info[i]); | 182 strings->SetString(keys[i], extra_info[i]); |
| 178 } | 183 } |
| 179 for (; i < 5; i++) { | 184 for (; i < 5; i++) { |
| 180 strings->SetString(keys[i], ""); | 185 strings->SetString(keys[i], ""); |
| 181 } | 186 } |
| 182 } | 187 } |
| OLD | NEW |