diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-14 22:36:35 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-14 22:36:35 +0000 |
commit | 1b1a264ad3d0ecf0e0e19468b3e4b9e1553c2e88 (patch) | |
tree | c3617b3e5e0590ed2f01096929ddbb0edac000e2 /base | |
parent | 7105ea549a113d4c1d473c305475caa0a866e286 (diff) | |
download | chromium_src-1b1a264ad3d0ecf0e0e19468b3e4b9e1553c2e88.zip chromium_src-1b1a264ad3d0ecf0e0e19468b3e4b9e1553c2e88.tar.gz chromium_src-1b1a264ad3d0ecf0e0e19468b3e4b9e1553c2e88.tar.bz2 |
Linux: Add Certificate Info dialog (part 1)
Rename base/nss_init.{h,cc} to base/nss_util.{h,cc}, move PRTimeToBaseTime there.
BUG=18119
TEST=Load https://www.google.com, compare to firefox cert dialog.
Review URL: http://codereview.chromium.org/500141
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/base.gypi | 8 | ||||
-rw-r--r-- | base/crypto/rsa_private_key_nss.cc | 2 | ||||
-rw-r--r-- | base/crypto/signature_creator_nss.cc | 2 | ||||
-rw-r--r-- | base/crypto/signature_verifier_nss.cc | 3 | ||||
-rw-r--r-- | base/hmac_nss.cc | 2 | ||||
-rw-r--r-- | base/nss_util.cc (renamed from base/nss_init.cc) | 24 | ||||
-rw-r--r-- | base/nss_util.h (renamed from base/nss_init.h) | 16 | ||||
-rw-r--r-- | base/test/test_suite.h | 2 |
8 files changed, 43 insertions, 16 deletions
diff --git a/base/base.gypi b/base/base.gypi index f7584c4..ecdc0a0 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -287,8 +287,8 @@ 'directory_watcher_inotify.cc', 'linux_util.cc', 'message_pump_glib.cc', - 'nss_init.cc', - 'nss_init.h', + 'nss_util.cc', + 'nss_util.h', ], },], [ 'OS != "linux"', { @@ -547,8 +547,8 @@ 'message_pump_mac.mm', 'nsimage_cache_mac.h', 'nsimage_cache_mac.mm', - 'nss_init.cc', - 'nss_init.h', + 'nss_util.cc', + 'nss_util.h', 'pe_image.cc', 'pe_image.h', 'setproctitle_linux.c', diff --git a/base/crypto/rsa_private_key_nss.cc b/base/crypto/rsa_private_key_nss.cc index 7e10b36..26bb10cc 100644 --- a/base/crypto/rsa_private_key_nss.cc +++ b/base/crypto/rsa_private_key_nss.cc @@ -12,7 +12,7 @@ #include <list> #include "base/logging.h" -#include "base/nss_init.h" +#include "base/nss_util.h" #include "base/scoped_ptr.h" #include "base/string_util.h" diff --git a/base/crypto/signature_creator_nss.cc b/base/crypto/signature_creator_nss.cc index e0de4b7..ff1d271 100644 --- a/base/crypto/signature_creator_nss.cc +++ b/base/crypto/signature_creator_nss.cc @@ -9,7 +9,7 @@ #include <stdlib.h> #include "base/logging.h" -#include "base/nss_init.h" +#include "base/nss_util.h" #include "base/scoped_ptr.h" namespace base { diff --git a/base/crypto/signature_verifier_nss.cc b/base/crypto/signature_verifier_nss.cc index 901f1fc..369f275 100644 --- a/base/crypto/signature_verifier_nss.cc +++ b/base/crypto/signature_verifier_nss.cc @@ -9,7 +9,7 @@ #include <stdlib.h> #include "base/logging.h" -#include "base/nss_init.h" +#include "base/nss_util.h" namespace base { @@ -111,4 +111,3 @@ void SignatureVerifier::Reset() { } } // namespace base - diff --git a/base/hmac_nss.cc b/base/hmac_nss.cc index ce705c5..d55bc64 100644 --- a/base/hmac_nss.cc +++ b/base/hmac_nss.cc @@ -8,7 +8,7 @@ #include <pk11pub.h> #include "base/logging.h" -#include "base/nss_init.h" +#include "base/nss_util.h" #include "base/scoped_ptr.h" namespace { diff --git a/base/nss_init.cc b/base/nss_util.cc index 7f65504..757b437 100644 --- a/base/nss_init.cc +++ b/base/nss_util.cc @@ -1,14 +1,15 @@ -// Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2008-2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/nss_init.h" +#include "base/nss_util.h" #include <dlfcn.h> #include <nss.h> #include <plarena.h> #include <prerror.h> #include <prinit.h> +#include <prtime.h> #include <pk11pub.h> #include <secmod.h> #include <ssl.h> @@ -177,4 +178,23 @@ void EnsureNSSInit() { Singleton<NSSInitSingleton>::get(); } +// TODO(port): Implement this more simply. We can convert by subtracting an +// offset (the difference between NSPR's and base::Time's epochs). +Time PRTimeToBaseTime(PRTime prtime) { + PRExplodedTime prxtime; + PR_ExplodeTime(prtime, PR_GMTParameters, &prxtime); + + base::Time::Exploded exploded; + exploded.year = prxtime.tm_year; + exploded.month = prxtime.tm_month + 1; + exploded.day_of_week = prxtime.tm_wday; + exploded.day_of_month = prxtime.tm_mday; + exploded.hour = prxtime.tm_hour; + exploded.minute = prxtime.tm_min; + exploded.second = prxtime.tm_sec; + exploded.millisecond = prxtime.tm_usec / 1000; + + return Time::FromUTCExploded(exploded); +} + } // namespace base diff --git a/base/nss_init.h b/base/nss_util.h index cd8ee77..f766228 100644 --- a/base/nss_init.h +++ b/base/nss_util.h @@ -1,12 +1,16 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_NSS_INIT_H_ -#define BASE_NSS_INIT_H_ +#ifndef BASE_NSS_UTIL_H_ +#define BASE_NSS_UTIL_H_ + +#include "base/basictypes.h" namespace base { +class Time; + // Initialize NRPR if it isn't already initialized. This function is // thread-safe, and NSPR will only ever be initialized once. NSPR will be // properly shut down on program exit. @@ -17,6 +21,10 @@ void EnsureNSPRInit(); // ever be initialized once. NSS will be properly shut down on program exit. void EnsureNSSInit(); +// Convert a NSS PRTime value into a base::Time object. +// We use a int64 instead of PRTime here to avoid depending on NSPR headers. +Time PRTimeToBaseTime(int64 prtime); + } // namespace base -#endif // BASE_NSS_INIT_H_ +#endif // BASE_NSS_UTIL_H_ diff --git a/base/test/test_suite.h b/base/test/test_suite.h index aa006fc..c738518 100644 --- a/base/test/test_suite.h +++ b/base/test/test_suite.h @@ -14,7 +14,7 @@ #include "base/debug_on_start.h" #include "base/i18n/icu_util.h" #include "base/multiprocess_test.h" -#include "base/nss_init.h" +#include "base/nss_util.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/scoped_nsautorelease_pool.h" |