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

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

Issue 3141031: [Chrome OS] Wire up ownership API from libcros (Closed)
Patch Set: address davemoore comments Created 10 years, 4 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>
20 class Delegate {
21 public:
22 virtual void Run(T value) = 0;
23 };
24
19 virtual ~LoginLibrary() {} 25 virtual ~LoginLibrary() {}
20 // Requests that the Upstart signal login-prompt-ready be emitted. 26 // Requests that the Upstart signal login-prompt-ready be emitted.
21 virtual bool EmitLoginPromptReady() = 0; 27 virtual bool EmitLoginPromptReady() = 0;
22 28
29 // Attempts to asynchronously set the provided public key as the
30 // Owner's public key for this device. |public_key_der| should be a
31 // DER-encoded PKCS11 SubjectPublicKeyInfo structure.
32 // Returns true if the attempt was successfully started.
33 // callback->Run() will be called when the operation is complete.
34 virtual bool SetOwnerKey(const std::vector<uint8>& public_key_der,
35 Delegate<bool>* callback) = 0;
36
23 // Tells the session manager to start a logged-in session for the user 37 // Tells the session manager to start a logged-in session for the user
24 // |user_email|. |unique_id| is meant to be used when we have a non-human- 38 // |user_email|. |unique_id| is meant to be used when we have a non-human-
25 // readable unique identifier by which we distinguish users (to deal with 39 // readable unique identifier by which we distinguish users (to deal with
26 // potential email address changes over time). 40 // potential email address changes over time).
27 virtual bool StartSession(const std::string& user_email, 41 virtual bool StartSession(const std::string& user_email,
28 const std::string& unique_id /* unused */) = 0; 42 const std::string& unique_id /* unused */) = 0;
29 43
30 // Tells the session manager to terminate the current logged-in session. 44 // Tells the session manager to terminate the current logged-in session.
31 // In the event that we ever support multiple simultaneous user sessions, 45 // In the event that we ever support multiple simultaneous user sessions,
32 // This will tell the session manager to terminate the session for the user 46 // This will tell the session manager to terminate the session for the user
33 // indicated by |unique_id|. 47 // indicated by |unique_id|.
34 virtual bool StopSession(const std::string& unique_id /* unused */) = 0; 48 virtual bool StopSession(const std::string& unique_id /* unused */) = 0;
35 49
36 // Restarts the job with specified command line string. 50 // Restarts the job with specified command line string.
37 virtual bool RestartJob(int pid, const std::string& command_line) = 0; 51 virtual bool RestartJob(int pid, const std::string& command_line) = 0;
38 52
39 // Factory function, creates a new instance and returns ownership. 53 // Factory function, creates a new instance and returns ownership.
40 // For normal usage, access the singleton via CrosLibrary::Get(). 54 // For normal usage, access the singleton via CrosLibrary::Get().
41 static LoginLibrary* GetImpl(bool stub); 55 static LoginLibrary* GetImpl(bool stub);
42 }; 56 };
43 57
44 } // namespace chromeos 58 } // namespace chromeos
45 59
46 #endif // CHROME_BROWSER_CHROMEOS_CROS_LOGIN_LIBRARY_H_ 60 #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