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

Unified Diff: chromeos/cryptohome/cryptohome_parameters.h

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better condition in LOG_ASSERT in AccountId. Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/cryptohome/cryptohome_parameters.h
diff --git a/chromeos/cryptohome/cryptohome_parameters.h b/chromeos/cryptohome/cryptohome_parameters.h
index 3738b56bce8870607b828197b32cfd6552119f30..ef2f9f14a35a27b9f1f2b868efcced7bb1a979e7 100644
--- a/chromeos/cryptohome/cryptohome_parameters.h
+++ b/chromeos/cryptohome/cryptohome_parameters.h
@@ -10,9 +10,12 @@
#include <string>
#include <vector>
+#include "base/containers/hash_tables.h"
#include "base/memory/scoped_ptr.h"
#include "chromeos/chromeos_export.h"
+class AccountId;
+
namespace cryptohome {
enum AuthKeyPrivileges {
@@ -25,12 +28,25 @@ enum AuthKeyPrivileges {
};
// Identification of the user calling cryptohome method.
-struct CHROMEOS_EXPORT Identification {
- explicit Identification(const std::string& user_id);
+class CHROMEOS_EXPORT Identification {
+ public:
+ Identification();
+
+ explicit Identification(const AccountId& account_id);
bool operator==(const Identification& other) const;
- std::string user_id;
+ // This method should be used for migration purpose only.
+ static Identification FromString(const std::string& id);
+
+ const std::string& id() const { return id_; }
+
+ bool operator<(const Identification& right) const;
+
+ private:
+ explicit Identification(const std::string&);
+
+ std::string id_;
};
// Definition of the key (e.g. password) for the cryptohome.
@@ -145,6 +161,25 @@ class CHROMEOS_EXPORT MountParameters {
std::vector<KeyDefinition> create_keys;
};
+// This function returns true if cryptohome of |account_id| is migrated to
+// gaiaId-based identifier (AccountId::GetGaiaIdKey()).
+bool GetGaiaIdMigrationStatus(const AccountId& account_id);
+
+// This function marks |account_id| cryptohome migrated to gaiaId-based
+// identifier (AccountId::GetGaiaIdKey()).
+void SetGaiaIdMigrationStatusDone(const AccountId& account_id);
+
} // namespace cryptohome
+namespace BASE_HASH_NAMESPACE {
+
+// Implement hashing of cryptohome::Identification, so it can be used as a key
+// in STL containers.
+template <>
+struct hash<cryptohome::Identification> {
+ std::size_t operator()(const cryptohome::Identification& cryptohome_id) const;
+};
+
+} // namespace BASE_HASH_NAMESPACE
+
#endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_

Powered by Google App Engine
This is Rietveld 408576698