summaryrefslogtreecommitdiffstats
path: root/chromeos/cryptohome
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-18 03:58:15 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-18 03:58:15 +0000
commite72abe93783338175dce9f5e2ab43165bcf34285 (patch)
treef2bbc0ddca0d709088d2ef39c5011d8313a3c816 /chromeos/cryptohome
parentca183e10e682f1e5829909471af7328513127fdf (diff)
downloadchromium_src-e72abe93783338175dce9f5e2ab43165bcf34285.zip
chromium_src-e72abe93783338175dce9f5e2ab43165bcf34285.tar.gz
chromium_src-e72abe93783338175dce9f5e2ab43165bcf34285.tar.bz2
cryptohome: Rename CryptohomeLibrary to SystemSaltGetter
To match what the class does. BUG=305906 TEST=none R=hashimoto@chromium.org TBR=thestig@chromium.org # for files outside of 'chromeos' Review URL: https://codereview.chromium.org/26791003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229307 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/cryptohome')
-rw-r--r--chromeos/cryptohome/system_salt_getter.cc (renamed from chromeos/cryptohome/cryptohome_library.cc)44
-rw-r--r--chromeos/cryptohome/system_salt_getter.h (renamed from chromeos/cryptohome/cryptohome_library.h)17
2 files changed, 30 insertions, 31 deletions
diff --git a/chromeos/cryptohome/cryptohome_library.cc b/chromeos/cryptohome/system_salt_getter.cc
index b183f99b..c139041 100644
--- a/chromeos/cryptohome/cryptohome_library.cc
+++ b/chromeos/cryptohome/system_salt_getter.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chromeos/cryptohome/cryptohome_library.h"
+#include "chromeos/cryptohome/system_salt_getter.h"
#include "base/bind.h"
#include "base/location.h"
@@ -15,33 +15,33 @@
namespace chromeos {
namespace {
-CryptohomeLibrary* g_cryptohome_library = NULL;
+SystemSaltGetter* g_system_salt_getter = NULL;
} // namespace
-CryptohomeLibrary::CryptohomeLibrary() {
+SystemSaltGetter::SystemSaltGetter() {
}
-CryptohomeLibrary::~CryptohomeLibrary() {
+SystemSaltGetter::~SystemSaltGetter() {
}
-void CryptohomeLibrary::GetSystemSalt(
+void SystemSaltGetter::GetSystemSalt(
const GetSystemSaltCallback& callback) {
// TODO(hashimoto): Stop using GetSystemSaltSynt(). crbug.com/141009
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(callback, GetSystemSaltSync()));
}
-std::string CryptohomeLibrary::GetSystemSaltSync() {
+std::string SystemSaltGetter::GetSystemSaltSync() {
LoadSystemSalt(); // no-op if it's already loaded.
return system_salt_;
}
-std::string CryptohomeLibrary::GetCachedSystemSalt() {
+std::string SystemSaltGetter::GetCachedSystemSalt() {
return system_salt_;
}
-void CryptohomeLibrary::LoadSystemSalt() {
+void SystemSaltGetter::LoadSystemSalt() {
if (!system_salt_.empty())
return;
std::vector<uint8> salt;
@@ -54,32 +54,32 @@ void CryptohomeLibrary::LoadSystemSalt() {
}
// static
-void CryptohomeLibrary::Initialize() {
- CHECK(!g_cryptohome_library);
- g_cryptohome_library = new CryptohomeLibrary();
+void SystemSaltGetter::Initialize() {
+ CHECK(!g_system_salt_getter);
+ g_system_salt_getter = new SystemSaltGetter();
}
// static
-bool CryptohomeLibrary::IsInitialized() {
- return g_cryptohome_library;
+bool SystemSaltGetter::IsInitialized() {
+ return g_system_salt_getter;
}
// static
-void CryptohomeLibrary::Shutdown() {
- CHECK(g_cryptohome_library);
- delete g_cryptohome_library;
- g_cryptohome_library = NULL;
+void SystemSaltGetter::Shutdown() {
+ CHECK(g_system_salt_getter);
+ delete g_system_salt_getter;
+ g_system_salt_getter = NULL;
}
// static
-CryptohomeLibrary* CryptohomeLibrary::Get() {
- CHECK(g_cryptohome_library)
- << "CryptohomeLibrary::Get() called before Initialize()";
- return g_cryptohome_library;
+SystemSaltGetter* SystemSaltGetter::Get() {
+ CHECK(g_system_salt_getter)
+ << "SystemSaltGetter::Get() called before Initialize()";
+ return g_system_salt_getter;
}
// static
-std::string CryptohomeLibrary::ConvertRawSaltToHexString(
+std::string SystemSaltGetter::ConvertRawSaltToHexString(
const std::vector<uint8>& salt) {
return StringToLowerASCII(base::HexEncode(
reinterpret_cast<const void*>(salt.data()), salt.size()));
diff --git a/chromeos/cryptohome/cryptohome_library.h b/chromeos/cryptohome/system_salt_getter.h
index f61f275..d154ff2 100644
--- a/chromeos/cryptohome/cryptohome_library.h
+++ b/chromeos/cryptohome/system_salt_getter.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_CRYPTOHOME_CRYPTOHOME_LIBRARY_H_
-#define CHROMEOS_CRYPTOHOME_CRYPTOHOME_LIBRARY_H_
+#ifndef CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_
+#define CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_
#include <string>
#include <vector>
@@ -15,8 +15,7 @@
namespace chromeos {
// This class is used to get the system salt from cryptohome and cache it.
-// TODO(satorux): Rename this to SystemSaltGetter. crbug.com/305906
-class CHROMEOS_EXPORT CryptohomeLibrary {
+class CHROMEOS_EXPORT SystemSaltGetter {
public:
typedef base::Callback<void(const std::string& system_salt)>
GetSystemSaltCallback;
@@ -25,7 +24,7 @@ class CHROMEOS_EXPORT CryptohomeLibrary {
static void Initialize();
static bool IsInitialized();
static void Shutdown();
- static CryptohomeLibrary* Get();
+ static SystemSaltGetter* Get();
// Converts |salt| to a hex encoded string.
static std::string ConvertRawSaltToHexString(const std::vector<uint8>& salt);
@@ -46,8 +45,8 @@ class CHROMEOS_EXPORT CryptohomeLibrary {
std::string GetCachedSystemSalt();
protected:
- CryptohomeLibrary();
- ~CryptohomeLibrary();
+ SystemSaltGetter();
+ ~SystemSaltGetter();
private:
// Loads the system salt from cryptohome and caches it.
@@ -55,9 +54,9 @@ class CHROMEOS_EXPORT CryptohomeLibrary {
std::string system_salt_;
- DISALLOW_COPY_AND_ASSIGN(CryptohomeLibrary);
+ DISALLOW_COPY_AND_ASSIGN(SystemSaltGetter);
};
} // namespace chromeos
-#endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_LIBRARY_H_
+#endif // CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_