| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 virtual ~CryptohomeLibraryImpl() { | 35 virtual ~CryptohomeLibraryImpl() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual bool IsMounted() OVERRIDE { | 38 virtual bool IsMounted() OVERRIDE { |
| 39 bool result = false; | 39 bool result = false; |
| 40 DBusThreadManager::Get()->GetCryptohomeClient()->IsMounted(&result); | 40 DBusThreadManager::Get()->GetCryptohomeClient()->IsMounted(&result); |
| 41 return result; | 41 return result; |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual bool IsMountedForUser(const std::string& username, |
| 45 bool* is_mounted, |
| 46 bool* is_ephemeral_mount) OVERRIDE { |
| 47 return DBusThreadManager::Get()->GetCryptohomeClient()-> |
| 48 IsMountedForUser(username, is_mounted, is_ephemeral_mount); |
| 49 } |
| 50 |
| 44 virtual bool TpmIsReady() OVERRIDE { | 51 virtual bool TpmIsReady() OVERRIDE { |
| 45 bool result = false; | 52 bool result = false; |
| 46 DBusThreadManager::Get()->GetCryptohomeClient()->TpmIsReady(&result); | 53 DBusThreadManager::Get()->GetCryptohomeClient()->TpmIsReady(&result); |
| 47 return result; | 54 return result; |
| 48 } | 55 } |
| 49 | 56 |
| 50 virtual bool TpmIsEnabled() OVERRIDE { | 57 virtual bool TpmIsEnabled() OVERRIDE { |
| 51 bool result = false; | 58 bool result = false; |
| 52 DBusThreadManager::Get()->GetCryptohomeClient()->CallTpmIsEnabledAndBlock( | 59 DBusThreadManager::Get()->GetCryptohomeClient()->CallTpmIsEnabledAndBlock( |
| 53 &result); | 60 &result); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 class CryptohomeLibraryStubImpl : public CryptohomeLibrary { | 179 class CryptohomeLibraryStubImpl : public CryptohomeLibrary { |
| 173 public: | 180 public: |
| 174 CryptohomeLibraryStubImpl() | 181 CryptohomeLibraryStubImpl() |
| 175 : locked_(false) {} | 182 : locked_(false) {} |
| 176 virtual ~CryptohomeLibraryStubImpl() {} | 183 virtual ~CryptohomeLibraryStubImpl() {} |
| 177 | 184 |
| 178 virtual bool IsMounted() OVERRIDE { | 185 virtual bool IsMounted() OVERRIDE { |
| 179 return true; | 186 return true; |
| 180 } | 187 } |
| 181 | 188 |
| 189 virtual bool IsMountedForUser(const std::string& username, |
| 190 bool* is_mounted, |
| 191 bool* is_ephemeral_mount) OVERRIDE { |
| 192 *is_mounted = true; |
| 193 *is_ephemeral_mount = false; |
| 194 return true; |
| 195 } |
| 196 |
| 182 // Tpm begin ready after 20-th call. | 197 // Tpm begin ready after 20-th call. |
| 183 virtual bool TpmIsReady() OVERRIDE { | 198 virtual bool TpmIsReady() OVERRIDE { |
| 184 static int counter = 0; | 199 static int counter = 0; |
| 185 return ++counter > 20; | 200 return ++counter > 20; |
| 186 } | 201 } |
| 187 | 202 |
| 188 virtual bool TpmIsEnabled() OVERRIDE { | 203 virtual bool TpmIsEnabled() OVERRIDE { |
| 189 return true; | 204 return true; |
| 190 } | 205 } |
| 191 | 206 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { | 276 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { |
| 262 CryptohomeLibrary* impl; | 277 CryptohomeLibrary* impl; |
| 263 if (stub) | 278 if (stub) |
| 264 impl = new CryptohomeLibraryStubImpl(); | 279 impl = new CryptohomeLibraryStubImpl(); |
| 265 else | 280 else |
| 266 impl = new CryptohomeLibraryImpl(); | 281 impl = new CryptohomeLibraryImpl(); |
| 267 return impl; | 282 return impl; |
| 268 } | 283 } |
| 269 | 284 |
| 270 } // namespace chromeos | 285 } // namespace chromeos |
| OLD | NEW |