OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/dbus/cryptohome_client.h" | 5 #include "chrome/browser/chromeos/dbus/cryptohome_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 async_call_status_handler_.Reset(); | 92 async_call_status_handler_.Reset(); |
93 } | 93 } |
94 | 94 |
95 // CryptohomeClient override. | 95 // CryptohomeClient override. |
96 virtual bool IsMounted(bool* is_mounted) OVERRIDE { | 96 virtual bool IsMounted(bool* is_mounted) OVERRIDE { |
97 INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeIsMounted); | 97 INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeIsMounted); |
98 return CallMethodAndBlock(&method_call, base::Bind(&PopBool, is_mounted)); | 98 return CallMethodAndBlock(&method_call, base::Bind(&PopBool, is_mounted)); |
99 } | 99 } |
100 | 100 |
101 // CryptohomeClient override. | 101 // CryptohomeClient override. |
| 102 virtual bool Unmount(bool *success) OVERRIDE { |
| 103 INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeUnmount); |
| 104 return CallMethodAndBlock(&method_call, base::Bind(&PopBool, success)); |
| 105 } |
| 106 |
| 107 // CryptohomeClient override. |
102 virtual void AsyncCheckKey(const std::string& username, | 108 virtual void AsyncCheckKey(const std::string& username, |
103 const std::string& key, | 109 const std::string& key, |
104 AsyncMethodCallback callback) OVERRIDE { | 110 AsyncMethodCallback callback) OVERRIDE { |
105 INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeAsyncCheckKey); | 111 INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeAsyncCheckKey); |
106 dbus::MessageWriter writer(&method_call); | 112 dbus::MessageWriter writer(&method_call); |
107 writer.AppendString(username); | 113 writer.AppendString(username); |
108 writer.AppendString(key); | 114 writer.AppendString(key); |
109 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 115 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
110 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, | 116 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, |
111 weak_ptr_factory_.GetWeakPtr(), | 117 weak_ptr_factory_.GetWeakPtr(), |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 async_call_status_handler_.Reset(); | 464 async_call_status_handler_.Reset(); |
459 } | 465 } |
460 | 466 |
461 // CryptohomeClient override. | 467 // CryptohomeClient override. |
462 virtual bool IsMounted(bool* is_mounted) OVERRIDE { | 468 virtual bool IsMounted(bool* is_mounted) OVERRIDE { |
463 *is_mounted = true; | 469 *is_mounted = true; |
464 return true; | 470 return true; |
465 } | 471 } |
466 | 472 |
467 // CryptohomeClient override. | 473 // CryptohomeClient override. |
| 474 virtual bool Unmount(bool* success) OVERRIDE { |
| 475 *success = true; |
| 476 return true; |
| 477 } |
| 478 |
| 479 // CryptohomeClient override. |
468 virtual void AsyncCheckKey(const std::string& username, | 480 virtual void AsyncCheckKey(const std::string& username, |
469 const std::string& key, | 481 const std::string& key, |
470 AsyncMethodCallback callback) OVERRIDE { | 482 AsyncMethodCallback callback) OVERRIDE { |
471 ReturnAsyncMethodResult(callback); | 483 ReturnAsyncMethodResult(callback); |
472 } | 484 } |
473 | 485 |
474 // CryptohomeClient override. | 486 // CryptohomeClient override. |
475 virtual void AsyncMigrateKey(const std::string& username, | 487 virtual void AsyncMigrateKey(const std::string& username, |
476 const std::string& from_key, | 488 const std::string& from_key, |
477 const std::string& to_key, | 489 const std::string& to_key, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 | 668 |
657 // static | 669 // static |
658 CryptohomeClient* CryptohomeClient::Create(dbus::Bus* bus) { | 670 CryptohomeClient* CryptohomeClient::Create(dbus::Bus* bus) { |
659 if (base::chromeos::IsRunningOnChromeOS()) | 671 if (base::chromeos::IsRunningOnChromeOS()) |
660 return new CryptohomeClientImpl(bus); | 672 return new CryptohomeClientImpl(bus); |
661 else | 673 else |
662 return new CryptohomeClientStubImpl(); | 674 return new CryptohomeClientStubImpl(); |
663 } | 675 } |
664 | 676 |
665 } // namespace chromeos | 677 } // namespace chromeos |
OLD | NEW |