OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 5 #ifndef CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
6 #define CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 6 #define CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
15 | 15 |
16 class AccountId; | |
17 | |
16 namespace cryptohome { | 18 namespace cryptohome { |
17 | 19 |
18 enum AuthKeyPrivileges { | 20 enum AuthKeyPrivileges { |
19 PRIV_MOUNT = 1 << 0, // Can mount with this key. | 21 PRIV_MOUNT = 1 << 0, // Can mount with this key. |
20 PRIV_ADD = 1 << 1, // Can add new keys. | 22 PRIV_ADD = 1 << 1, // Can add new keys. |
21 PRIV_REMOVE = 1 << 2, // Can remove other keys. | 23 PRIV_REMOVE = 1 << 2, // Can remove other keys. |
22 PRIV_MIGRATE = 1 << 3, // Destroy all keys and replace with new. | 24 PRIV_MIGRATE = 1 << 3, // Destroy all keys and replace with new. |
23 PRIV_AUTHORIZED_UPDATE = 1 << 4, // Key can be updated in place. | 25 PRIV_AUTHORIZED_UPDATE = 1 << 4, // Key can be updated in place. |
24 PRIV_DEFAULT = PRIV_MOUNT | PRIV_ADD | PRIV_REMOVE | PRIV_MIGRATE | 26 PRIV_DEFAULT = PRIV_MOUNT | PRIV_ADD | PRIV_REMOVE | PRIV_MIGRATE |
25 }; | 27 }; |
26 | 28 |
27 // Identification of the user calling cryptohome method. | 29 // Identification of the user calling cryptohome method. |
28 struct CHROMEOS_EXPORT Identification { | 30 class CHROMEOS_EXPORT Identification { |
29 explicit Identification(const std::string& user_id); | 31 public: |
32 explicit Identification(const AccountId& account_id); | |
30 | 33 |
31 bool operator==(const Identification& other) const; | 34 bool operator==(const Identification& other) const; |
32 | 35 |
33 std::string user_id; | 36 // This method should be used for migration purpose only. |
37 static Identification FromString(const std::string& id); | |
38 | |
39 const std::string& id() const { return id_; } | |
40 | |
41 private: | |
42 explicit Identification(const std::string&); | |
43 | |
44 std::string id_; | |
34 }; | 45 }; |
xiyuan
2016/02/17 23:14:26
DISALLOW_COPY_AND_ASSIGN() ?
Alexander Alekseev
2016/02/18 13:45:14
It is copied and used in PostTask in several place
| |
35 | 46 |
36 // Definition of the key (e.g. password) for the cryptohome. | 47 // Definition of the key (e.g. password) for the cryptohome. |
37 // It contains authorization data along with extra parameters like permissions | 48 // It contains authorization data along with extra parameters like permissions |
38 // associated with this key. | 49 // associated with this key. |
39 struct CHROMEOS_EXPORT KeyDefinition { | 50 struct CHROMEOS_EXPORT KeyDefinition { |
40 enum Type { | 51 enum Type { |
41 TYPE_PASSWORD = 0 | 52 TYPE_PASSWORD = 0 |
42 }; | 53 }; |
43 | 54 |
44 struct AuthorizationData { | 55 struct AuthorizationData { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 // used as the backend. | 152 // used as the backend. |
142 bool ephemeral; | 153 bool ephemeral; |
143 | 154 |
144 // If not empty, home dir will be created with these keys if it exist. | 155 // If not empty, home dir will be created with these keys if it exist. |
145 std::vector<KeyDefinition> create_keys; | 156 std::vector<KeyDefinition> create_keys; |
146 }; | 157 }; |
147 | 158 |
148 } // namespace cryptohome | 159 } // namespace cryptohome |
149 | 160 |
150 #endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 161 #endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
OLD | NEW |