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

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

Issue 3278001: [Chrome OS] more of the ownership api (Closed)
Patch Set: fix MockLoginLibrary Created 10 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/login_library.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_LOGIN_LIBRARY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_LOGIN_LIBRARY_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_LOGIN_LIBRARY_H_ 6 #define CHROME_BROWSER_CHROMEOS_CROS_LOGIN_LIBRARY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/singleton.h" 11 #include "base/singleton.h"
12 #include "cros/chromeos_login.h" 12 #include "cros/chromeos_login.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 // This interface defines the interaction with the ChromeOS login library APIs. 16 // This interface defines the interaction with the ChromeOS login library APIs.
17 class LoginLibrary { 17 class LoginLibrary {
18 public: 18 public:
19 template <class T> 19 template <class T>
20 class Delegate { 20 class Delegate {
21 public: 21 public:
22 virtual void Run(T value) = 0; 22 virtual void Run(T value) = 0;
23 }; 23 };
24 24
25 virtual ~LoginLibrary() {} 25 virtual ~LoginLibrary() {}
26 // Requests that the Upstart signal login-prompt-ready be emitted. 26 // Requests that the Upstart signal login-prompt-ready be emitted.
27 virtual bool EmitLoginPromptReady() = 0; 27 virtual bool EmitLoginPromptReady() = 0;
28 28
29 // Check whether or not |email| is present on the whitelist.
30 // If so, we return true and store the signature passed when |email| was
31 // whitelisted in |OUT_signature|.
32 // If not, we return false and don't touch the output parameter.
33 virtual bool CheckWhitelist(const std::string& email,
34 std::vector<uint8>* OUT_signature) = 0;
35
36 // Fetch the value associated with |name|, if its present.
37 // If so, we return true, store the info in |OUT_value|, and store the
38 // signature passed when the property was initially stored in |OUT_signature|.
39 // If not, we return false and don't touch the output parameters.
40 virtual bool RetrieveProperty(const std::string& name,
41 std::string* OUT_value,
42 std::vector<uint8>* OUT_signature) = 0;
43
29 // Attempts to asynchronously set the provided public key as the 44 // Attempts to asynchronously set the provided public key as the
30 // Owner's public key for this device. |public_key_der| should be a 45 // Owner's public key for this device. |public_key_der| should be a
31 // DER-encoded PKCS11 SubjectPublicKeyInfo structure. 46 // DER-encoded PKCS11 SubjectPublicKeyInfo structure.
32 // Returns true if the attempt was successfully started. 47 // Returns true if the attempt was successfully started.
33 // callback->Run() will be called when the operation is complete. 48 // callback->Run() will be called when the operation is complete.
34 virtual bool SetOwnerKey(const std::vector<uint8>& public_key_der, 49 virtual bool SetOwnerKeyAsync(const std::vector<uint8>& public_key_der,
35 Delegate<bool>* callback) = 0; 50 Delegate<bool>* callback) = 0;
51
52 // Attempts to issue a signed async request to store |name|=|value|.
53 // |signature| must by a SHA1 with RSA encryption signature over the string
54 // "name=value" with the owner's private key.
55 // Returns true if the attempt was successfully started.
56 // callback->Run() will be called when the operation is complete.
57 virtual bool StorePropertyAsync(const std::string& name,
58 const std::string& value,
59 const std::vector<uint8>& signature,
60 Delegate<bool>* callback) = 0;
61
62 // Attempts to issue a signed async request to whitelist |email|.
63 // |signature| must by a SHA1 with RSA encryption signature over |email|
64 // with the owner's private key.
65 // Returns true if the attempt was successfully started.
66 // callback->Run() will be called when the operation is complete.
67 virtual bool WhitelistAsync(const std::string& email,
68 const std::vector<uint8>& signature,
69 Delegate<bool>* callback) = 0;
70
71 // Attempts to issue a signed async request to remove |email| from the
72 // whitelist of users allowed to log in to this machine.
73 // |signature| must by a SHA1 with RSA encryption signature over |email|
74 // with the owner's private key.
75 // Returns true if the attempt was successfully started.
76 // callback->Run() will be called when the operation is complete.
77 virtual bool UnwhitelistAsync(const std::string& email,
78 const std::vector<uint8>& signature,
79 Delegate<bool>* callback) = 0;
36 80
37 // Tells the session manager to start a logged-in session for the user 81 // Tells the session manager to start a logged-in session for the user
38 // |user_email|. |unique_id| is meant to be used when we have a non-human- 82 // |user_email|. |unique_id| is meant to be used when we have a non-human-
39 // readable unique identifier by which we distinguish users (to deal with 83 // readable unique identifier by which we distinguish users (to deal with
40 // potential email address changes over time). 84 // potential email address changes over time).
41 virtual bool StartSession(const std::string& user_email, 85 virtual bool StartSession(const std::string& user_email,
42 const std::string& unique_id /* unused */) = 0; 86 const std::string& unique_id /* unused */) = 0;
43 87
44 // Tells the session manager to terminate the current logged-in session. 88 // Tells the session manager to terminate the current logged-in session.
45 // In the event that we ever support multiple simultaneous user sessions, 89 // In the event that we ever support multiple simultaneous user sessions,
46 // This will tell the session manager to terminate the session for the user 90 // This will tell the session manager to terminate the session for the user
47 // indicated by |unique_id|. 91 // indicated by |unique_id|.
48 virtual bool StopSession(const std::string& unique_id /* unused */) = 0; 92 virtual bool StopSession(const std::string& unique_id /* unused */) = 0;
49 93
50 // Restarts the job with specified command line string. 94 // Restarts the job with specified command line string.
51 virtual bool RestartJob(int pid, const std::string& command_line) = 0; 95 virtual bool RestartJob(int pid, const std::string& command_line) = 0;
52 96
53 // Factory function, creates a new instance and returns ownership. 97 // Factory function, creates a new instance and returns ownership.
54 // For normal usage, access the singleton via CrosLibrary::Get(). 98 // For normal usage, access the singleton via CrosLibrary::Get().
55 static LoginLibrary* GetImpl(bool stub); 99 static LoginLibrary* GetImpl(bool stub);
56 }; 100 };
57 101
58 } // namespace chromeos 102 } // namespace chromeos
59 103
60 #endif // CHROME_BROWSER_CHROMEOS_CROS_LOGIN_LIBRARY_H_ 104 #endif // CHROME_BROWSER_CHROMEOS_CROS_LOGIN_LIBRARY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/login_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698