Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/browser/chromeos/cros/cryptohome_library.h

Issue 1142005: Mocks for all libcros elements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_ 6 #define CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/singleton.h" 10 #include "base/singleton.h"
11 #include "third_party/cros/chromeos_cryptohome.h" 11 #include "third_party/cros/chromeos_cryptohome.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 class MockCryptohomeLibrary;
15 14
16 // This class handles the interaction with the ChromeOS cryptohome library APIs. 15 // This interface defines the interaction with the ChromeOS cryptohome library
17 // Users can get an instance of this library class like this: 16 // APIs.
18 // CryptohomeLibrary::Get()
19 class CryptohomeLibrary { 17 class CryptohomeLibrary {
20 public: 18 public:
21 // This gets the singleton CryptohomeLibrary. 19 virtual ~CryptohomeLibrary() {}
22 static CryptohomeLibrary* Get();
23 20
24 // Asks cryptohomed to try to find the cryptohome for |user_email| and then 21 // Asks cryptohomed to try to find the cryptohome for |user_email| and then
25 // mount it using |passhash| to unlock the key. 22 // mount it using |passhash| to unlock the key.
26 virtual bool Mount(const std::string& user_email, 23 virtual bool Mount(const std::string& user_email,
27 const std::string& passhash); 24 const std::string& passhash) = 0;
28 25
29 // Asks cryptohomed to try to find the cryptohome for |user_email| and then 26 // Asks cryptohomed to try to find the cryptohome for |user_email| and then
30 // use |passhash| to unlock the key. 27 // use |passhash| to unlock the key.
31 virtual bool CheckKey(const std::string& user_email, 28 virtual bool CheckKey(const std::string& user_email,
29 const std::string& passhash) = 0;
30
31 // Asks cryptohomed if a drive is currently mounted.
32 virtual bool IsMounted() = 0;
33
34 };
35
36 // This class handles the interaction with the ChromeOS cryptohome library APIs.
37 class CryptohomeLibraryImpl : public CryptohomeLibrary {
38 public:
39 CryptohomeLibraryImpl() {}
40 virtual ~CryptohomeLibraryImpl() {}
41
42 // CryptohomeLibrary overrides.
43 virtual bool Mount(const std::string& user_email,
44 const std::string& passhash);
45 virtual bool CheckKey(const std::string& user_email,
32 const std::string& passhash); 46 const std::string& passhash);
33 47
34 // Asks cryptohomed if a drive is currently mounted. 48 // Asks cryptohomed if a drive is currently mounted.
35 virtual bool IsMounted(); 49 virtual bool IsMounted();
36 50
37 private: 51 private:
38 friend struct DefaultSingletonTraits<CryptohomeLibrary>; 52 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryImpl);
39 friend class MockCryptohomeLibrary;
40
41 CryptohomeLibrary() {}
42 ~CryptohomeLibrary() {}
43
44 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibrary);
45 }; 53 };
46 54
47 } // namespace chromeos 55 } // namespace chromeos
48 56
49 #endif // CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_ 57 #endif // CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/cros_library_loader.cc ('k') | chrome/browser/chromeos/cros/cryptohome_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698