Chromium Code Reviews| 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) {} | |
|
stevenjb
2012/07/26 17:19:52
Should we consider adding this where DBusMethodCal
hashimoto
2012/07/27 04:37:18
We're having the exactly same function in cros_net
stevenjb
2012/07/30 22:24:38
Sounds good.
| |
| 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 16 matching lines...) Expand all Loading... | |
| 48 return result; | 52 return result; |
| 49 } | 53 } |
| 50 | 54 |
| 51 virtual bool TpmIsBeingOwned() OVERRIDE { | 55 virtual bool TpmIsBeingOwned() OVERRIDE { |
| 52 bool result = false; | 56 bool result = false; |
| 53 DBusThreadManager::Get()->GetCryptohomeClient()->TpmIsBeingOwned(&result); | 57 DBusThreadManager::Get()->GetCryptohomeClient()->TpmIsBeingOwned(&result); |
| 54 return result; | 58 return result; |
| 55 } | 59 } |
| 56 | 60 |
| 57 virtual void TpmCanAttemptOwnership() OVERRIDE { | 61 virtual void TpmCanAttemptOwnership() OVERRIDE { |
| 58 DBusThreadManager::Get()->GetCryptohomeClient()->TpmCanAttemptOwnership(); | 62 DBusThreadManager::Get()->GetCryptohomeClient()->TpmCanAttemptOwnership( |
| 63 base::Bind(&DoNothing)); | |
| 59 } | 64 } |
| 60 | 65 |
| 61 virtual void TpmClearStoredPassword() OVERRIDE { | 66 virtual void TpmClearStoredPassword() OVERRIDE { |
| 62 DBusThreadManager::Get()->GetCryptohomeClient()->TpmClearStoredPassword(); | 67 DBusThreadManager::Get()->GetCryptohomeClient()->TpmClearStoredPassword(); |
| 63 } | 68 } |
| 64 | 69 |
| 65 virtual bool InstallAttributesGet( | 70 virtual bool InstallAttributesGet( |
| 66 const std::string& name, std::string* value) OVERRIDE { | 71 const std::string& name, std::string* value) OVERRIDE { |
| 67 std::vector<uint8> buf; | 72 std::vector<uint8> buf; |
| 68 bool success = false; | 73 bool success = false; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { | 217 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { |
| 213 CryptohomeLibrary* impl; | 218 CryptohomeLibrary* impl; |
| 214 if (stub) | 219 if (stub) |
| 215 impl = new CryptohomeLibraryStubImpl(); | 220 impl = new CryptohomeLibraryStubImpl(); |
| 216 else | 221 else |
| 217 impl = new CryptohomeLibraryImpl(); | 222 impl = new CryptohomeLibraryImpl(); |
| 218 return impl; | 223 return impl; |
| 219 } | 224 } |
| 220 | 225 |
| 221 } // namespace chromeos | 226 } // namespace chromeos |
| OLD | NEW |