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/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 // This class handles the interaction with the ChromeOS cryptohome library APIs. | 23 // This class handles the interaction with the ChromeOS cryptohome library APIs. |
24 class CryptohomeLibraryImpl : public CryptohomeLibrary { | 24 class CryptohomeLibraryImpl : public CryptohomeLibrary { |
25 public: | 25 public: |
26 CryptohomeLibraryImpl() : weak_ptr_factory_(this) { | 26 CryptohomeLibraryImpl() : weak_ptr_factory_(this) { |
27 } | 27 } |
28 | 28 |
29 virtual ~CryptohomeLibraryImpl() { | 29 virtual ~CryptohomeLibraryImpl() { |
30 } | 30 } |
31 | 31 |
32 virtual bool IsMounted() OVERRIDE { | |
33 bool result = false; | |
34 DBusThreadManager::Get()->GetCryptohomeClient()->IsMounted(&result); | |
35 return result; | |
36 } | |
37 | |
38 virtual bool TpmIsEnabled() OVERRIDE { | 32 virtual bool TpmIsEnabled() OVERRIDE { |
39 bool result = false; | 33 bool result = false; |
40 DBusThreadManager::Get()->GetCryptohomeClient()->CallTpmIsEnabledAndBlock( | 34 DBusThreadManager::Get()->GetCryptohomeClient()->CallTpmIsEnabledAndBlock( |
41 &result); | 35 &result); |
42 return result; | 36 return result; |
43 } | 37 } |
44 | 38 |
45 virtual bool TpmIsOwned() OVERRIDE { | 39 virtual bool TpmIsOwned() OVERRIDE { |
46 bool result = false; | 40 bool result = false; |
47 DBusThreadManager::Get()->GetCryptohomeClient()->TpmIsOwned(&result); | 41 DBusThreadManager::Get()->GetCryptohomeClient()->TpmIsOwned(&result); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 130 |
137 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryImpl); | 131 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryImpl); |
138 }; | 132 }; |
139 | 133 |
140 class CryptohomeLibraryStubImpl : public CryptohomeLibrary { | 134 class CryptohomeLibraryStubImpl : public CryptohomeLibrary { |
141 public: | 135 public: |
142 CryptohomeLibraryStubImpl() | 136 CryptohomeLibraryStubImpl() |
143 : locked_(false) {} | 137 : locked_(false) {} |
144 virtual ~CryptohomeLibraryStubImpl() {} | 138 virtual ~CryptohomeLibraryStubImpl() {} |
145 | 139 |
146 virtual bool IsMounted() OVERRIDE { | |
147 return true; | |
148 } | |
149 | |
150 virtual bool TpmIsEnabled() OVERRIDE { | 140 virtual bool TpmIsEnabled() OVERRIDE { |
151 return true; | 141 return true; |
152 } | 142 } |
153 | 143 |
154 virtual bool TpmIsOwned() OVERRIDE { | 144 virtual bool TpmIsOwned() OVERRIDE { |
155 return true; | 145 return true; |
156 } | 146 } |
157 | 147 |
158 virtual bool TpmIsBeingOwned() OVERRIDE { | 148 virtual bool TpmIsBeingOwned() OVERRIDE { |
159 return true; | 149 return true; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { | 202 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { |
213 CryptohomeLibrary* impl; | 203 CryptohomeLibrary* impl; |
214 if (stub) | 204 if (stub) |
215 impl = new CryptohomeLibraryStubImpl(); | 205 impl = new CryptohomeLibraryStubImpl(); |
216 else | 206 else |
217 impl = new CryptohomeLibraryImpl(); | 207 impl = new CryptohomeLibraryImpl(); |
218 return impl; | 208 return impl; |
219 } | 209 } |
220 | 210 |
221 } // namespace chromeos | 211 } // namespace chromeos |
OLD | NEW |