GoogleURLTrackerInfoBarDelegate: Initialize uninitialized member in constructor.
[chromium-blink-merge.git] / chromeos / cryptohome / cryptohome_parameters.h
blob5e6bb2f18a41a995313f2e3252ced80f9ddf16d7
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_
6 #define CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "chromeos/chromeos_export.h"
14 namespace cryptohome {
16 enum AuthKeyPrivileges {
17 PRIV_MOUNT = 1 << 0, // Can mount with this key.
18 PRIV_ADD = 1 << 1, // Can add new keys.
19 PRIV_REMOVE = 1 << 2, // Can remove other keys.
20 PRIV_MIGRATE = 1 << 3, // Destroy all keys and replace with new.
21 PRIV_AUTHORIZED_UPDATE = 1 << 4, // Key can be updated in place.
22 PRIV_DEFAULT = PRIV_MOUNT | PRIV_ADD | PRIV_REMOVE | PRIV_MIGRATE
25 // Identification of the user calling cryptohome method.
26 struct CHROMEOS_EXPORT Identification {
27 explicit Identification(const std::string& user_id) : user_id(user_id) {}
28 std::string user_id;
31 // Definition of the key (e.g. password) for the cryptohome.
32 // It contains authorization data along with extra parameters like perimissions
33 // associated with this key.
34 struct CHROMEOS_EXPORT KeyDefinition {
35 KeyDefinition(const std::string& key,
36 const std::string& label,
37 int /*AuthKeyPrivileges*/ privileges);
38 ~KeyDefinition();
39 std::string label;
41 int revision;
42 std::string key;
44 std::string encryption_key;
45 std::string signature_key;
46 // Privileges associated with key. Combination of |AuthKeyPrivileges| values.
47 int privileges;
50 // Authorization attempt data for user.
51 struct CHROMEOS_EXPORT Authorization {
52 Authorization(const std::string& key, const std::string& label);
53 explicit Authorization(const KeyDefinition& key);
54 std::string key;
55 std::string label;
58 // Parameters for Mount call.
59 class CHROMEOS_EXPORT MountParameters {
60 public:
61 explicit MountParameters(bool ephemeral);
62 ~MountParameters();
64 // If |true|, the mounted home dir will be backed by tmpfs. If |false|, the
65 // ephemeral users policy decides whether tmpfs or an encrypted directory is
66 // used as the backend.
67 bool ephemeral;
69 // If not empty, home dir will be created with these keys if it exist.
70 std::vector<KeyDefinition> create_keys;
73 } // namespace cryptohome
75 #endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_