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

Side by Side Diff: chrome/browser/chromeos/dbus/cryptohome_client.h

Issue 9838085: Move files inside chrome/browser/chromeos/dbus to chromeos/dbus (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: _ Created 8 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_
6 #define CHROME_BROWSER_CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 #include "base/basictypes.h"
13 #include "base/callback.h"
14
15 namespace dbus {
16 class Bus;
17 }
18
19 namespace chromeos {
20
21 // CryptohomeClient is used to communicate with the Cryptohome service.
22 // All method should be called from the origin thread (UI thread) which
23 // initializes the DBusThreadManager instance.
24 class CryptohomeClient {
25 public:
26 // An enum to describe whether or not a DBus method call succeeded.
27 enum CallStatus{
28 FAILURE,
29 SUCCESS,
30 };
31 // A callback to handle AsyncCallStatus signals.
32 typedef base::Callback<void(int async_id, bool return_status, int return_code)
33 > AsyncCallStatusHandler;
34 // A callback to handle responses of AsyncXXX methods.
35 typedef base::Callback<void(int async_id)> AsyncMethodCallback;
36 // A callback to handle responses of Pkcs11IsTpmTokenReady method.
37 typedef base::Callback<void(CallStatus call_status, bool ready)>
38 Pkcs11IsTpmTokenReadyCallback;
39 // A callback to handle responses of Pkcs11GetTpmTokenInfo method.
40 typedef base::Callback<void(
41 CallStatus call_status,
42 const std::string& label,
43 const std::string& user_pin)> Pkcs11GetTpmTokenInfoCallback;
44
45 virtual ~CryptohomeClient();
46
47 // Factory function, creates a new instance and returns ownership.
48 // For normal usage, access the singleton via DBusThreadManager::Get().
49 static CryptohomeClient* Create(dbus::Bus* bus);
50
51 // Sets AsyncCallStatus signal handler.
52 // |handler| is called when results for AsyncXXX methods are returned.
53 // Cryptohome service will process the calls in a first-in-first-out manner
54 // when they are made in parallel.
55 virtual void SetAsyncCallStatusHandler(AsyncCallStatusHandler handler) = 0;
56
57 // Resets AsyncCallStatus signal handler.
58 virtual void ResetAsyncCallStatusHandler() = 0;
59
60 // Calls IsMounted method and returns true when the call succeeds.
61 // This method blocks until the call returns.
62 virtual bool IsMounted(bool* is_mounted) = 0;
63
64 // Calls AsyncCheckKey method. |callback| is called after the method call
65 // succeeds.
66 virtual void AsyncCheckKey(const std::string& username,
67 const std::string& key,
68 AsyncMethodCallback callback) = 0;
69
70 // Calls AsyncMigrateKey method. |callback| is called after the method call
71 // succeeds.
72 virtual void AsyncMigrateKey(const std::string& username,
73 const std::string& from_key,
74 const std::string& to_key,
75 AsyncMethodCallback callback) = 0;
76
77 // Calls AsyncRemove method. |callback| is called after the method call
78 // succeeds.
79 virtual void AsyncRemove(const std::string& username,
80 AsyncMethodCallback callback) = 0;
81
82 // Calls GetSystemSalt method. This method blocks until the call returns.
83 // The original content of |salt| is lost.
84 virtual bool GetSystemSalt(std::vector<uint8>* salt) = 0;
85
86 // Calls AsyncMount method. |callback| is called after the method call
87 // succeeds.
88 virtual void AsyncMount(const std::string& username,
89 const std::string& key,
90 const bool create_if_missing,
91 AsyncMethodCallback callback) = 0;
92
93 // Calls AsyncMountGuest method. |callback| is called after the method call
94 // succeeds.
95 virtual void AsyncMountGuest(AsyncMethodCallback callback) = 0;
96
97 // Calls TpmIsReady method and returns true when the call succeeds.
98 // This method blocks until the call returns.
99 virtual bool TpmIsReady(bool* ready) = 0;
100
101 // Calls TpmIsEnabled method and returns true when the call succeeds.
102 // This method blocks until the call returns.
103 virtual bool TpmIsEnabled(bool* enabled) = 0;
104
105 // Calls TpmGetPassword method and returns true when the call succeeds.
106 // This method blocks until the call returns.
107 // The original content of |password| is lost.
108 virtual bool TpmGetPassword(std::string* password) = 0;
109
110 // Calls TpmIsOwned method and returns true when the call succeeds.
111 // This method blocks until the call returns.
112 virtual bool TpmIsOwned(bool* owned) = 0;
113
114 // Calls TpmIsBeingOwned method and returns true when the call succeeds.
115 // This method blocks until the call returns.
116 virtual bool TpmIsBeingOwned(bool* owning) = 0;
117
118 // Calls TpmCanAttemptOwnership method and returns true when the call
119 // succeeds. This method blocks until the call returns.
120 virtual bool TpmCanAttemptOwnership() = 0;
121
122 // Calls TpmClearStoredPassword method and returns true when the call
123 // succeeds. This method blocks until the call returns.
124 virtual bool TpmClearStoredPassword() = 0;
125
126 // Calls Pkcs11IsTpmTokenReady method.
127 virtual void Pkcs11IsTpmTokenReady(
128 Pkcs11IsTpmTokenReadyCallback callback) = 0;
129
130 // Calls Pkcs11GetTpmTokenInfo method.
131 virtual void Pkcs11GetTpmTokenInfo(
132 Pkcs11GetTpmTokenInfoCallback callback) = 0;
133
134 // Calls InstallAttributesGet method and returns true when the call succeeds.
135 // This method blocks until the call returns.
136 // The original content of |value| is lost.
137 virtual bool InstallAttributesGet(const std::string& name,
138 std::vector<uint8>* value,
139 bool* successful) = 0;
140
141 // Calls InstallAttributesSet method and returns true when the call succeeds.
142 // This method blocks until the call returns.
143 virtual bool InstallAttributesSet(const std::string& name,
144 const std::vector<uint8>& value,
145 bool* successful) = 0;
146
147 // Calls InstallAttributesFinalize method and returns true when the call
148 // succeeds. This method blocks until the call returns.
149 virtual bool InstallAttributesFinalize(bool* successful) = 0;
150
151 // Calls InstallAttributesIsReady method and returns true when the call
152 // succeeds. This method blocks until the call returns.
153 virtual bool InstallAttributesIsReady(bool* is_ready) = 0;
154
155 // Calls InstallAttributesIsInvalid method and returns true when the call
156 // succeeds. This method blocks until the call returns.
157 virtual bool InstallAttributesIsInvalid(bool* is_invalid) = 0;
158
159 // Calls InstallAttributesIsFirstInstall method and returns true when the call
160 // succeeds. This method blocks until the call returns.
161 virtual bool InstallAttributesIsFirstInstall(bool* is_first_install) = 0;
162
163 protected:
164 // Create() should be used instead.
165 CryptohomeClient();
166
167 private:
168 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient);
169 };
170
171 } // namespace chromeos
172
173 #endif // CHROME_BROWSER_CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698