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

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: Rebase Created 8 years, 8 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 #include "chrome/browser/chromeos/dbus/dbus_client_implementation_type.h"
15 #include "chrome/browser/chromeos/dbus/dbus_method_call_status.h"
16
17 namespace dbus {
18 class Bus;
19 }
20
21 namespace chromeos {
22
23 // CryptohomeClient is used to communicate with the Cryptohome service.
24 // All method should be called from the origin thread (UI thread) which
25 // initializes the DBusThreadManager instance.
26 class CryptohomeClient {
27 public:
28 // A callback to handle AsyncCallStatus signals.
29 typedef base::Callback<void(int async_id, bool return_status, int return_code)
30 > AsyncCallStatusHandler;
31 // A callback to handle responses of AsyncXXX methods.
32 typedef base::Callback<void(int async_id)> AsyncMethodCallback;
33 // A callback to handle responses of methods returning a bool value.
34 typedef base::Callback<void(DBusMethodCallStatus call_status,
35 bool result)> BoolMethodCallback;
36 // A callback to handle responses of Pkcs11GetTpmTokenInfo method.
37 typedef base::Callback<void(
38 DBusMethodCallStatus call_status,
39 const std::string& label,
40 const std::string& user_pin)> Pkcs11GetTpmTokenInfoCallback;
41
42 virtual ~CryptohomeClient();
43
44 // Factory function, creates a new instance and returns ownership.
45 // For normal usage, access the singleton via DBusThreadManager::Get().
46 static CryptohomeClient* Create(DBusClientImplementationType type,
47 dbus::Bus* bus);
48
49 // Sets AsyncCallStatus signal handler.
50 // |handler| is called when results for AsyncXXX methods are returned.
51 // Cryptohome service will process the calls in a first-in-first-out manner
52 // when they are made in parallel.
53 virtual void SetAsyncCallStatusHandler(AsyncCallStatusHandler handler) = 0;
54
55 // Resets AsyncCallStatus signal handler.
56 virtual void ResetAsyncCallStatusHandler() = 0;
57
58 // Calls IsMounted method and returns true when the call succeeds.
59 // This method blocks until the call returns.
60 virtual bool IsMounted(bool* is_mounted) = 0;
61
62 // Calls Unmount method and returns true when the call succeeds.
63 // This method blocks until the call returns.
64 virtual bool Unmount(bool* success) = 0;
65
66 // Calls AsyncCheckKey method. |callback| is called after the method call
67 // succeeds.
68 virtual void AsyncCheckKey(const std::string& username,
69 const std::string& key,
70 AsyncMethodCallback callback) = 0;
71
72 // Calls AsyncMigrateKey method. |callback| is called after the method call
73 // succeeds.
74 virtual void AsyncMigrateKey(const std::string& username,
75 const std::string& from_key,
76 const std::string& to_key,
77 AsyncMethodCallback callback) = 0;
78
79 // Calls AsyncRemove method. |callback| is called after the method call
80 // succeeds.
81 virtual void AsyncRemove(const std::string& username,
82 AsyncMethodCallback callback) = 0;
83
84 // Calls GetSystemSalt method. This method blocks until the call returns.
85 // The original content of |salt| is lost.
86 virtual bool GetSystemSalt(std::vector<uint8>* salt) = 0;
87
88 // Calls AsyncMount method. |callback| is called after the method call
89 // succeeds.
90 virtual void AsyncMount(const std::string& username,
91 const std::string& key,
92 const bool create_if_missing,
93 AsyncMethodCallback callback) = 0;
94
95 // Calls AsyncMountGuest method. |callback| is called after the method call
96 // succeeds.
97 virtual void AsyncMountGuest(AsyncMethodCallback callback) = 0;
98
99 // Calls TpmIsReady method and returns true when the call succeeds.
100 // This method blocks until the call returns.
101 virtual bool TpmIsReady(bool* ready) = 0;
102
103 // Calls TpmIsEnabled method.
104 virtual void TpmIsEnabled(BoolMethodCallback callback) = 0;
105
106 // Calls TpmIsEnabled method and returns true when the call succeeds.
107 // This method blocks until the call returns.
108 // TODO(hashimoto): Remove this method. crosbug.com/28500
109 virtual bool CallTpmIsEnabledAndBlock(bool* enabled) = 0;
110
111 // Calls TpmGetPassword method and returns true when the call succeeds.
112 // This method blocks until the call returns.
113 // The original content of |password| is lost.
114 virtual bool TpmGetPassword(std::string* password) = 0;
115
116 // Calls TpmIsOwned method and returns true when the call succeeds.
117 // This method blocks until the call returns.
118 virtual bool TpmIsOwned(bool* owned) = 0;
119
120 // Calls TpmIsBeingOwned method and returns true when the call succeeds.
121 // This method blocks until the call returns.
122 virtual bool TpmIsBeingOwned(bool* owning) = 0;
123
124 // Calls TpmCanAttemptOwnership method and returns true when the call
125 // succeeds. This method blocks until the call returns.
126 virtual bool TpmCanAttemptOwnership() = 0;
127
128 // Calls TpmClearStoredPassword method and returns true when the call
129 // succeeds. This method blocks until the call returns.
130 virtual bool TpmClearStoredPassword() = 0;
131
132 // Calls Pkcs11IsTpmTokenReady method.
133 virtual void Pkcs11IsTpmTokenReady(BoolMethodCallback callback) = 0;
134
135 // Calls Pkcs11GetTpmTokenInfo method.
136 virtual void Pkcs11GetTpmTokenInfo(
137 Pkcs11GetTpmTokenInfoCallback callback) = 0;
138
139 // Calls InstallAttributesGet method and returns true when the call succeeds.
140 // This method blocks until the call returns.
141 // The original content of |value| is lost.
142 virtual bool InstallAttributesGet(const std::string& name,
143 std::vector<uint8>* value,
144 bool* successful) = 0;
145
146 // Calls InstallAttributesSet method and returns true when the call succeeds.
147 // This method blocks until the call returns.
148 virtual bool InstallAttributesSet(const std::string& name,
149 const std::vector<uint8>& value,
150 bool* successful) = 0;
151
152 // Calls InstallAttributesFinalize method and returns true when the call
153 // succeeds. This method blocks until the call returns.
154 virtual bool InstallAttributesFinalize(bool* successful) = 0;
155
156 // Calls InstallAttributesIsReady method and returns true when the call
157 // succeeds. This method blocks until the call returns.
158 virtual bool InstallAttributesIsReady(bool* is_ready) = 0;
159
160 // Calls InstallAttributesIsInvalid method and returns true when the call
161 // succeeds. This method blocks until the call returns.
162 virtual bool InstallAttributesIsInvalid(bool* is_invalid) = 0;
163
164 // Calls InstallAttributesIsFirstInstall method and returns true when the call
165 // succeeds. This method blocks until the call returns.
166 virtual bool InstallAttributesIsFirstInstall(bool* is_first_install) = 0;
167
168 protected:
169 // Create() should be used instead.
170 CryptohomeClient();
171
172 private:
173 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient);
174 };
175
176 } // namespace chromeos
177
178 #endif // CHROME_BROWSER_CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/dbus/cros_disks_client.cc ('k') | chrome/browser/chromeos/dbus/cryptohome_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698