OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return CacheCallback( | 84 return CacheCallback( |
85 chromeos::CryptohomeAsyncRemove(user_email.c_str()), | 85 chromeos::CryptohomeAsyncRemove(user_email.c_str()), |
86 d, | 86 d, |
87 "Couldn't initiate async removal of cryptohome."); | 87 "Couldn't initiate async removal of cryptohome."); |
88 } | 88 } |
89 | 89 |
90 virtual bool IsMounted() OVERRIDE { | 90 virtual bool IsMounted() OVERRIDE { |
91 return chromeos::CryptohomeIsMounted(); | 91 return chromeos::CryptohomeIsMounted(); |
92 } | 92 } |
93 | 93 |
94 virtual bool AsyncSetOwnerUser( | |
95 const std::string& username, Delegate* d) OVERRIDE { | |
96 return CacheCallback( | |
97 chromeos::CryptohomeAsyncSetOwnerUser(username.c_str()), | |
98 d, | |
99 "Couldn't do set owner user in Cryptohomed."); | |
100 } | |
101 | |
102 virtual bool TpmIsReady() OVERRIDE { | 94 virtual bool TpmIsReady() OVERRIDE { |
103 return chromeos::CryptohomeTpmIsReady(); | 95 return chromeos::CryptohomeTpmIsReady(); |
104 } | 96 } |
105 | 97 |
106 virtual bool TpmIsEnabled() OVERRIDE { | 98 virtual bool TpmIsEnabled() OVERRIDE { |
107 return chromeos::CryptohomeTpmIsEnabled(); | 99 return chromeos::CryptohomeTpmIsEnabled(); |
108 } | 100 } |
109 | 101 |
110 virtual bool TpmIsOwned() OVERRIDE { | 102 virtual bool TpmIsOwned() OVERRIDE { |
111 return chromeos::CryptohomeTpmIsOwned(); | 103 return chromeos::CryptohomeTpmIsOwned(); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 BrowserThread::PostTask( | 294 BrowserThread::PostTask( |
303 BrowserThread::UI, FROM_HERE, | 295 BrowserThread::UI, FROM_HERE, |
304 base::Bind(&DoStubCallback, callback)); | 296 base::Bind(&DoStubCallback, callback)); |
305 return true; | 297 return true; |
306 } | 298 } |
307 | 299 |
308 virtual bool IsMounted() OVERRIDE { | 300 virtual bool IsMounted() OVERRIDE { |
309 return true; | 301 return true; |
310 } | 302 } |
311 | 303 |
312 virtual bool AsyncSetOwnerUser( | |
313 const std::string& username, Delegate* callback) OVERRIDE { | |
314 BrowserThread::PostTask( | |
315 BrowserThread::UI, FROM_HERE, | |
316 base::Bind(&DoStubCallback, callback)); | |
317 return true; | |
318 } | |
319 | |
320 // Tpm begin ready after 20-th call. | 304 // Tpm begin ready after 20-th call. |
321 virtual bool TpmIsReady() OVERRIDE { | 305 virtual bool TpmIsReady() OVERRIDE { |
322 static int counter = 0; | 306 static int counter = 0; |
323 return ++counter > 20; | 307 return ++counter > 20; |
324 } | 308 } |
325 | 309 |
326 virtual bool TpmIsEnabled() OVERRIDE { | 310 virtual bool TpmIsEnabled() OVERRIDE { |
327 return true; | 311 return true; |
328 } | 312 } |
329 | 313 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 CryptohomeLibrary* impl; | 397 CryptohomeLibrary* impl; |
414 if (stub) | 398 if (stub) |
415 impl = new CryptohomeLibraryStubImpl(); | 399 impl = new CryptohomeLibraryStubImpl(); |
416 else | 400 else |
417 impl = new CryptohomeLibraryImpl(); | 401 impl = new CryptohomeLibraryImpl(); |
418 impl->Init(); | 402 impl->Init(); |
419 return impl; | 403 return impl; |
420 } | 404 } |
421 | 405 |
422 } // namespace chromeos | 406 } // namespace chromeos |
OLD | NEW |