Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/browser/ui/webui/certificate_viewer_webui.cc

Issue 827123004: The Certificate Web UI incorrectly formats the issued and expires dates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Rebase on ToT Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 node_details->Set("children", cert_sub_fields = new base::ListValue()); 344 node_details->Set("children", cert_sub_fields = new base::ListValue());
345 cert_sub_fields->Append(node_details = new base::DictionaryValue()); 345 cert_sub_fields->Append(node_details = new base::DictionaryValue());
346 node_details->SetString("label", 346 node_details->SetString("label",
347 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE)); 347 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE));
348 cert_sub_fields->Append(alt_node_details = new base::DictionaryValue()); 348 cert_sub_fields->Append(alt_node_details = new base::DictionaryValue());
349 alt_node_details->SetString("label", 349 alt_node_details->SetString("label",
350 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_AFTER)); 350 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_AFTER));
351 base::Time issued, expires; 351 base::Time issued, expires;
352 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { 352 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) {
353 // The object Time internally saves the time in UTC timezone. This is why we
354 // do a simple UTC string concatenation.
355 node_details->SetString( 353 node_details->SetString(
356 "payload.val", 354 "payload.val",
357 base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(issued)) + " " + 355 base::UTF16ToUTF8(
358 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_UTC_TIMEZONE)); 356 base::TimeFormatShortDateAndTimeWithTimeZone(issued)));
359 alt_node_details->SetString( 357 alt_node_details->SetString(
360 "payload.val", 358 "payload.val",
361 base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(expires)) + " " + 359 base::UTF16ToUTF8(
362 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_UTC_TIMEZONE)); 360 base::TimeFormatShortDateAndTimeWithTimeZone(expires)));
363 } 361 }
364 362
365 cert_fields->Append(node_details = new base::DictionaryValue()); 363 cert_fields->Append(node_details = new base::DictionaryValue());
366 node_details->SetString("label", 364 node_details->SetString("label",
367 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT)); 365 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_SUBJECT));
368 node_details->SetString("payload.val", 366 node_details->SetString("payload.val",
369 x509_certificate_model::GetSubjectName(cert)); 367 x509_certificate_model::GetSubjectName(cert));
370 368
371 // Subject key information. 369 // Subject key information.
372 cert_fields->Append(node_details = new base::DictionaryValue()); 370 cert_fields->Append(node_details = new base::DictionaryValue());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 const base::ListValue* args) const { 441 const base::ListValue* args) const {
444 int cert_index; 442 int cert_index;
445 double val; 443 double val;
446 if (!(args->GetDouble(0, &val))) 444 if (!(args->GetDouble(0, &val)))
447 return -1; 445 return -1;
448 cert_index = static_cast<int>(val); 446 cert_index = static_cast<int>(val);
449 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) 447 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size()))
450 return -1; 448 return -1;
451 return cert_index; 449 return cert_index;
452 } 450 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698