OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/hash_tables.h" | 8 #include "base/hash_tables.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "content/browser/browser_thread.h" | 12 #include "content/browser/browser_thread.h" |
13 | 13 |
| 14 namespace { |
| 15 const char kStubSystemSalt[] = "stub_system_salt"; |
| 16 } |
| 17 |
14 namespace chromeos { | 18 namespace chromeos { |
15 | 19 |
16 // This class handles the interaction with the ChromeOS cryptohome library APIs. | 20 // This class handles the interaction with the ChromeOS cryptohome library APIs. |
17 class CryptohomeLibraryImpl : public CryptohomeLibrary { | 21 class CryptohomeLibraryImpl : public CryptohomeLibrary { |
18 public: | 22 public: |
19 CryptohomeLibraryImpl() { | 23 CryptohomeLibraryImpl() { |
20 if (CrosLibrary::Get()->EnsureLoaded()) | 24 if (CrosLibrary::Get()->EnsureLoaded()) |
21 Init(); | 25 Init(); |
22 } | 26 } |
23 virtual ~CryptohomeLibraryImpl() {} | 27 virtual ~CryptohomeLibraryImpl() {} |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 NewRunnableFunction(&DoStubCallback, callback)); | 346 NewRunnableFunction(&DoStubCallback, callback)); |
343 return true; | 347 return true; |
344 } | 348 } |
345 | 349 |
346 bool IsMounted() { | 350 bool IsMounted() { |
347 return true; | 351 return true; |
348 } | 352 } |
349 | 353 |
350 CryptohomeBlob GetSystemSalt() { | 354 CryptohomeBlob GetSystemSalt() { |
351 CryptohomeBlob salt = CryptohomeBlob(); | 355 CryptohomeBlob salt = CryptohomeBlob(); |
352 salt.push_back(0); | 356 for (size_t i = 0; i < strlen(kStubSystemSalt); i++) |
353 salt.push_back(0); | 357 salt.push_back(static_cast<unsigned char>(kStubSystemSalt[i])); |
| 358 |
354 return salt; | 359 return salt; |
355 } | 360 } |
356 | 361 |
357 bool AsyncDoAutomaticFreeDiskSpaceControl(Delegate* callback) { | 362 bool AsyncDoAutomaticFreeDiskSpaceControl(Delegate* callback) { |
358 BrowserThread::PostTask( | 363 BrowserThread::PostTask( |
359 BrowserThread::UI, FROM_HERE, | 364 BrowserThread::UI, FROM_HERE, |
360 NewRunnableFunction(&DoStubCallback, callback)); | 365 NewRunnableFunction(&DoStubCallback, callback)); |
361 return true; | 366 return true; |
362 } | 367 } |
363 | 368 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 462 |
458 // static | 463 // static |
459 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { | 464 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { |
460 if (stub) | 465 if (stub) |
461 return new CryptohomeLibraryStubImpl(); | 466 return new CryptohomeLibraryStubImpl(); |
462 else | 467 else |
463 return new CryptohomeLibraryImpl(); | 468 return new CryptohomeLibraryImpl(); |
464 } | 469 } |
465 | 470 |
466 } // namespace chromeos | 471 } // namespace chromeos |
OLD | NEW |