Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/ui/webui/certificate_viewer_webui.h" | 5 #include "chrome/browser/ui/webui/certificate_viewer_webui.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 | 340 |
| 341 node_details->Set("children", cert_sub_fields = new base::ListValue()); | 341 node_details->Set("children", cert_sub_fields = new base::ListValue()); |
| 342 cert_sub_fields->Append(node_details = new base::DictionaryValue()); | 342 cert_sub_fields->Append(node_details = new base::DictionaryValue()); |
| 343 node_details->SetString("label", | 343 node_details->SetString("label", |
| 344 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE)); | 344 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE)); |
| 345 cert_sub_fields->Append(alt_node_details = new base::DictionaryValue()); | 345 cert_sub_fields->Append(alt_node_details = new base::DictionaryValue()); |
| 346 alt_node_details->SetString("label", | 346 alt_node_details->SetString("label", |
| 347 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_AFTER)); | 347 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_AFTER)); |
| 348 base::Time issued, expires; | 348 base::Time issued, expires; |
| 349 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { | 349 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { |
| 350 node_details->SetString("payload.val", | 350 // The object Time internally saves the time in UTC timezone. This is why we |
| 351 base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(issued))); | 351 // do a simple UTC string concatenation. |
| 352 alt_node_details->SetString("payload.val", | 352 node_details->SetString( |
| 353 base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(expires))); | 353 "payload.val", |
| 354 base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(issued)) + " " + | |
| 355 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VALIDITY_TIMEZONE)); | |
|
jww
2014/05/27 23:43:29
Change these two variable references as mentioned
mhm
2014/05/28 00:02:44
Done.
| |
| 356 alt_node_details->SetString( | |
| 357 "payload.val", | |
| 358 base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(expires)) + " " + | |
| 359 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VALIDITY_TIMEZONE)); | |
| 354 } | 360 } |
| 355 | 361 |
| 356 cert_fields->Append(node_details = new base::DictionaryValue()); | 362 cert_fields->Append(node_details = new base::DictionaryValue()); |
| 357 node_details->SetString("label", | 363 node_details->SetString("label", |
| 358 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT)); | 364 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT)); |
| 359 node_details->SetString("payload.val", | 365 node_details->SetString("payload.val", |
| 360 x509_certificate_model::GetSubjectName(cert)); | 366 x509_certificate_model::GetSubjectName(cert)); |
| 361 | 367 |
| 362 // Subject key information. | 368 // Subject key information. |
| 363 cert_fields->Append(node_details = new base::DictionaryValue()); | 369 cert_fields->Append(node_details = new base::DictionaryValue()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 const base::ListValue* args) const { | 440 const base::ListValue* args) const { |
| 435 int cert_index; | 441 int cert_index; |
| 436 double val; | 442 double val; |
| 437 if (!(args->GetDouble(0, &val))) | 443 if (!(args->GetDouble(0, &val))) |
| 438 return -1; | 444 return -1; |
| 439 cert_index = static_cast<int>(val); | 445 cert_index = static_cast<int>(val); |
| 440 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) | 446 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) |
| 441 return -1; | 447 return -1; |
| 442 return cert_index; | 448 return cert_index; |
| 443 } | 449 } |
| OLD | NEW |