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

Side by Side Diff: chrome/browser/chromeos/cros/cryptohome_library.cc

Issue 3442009: [Chrome OS] Attempt offline and online login simultaneously (Closed)
Patch Set: Fix crash on data recover Created 10 years, 2 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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 5 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
6 6
7 #include "base/hash_tables.h" 7 #include "base/hash_tables.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/browser/chrome_thread.h" 9 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/browser/chromeos/cros/cros_library.h" 10 #include "chrome/browser/chromeos/cros/cros_library.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 bool MountForBwsi(int* error_code) { 78 bool MountForBwsi(int* error_code) {
79 return chromeos::CryptohomeMountGuest(error_code); 79 return chromeos::CryptohomeMountGuest(error_code);
80 } 80 }
81 81
82 bool AsyncMountForBwsi(Delegate* d) { 82 bool AsyncMountForBwsi(Delegate* d) {
83 return CacheCallback(chromeos::CryptohomeAsyncMountGuest(), 83 return CacheCallback(chromeos::CryptohomeAsyncMountGuest(),
84 d, 84 d,
85 "Couldn't initiate async mount of cryptohome."); 85 "Couldn't initiate async mount of cryptohome.");
86 } 86 }
87 87
88 bool Unmount() {
89 return chromeos::CryptohomeUnmount();
90 }
91
88 bool Remove(const std::string& user_email) { 92 bool Remove(const std::string& user_email) {
89 return chromeos::CryptohomeRemove(user_email.c_str()); 93 return chromeos::CryptohomeRemove(user_email.c_str());
90 } 94 }
91 95
92 bool AsyncRemove(const std::string& user_email, Delegate* d) { 96 bool AsyncRemove(const std::string& user_email, Delegate* d) {
93 return CacheCallback( 97 return CacheCallback(
94 chromeos::CryptohomeAsyncRemove(user_email.c_str()), 98 chromeos::CryptohomeAsyncRemove(user_email.c_str()),
95 d, 99 d,
96 "Couldn't initiate async removal of cryptohome."); 100 "Couldn't initiate async removal of cryptohome.");
97 } 101 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 bool AsyncMigrateKey(const std::string& user_email, 175 bool AsyncMigrateKey(const std::string& user_email,
172 const std::string& old_hash, 176 const std::string& old_hash,
173 const std::string& new_hash, 177 const std::string& new_hash,
174 Delegate* callback) { 178 Delegate* callback) {
175 ChromeThread::PostTask( 179 ChromeThread::PostTask(
176 ChromeThread::UI, FROM_HERE, 180 ChromeThread::UI, FROM_HERE,
177 NewRunnableFunction(&DoStubCallback, callback)); 181 NewRunnableFunction(&DoStubCallback, callback));
178 return true; 182 return true;
179 } 183 }
180 184
181 bool Remove(const std::string& user_email) {
182 return true;
183 }
184
185 bool AsyncRemove(const std::string& user_email, Delegate* callback) {
186 ChromeThread::PostTask(
187 ChromeThread::UI, FROM_HERE,
188 NewRunnableFunction(&DoStubCallback, callback));
189 return true;
190 }
191
192 bool Mount(const std::string& user_email, 185 bool Mount(const std::string& user_email,
193 const std::string& passhash, 186 const std::string& passhash,
194 int* error_code) { 187 int* error_code) {
195 return true; 188 return true;
196 } 189 }
197 190
198 bool AsyncMount(const std::string& user_email, 191 bool AsyncMount(const std::string& user_email,
199 const std::string& passhash, 192 const std::string& passhash,
200 const bool create_if_missing, 193 const bool create_if_missing,
201 Delegate* callback) { 194 Delegate* callback) {
202 ChromeThread::PostTask( 195 ChromeThread::PostTask(
203 ChromeThread::UI, FROM_HERE, 196 ChromeThread::UI, FROM_HERE,
204 NewRunnableFunction(&DoStubCallback, callback)); 197 NewRunnableFunction(&DoStubCallback, callback));
205 return true; 198 return true;
206 } 199 }
207 200
208 bool MountForBwsi(int* error_code) { 201 bool MountForBwsi(int* error_code) {
209 return true; 202 return true;
210 } 203 }
211 204
212 bool AsyncMountForBwsi(Delegate* callback) { 205 bool AsyncMountForBwsi(Delegate* callback) {
213 ChromeThread::PostTask( 206 ChromeThread::PostTask(
214 ChromeThread::UI, FROM_HERE, 207 ChromeThread::UI, FROM_HERE,
215 NewRunnableFunction(&DoStubCallback, callback)); 208 NewRunnableFunction(&DoStubCallback, callback));
216 return true; 209 return true;
217 } 210 }
218 211
212 bool Unmount() {
213 return true;
214 }
215
216 bool Remove(const std::string& user_email) {
217 return true;
218 }
219
220 bool AsyncRemove(const std::string& user_email, Delegate* callback) {
221 ChromeThread::PostTask(
222 ChromeThread::UI, FROM_HERE,
223 NewRunnableFunction(&DoStubCallback, callback));
224 return true;
225 }
226
219 bool IsMounted() { 227 bool IsMounted() {
220 return true; 228 return true;
221 } 229 }
222 230
223 CryptohomeBlob GetSystemSalt() { 231 CryptohomeBlob GetSystemSalt() {
224 CryptohomeBlob salt = CryptohomeBlob(); 232 CryptohomeBlob salt = CryptohomeBlob();
225 salt.push_back(0); 233 salt.push_back(0);
226 salt.push_back(0); 234 salt.push_back(0);
227 return salt; 235 return salt;
228 } 236 }
229 237
230 private: 238 private:
231 static void DoStubCallback(Delegate* callback) { 239 static void DoStubCallback(Delegate* callback) {
232 callback->OnComplete(true, kCryptohomeMountErrorNone); 240 callback->OnComplete(true, kCryptohomeMountErrorNone);
233 } 241 }
234 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryStubImpl); 242 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryStubImpl);
235 }; 243 };
236 244
237 // static 245 // static
238 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { 246 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) {
239 if (stub) 247 if (stub)
240 return new CryptohomeLibraryStubImpl(); 248 return new CryptohomeLibraryStubImpl();
241 else 249 else
242 return new CryptohomeLibraryImpl(); 250 return new CryptohomeLibraryImpl();
243 } 251 }
244 252
245 } // namespace chromeos 253 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698