Fix potential crash in CreateHBITMAPFromSkBitmap().
[chromium-blink-merge.git] / ash / session_state_delegate.h
blob0f2c569c5125bbea82c49e6056f9e0cb3c76f0a6
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ASH_SESSION_STATE_DELEGATE_H_
6 #define ASH_SESSION_STATE_DELEGATE_H_
8 #include <string>
9 #include <vector>
11 #include "ash/ash_export.h"
12 #include "base/strings/string16.h"
14 namespace gfx {
15 class ImageSkia;
16 } // namespace gfx
18 namespace ash {
20 class SessionStateObserver;
22 // The index for the multi-profile item to use. The list is always LRU sorted
23 // So that the index #0 is the currently active user.
24 typedef int MultiProfileIndex;
26 // A list of user_id.
27 typedef std::vector<std::string> UserIdList;
29 // Delegate for checking and modifying the session state.
30 class ASH_EXPORT SessionStateDelegate {
31 public:
32 virtual ~SessionStateDelegate() {};
34 // Returns the maximum possible number of logged in users.
35 virtual int GetMaximumNumberOfLoggedInUsers() const = 0;
37 // Returns the number of signed in users. If 0 is returned, there is either
38 // no session in progress or no active user.
39 virtual int NumberOfLoggedInUsers() const = 0;
41 // Returns |true| if the session has been fully started for the active user.
42 // When a user becomes active, the profile and browser UI are not immediately
43 // available. Only once this method starts returning |true| is the browser
44 // startup complete and both profile and UI are fully available.
45 virtual bool IsActiveUserSessionStarted() const = 0;
47 // Returns true if the screen can be locked.
48 virtual bool CanLockScreen() const = 0;
50 // Returns true if the screen is currently locked.
51 virtual bool IsScreenLocked() const = 0;
53 // Locks the screen. The locking happens asynchronously.
54 virtual void LockScreen() = 0;
56 // Unlocks the screen.
57 virtual void UnlockScreen() = 0;
59 // Returns |true| if user session blocked by some overlying UI. It can be
60 // login screen, lock screen or screen for adding users into multi-profile
61 // session.
62 virtual bool IsUserSessionBlocked() const = 0;
64 // Gets the displayed name for the user with the given |index|.
65 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
66 virtual const base::string16 GetUserDisplayName(
67 MultiProfileIndex index) const = 0;
69 // Gets the email address for the user with the given |index|.
70 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
71 virtual const std::string GetUserEmail(MultiProfileIndex index) const = 0;
73 // Gets the avatar image for the user with the given |index|.
74 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
75 virtual const gfx::ImageSkia& GetUserImage(MultiProfileIndex index) const = 0;
77 // Returns a list of all logged in users.
78 virtual void GetLoggedInUsers(UserIdList* users) = 0;
80 // Switches to another active user (if that user has already signed in).
81 virtual void SwitchActiveUser(const std::string& user_id) = 0;
83 // Adds or removes sessions state observer.
84 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0;
85 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0;
88 } // namespace ash
90 #endif // ASH_SESSION_STATE_DELEGATE_H_