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

Side by Side Diff: chrome/browser/chromeos/cros/login_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_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 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_login.h" 11 #include "third_party/cros/chromeos_login.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 // This class handles the interaction with the ChromeOS login library APIs. 15 // This interface defines the interaction with the ChromeOS login library APIs.
16 // Users can get an instance of this library class like this:
17 // LoginLibrary::Get()
18 class LoginLibrary { 16 class LoginLibrary {
19 public: 17 public:
20 // If the libray fails to load the first time we check, we don't want to 18 virtual ~LoginLibrary() {}
21 // keep trying to load the library. If it fails the first time, it fails.
22 static bool tried_and_failed;
23
24 // This gets the singleton LoginLibrary.
25 static LoginLibrary* Get();
26
27 // Requests that the Upstart signal login-prompt-ready be emitted. 19 // Requests that the Upstart signal login-prompt-ready be emitted.
28 bool EmitLoginPromptReady(); 20 virtual bool EmitLoginPromptReady() = 0;
29 21
30 // Tells the session manager to start a logged-in session for the user 22 // Tells the session manager to start a logged-in session for the user
31 // |user_email|. |unique_id| is meant to be used when we have a non-human- 23 // |user_email|. |unique_id| is meant to be used when we have a non-human-
32 // readable unique identifier by which we distinguish users (to deal with 24 // readable unique identifier by which we distinguish users (to deal with
33 // potential email address changes over time). 25 // potential email address changes over time).
34 bool StartSession(const std::string& user_email, 26 virtual bool StartSession(const std::string& user_email,
35 const std::string& unique_id /* unused */); 27 const std::string& unique_id /* unused */) = 0;
36 28
37 // Tells the session manager to terminate the current logged-in session. 29 // Tells the session manager to terminate the current logged-in session.
38 // In the event that we ever support multiple simultaneous user sessions, 30 // In the event that we ever support multiple simultaneous user sessions,
39 // This will tell the session manager to terminate the session for the user 31 // This will tell the session manager to terminate the session for the user
40 // indicated by |unique_id|. 32 // indicated by |unique_id|.
41 bool StopSession(const std::string& unique_id /* unused */); 33 virtual bool StopSession(const std::string& unique_id /* unused */) = 0;
34 };
35
36 // This class handles the interaction with the ChromeOS login library APIs.
37 class LoginLibraryImpl : public LoginLibrary {
38 public:
39 LoginLibraryImpl() {}
40 virtual ~LoginLibraryImpl() {}
41
42 // LoginLibrary overrides.
43 virtual bool EmitLoginPromptReady();
44 virtual bool StartSession(const std::string& user_email,
45 const std::string& unique_id /* unused */);
46 virtual bool StopSession(const std::string& unique_id /* unused */);
42 47
43 private: 48 private:
44 friend struct DefaultSingletonTraits<LoginLibrary>; 49 DISALLOW_COPY_AND_ASSIGN(LoginLibraryImpl);
45
46 LoginLibrary() {}
47 ~LoginLibrary() {}
48
49 DISALLOW_COPY_AND_ASSIGN(LoginLibrary);
50 }; 50 };
51 51
52 } // namespace chromeos 52 } // namespace chromeos
53 53
54 #endif // CHROME_BROWSER_CHROMEOS_CROS_LOGIN_LIBRARY_H_ 54 #endif // CHROME_BROWSER_CHROMEOS_CROS_LOGIN_LIBRARY_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/language_library.cc ('k') | chrome/browser/chromeos/cros/login_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698