Revert of Cast: cast_sender_app transcode a video file using FFmpeg (https://coderevi...
[chromium-blink-merge.git] / ash / session_state_delegate.h
blobdcbd7f975b5c67aeb359e01a85e3a269ac063c65
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 aura {
15 class Window;
16 } // namespace aura
18 namespace content {
19 class BrowserContext;
22 namespace gfx {
23 class ImageSkia;
24 } // namespace gfx
26 namespace ash {
28 class SessionStateObserver;
30 // The index for the multi-profile item to use. The list is always LRU sorted
31 // So that the index #0 is the currently active user.
32 typedef int MultiProfileIndex;
34 // A list of user_id.
35 typedef std::vector<std::string> UserIdList;
37 // Delegate for checking and modifying the session state.
38 // TODO(oshima): Replace MultiProfileIndex with BrowsreContext, bacause
39 // GetUserXXX are useful for non multi profile scenario in ash_shell.
40 class ASH_EXPORT SessionStateDelegate {
41 public:
42 // Defines the cycle direction for |CycleActiveUser|.
43 enum CycleUser {
44 CYCLE_TO_NEXT_USER = 0, // Cycle to the next user.
45 CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user.
48 // Defines session state i.e. whether session is running or not and
49 // whether user session is blocked by things like multi-profile login.
50 enum SessionState {
51 // When primary user login UI is shown i.e. after boot or sign out,
52 // no active user session exists yet.
53 SESSION_STATE_LOGIN_PRIMARY = 0,
55 // Inside user session (including lock screen),
56 // no login UI (primary or multi-profiles) is shown.
57 SESSION_STATE_ACTIVE,
59 // When secondary user login UI is shown i.e. other users are
60 // already logged in and is currently adding another user to the session.
61 SESSION_STATE_LOGIN_SECONDARY,
64 virtual ~SessionStateDelegate() {};
66 // Returns the browser context for the user given by |index|.
67 virtual content::BrowserContext* GetBrowserContextByIndex(
68 MultiProfileIndex index) = 0;
70 // Returns the browser context associated with the window.
71 virtual content::BrowserContext* GetBrowserContextForWindow(
72 aura::Window* window) = 0;
74 // Returns the maximum possible number of logged in users.
75 virtual int GetMaximumNumberOfLoggedInUsers() const = 0;
77 // Returns the number of signed in users. If 0 is returned, there is either
78 // no session in progress or no active user.
79 virtual int NumberOfLoggedInUsers() const = 0;
81 // Returns |true| if the session has been fully started for the active user.
82 // When a user becomes active, the profile and browser UI are not immediately
83 // available. Only once this method starts returning |true| is the browser
84 // startup complete and both profile and UI are fully available.
85 virtual bool IsActiveUserSessionStarted() const = 0;
87 // Returns true if the screen can be locked.
88 virtual bool CanLockScreen() const = 0;
90 // Returns true if the screen is currently locked.
91 virtual bool IsScreenLocked() const = 0;
93 // Returns true if the screen should be locked when the system is about to
94 // suspend.
95 virtual bool ShouldLockScreenBeforeSuspending() const = 0;
97 // Locks the screen. The locking happens asynchronously.
98 virtual void LockScreen() = 0;
100 // Unlocks the screen.
101 virtual void UnlockScreen() = 0;
103 // Returns |true| if user session blocked by some overlying UI. It can be
104 // login screen, lock screen or screen for adding users into multi-profile
105 // session.
106 virtual bool IsUserSessionBlocked() const = 0;
108 // Returns current session state.
109 virtual SessionState GetSessionState() const = 0;
111 // Gets the displayed name for the user with the given |index|.
112 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
113 virtual const base::string16 GetUserDisplayName(
114 MultiProfileIndex index) const = 0;
116 // Gets the given name of the user with |index|. An empty string can be
117 // returned if the given name of the user is unknown.
118 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
119 virtual const base::string16 GetUserGivenName(
120 MultiProfileIndex index) const = 0;
122 // Gets the display email address for the user with the given |index|.
123 // The display email address might contains some periods in the email name
124 // as well as capitalized letters. For example: "Foo.Bar@mock.com".
125 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
126 virtual const std::string GetUserEmail(MultiProfileIndex index) const = 0;
128 // Gets the user id (sanitized email address) for the user with the given
129 // |index|. The function would return something like "foobar@mock.com".
130 // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
131 virtual const std::string GetUserID(MultiProfileIndex index) const = 0;
133 // Gets the avatar image for the user associated with the |context|.
134 virtual const gfx::ImageSkia& GetUserImage(
135 content::BrowserContext* context) const = 0;
137 // Whether or not the window's title should show the avatar.
138 virtual bool ShouldShowAvatar(aura::Window* window) = 0;
140 // Switches to another active user with |user_id|
141 // (if that user has already signed in).
142 virtual void SwitchActiveUser(const std::string& user_id) = 0;
144 // Switches the active user to the next or previous user, with the same
145 // ordering as GetLoggedInUsers.
146 virtual void CycleActiveUser(CycleUser cycle_user) = 0;
148 // Adds or removes sessions state observer.
149 virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0;
150 virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0;
153 } // namespace ash
155 #endif // ASH_SESSION_STATE_DELEGATE_H_