| 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/cros/cryptohome_library.h" | 5 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" |
| 9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 10 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 12 #include "chromeos/dbus/cryptohome_client.h" | 13 #include "chromeos/dbus/cryptohome_client.h" |
| 13 #include "chromeos/dbus/dbus_thread_manager.h" | 14 #include "chromeos/dbus/dbus_thread_manager.h" |
| 14 | 15 |
| 16 namespace chromeos { |
| 17 |
| 15 namespace { | 18 namespace { |
| 16 | 19 |
| 17 const char kStubSystemSalt[] = "stub_system_salt"; | 20 const char kStubSystemSalt[] = "stub_system_salt"; |
| 18 | 21 |
| 19 } | 22 // Does nothing. Used as a Cryptohome::VoidMethodCallback. |
| 23 void DoNothing(DBusMethodCallStatus call_status) {} |
| 20 | 24 |
| 21 namespace chromeos { | 25 } // namespace |
| 22 | 26 |
| 23 // This class handles the interaction with the ChromeOS cryptohome library APIs. | 27 // This class handles the interaction with the ChromeOS cryptohome library APIs. |
| 24 class CryptohomeLibraryImpl : public CryptohomeLibrary { | 28 class CryptohomeLibraryImpl : public CryptohomeLibrary { |
| 25 public: | 29 public: |
| 26 CryptohomeLibraryImpl() : weak_ptr_factory_(this) { | 30 CryptohomeLibraryImpl() : weak_ptr_factory_(this) { |
| 27 } | 31 } |
| 28 | 32 |
| 29 virtual ~CryptohomeLibraryImpl() { | 33 virtual ~CryptohomeLibraryImpl() { |
| 30 } | 34 } |
| 31 | 35 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 42 return result; | 46 return result; |
| 43 } | 47 } |
| 44 | 48 |
| 45 virtual bool TpmIsBeingOwned() OVERRIDE { | 49 virtual bool TpmIsBeingOwned() OVERRIDE { |
| 46 bool result = false; | 50 bool result = false; |
| 47 DBusThreadManager::Get()->GetCryptohomeClient()->TpmIsBeingOwned(&result); | 51 DBusThreadManager::Get()->GetCryptohomeClient()->TpmIsBeingOwned(&result); |
| 48 return result; | 52 return result; |
| 49 } | 53 } |
| 50 | 54 |
| 51 virtual void TpmCanAttemptOwnership() OVERRIDE { | 55 virtual void TpmCanAttemptOwnership() OVERRIDE { |
| 52 DBusThreadManager::Get()->GetCryptohomeClient()->TpmCanAttemptOwnership(); | 56 DBusThreadManager::Get()->GetCryptohomeClient()->TpmCanAttemptOwnership( |
| 57 base::Bind(&DoNothing)); |
| 53 } | 58 } |
| 54 | 59 |
| 55 virtual void TpmClearStoredPassword() OVERRIDE { | 60 virtual void TpmClearStoredPassword() OVERRIDE { |
| 56 DBusThreadManager::Get()->GetCryptohomeClient()->TpmClearStoredPassword(); | 61 DBusThreadManager::Get()->GetCryptohomeClient()->TpmClearStoredPassword(); |
| 57 } | 62 } |
| 58 | 63 |
| 59 virtual bool InstallAttributesGet( | 64 virtual bool InstallAttributesGet( |
| 60 const std::string& name, std::string* value) OVERRIDE { | 65 const std::string& name, std::string* value) OVERRIDE { |
| 61 std::vector<uint8> buf; | 66 std::vector<uint8> buf; |
| 62 bool success = false; | 67 bool success = false; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { | 207 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { |
| 203 CryptohomeLibrary* impl; | 208 CryptohomeLibrary* impl; |
| 204 if (stub) | 209 if (stub) |
| 205 impl = new CryptohomeLibraryStubImpl(); | 210 impl = new CryptohomeLibraryStubImpl(); |
| 206 else | 211 else |
| 207 impl = new CryptohomeLibraryImpl(); | 212 impl = new CryptohomeLibraryImpl(); |
| 208 return impl; | 213 return impl; |
| 209 } | 214 } |
| 210 | 215 |
| 211 } // namespace chromeos | 216 } // namespace chromeos |
| OLD | NEW |