- add sources.
[platform/framework/web/crosswalk.git] / src / ash / session_state_delegate.h
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.
4
5 #ifndef ASH_SESSION_STATE_DELEGATE_H_
6 #define ASH_SESSION_STATE_DELEGATE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "ash/ash_export.h"
12 #include "base/strings/string16.h"
13
14 namespace aura {
15 class Window;
16 }  // namespace aura
17
18 namespace gfx {
19 class ImageSkia;
20 }  // namespace gfx
21
22 namespace ash {
23
24 class SessionStateObserver;
25
26 // The index for the multi-profile item to use. The list is always LRU sorted
27 // So that the index #0 is the currently active user.
28 typedef int MultiProfileIndex;
29
30 // A list of user_id.
31 typedef std::vector<std::string> UserIdList;
32
33 // Delegate for checking and modifying the session state.
34 class ASH_EXPORT SessionStateDelegate {
35  public:
36   virtual ~SessionStateDelegate() {};
37
38   // Returns the maximum possible number of logged in users.
39   virtual int GetMaximumNumberOfLoggedInUsers() const = 0;
40
41   // Returns the number of signed in users. If 0 is returned, there is either
42   // no session in progress or no active user.
43   virtual int NumberOfLoggedInUsers() const = 0;
44
45   // Returns |true| if the session has been fully started for the active user.
46   // When a user becomes active, the profile and browser UI are not immediately
47   // available. Only once this method starts returning |true| is the browser
48   // startup complete and both profile and UI are fully available.
49   virtual bool IsActiveUserSessionStarted() const = 0;
50
51   // Returns true if the screen can be locked.
52   virtual bool CanLockScreen() const = 0;
53
54   // Returns true if the screen is currently locked.
55   virtual bool IsScreenLocked() const = 0;
56
57   // Returns true if the screen should be locked when the system is about to
58   // suspend.
59   virtual bool ShouldLockScreenBeforeSuspending() const = 0;
60
61   // Locks the screen. The locking happens asynchronously.
62   virtual void LockScreen() = 0;
63
64   // Unlocks the screen.
65   virtual void UnlockScreen() = 0;
66
67   // Returns |true| if user session blocked by some overlying UI. It can be
68   // login screen, lock screen or screen for adding users into multi-profile
69   // session.
70   virtual bool IsUserSessionBlocked() const = 0;
71
72   // Gets the displayed name for the user with the given |index|.
73   // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
74   virtual const base::string16 GetUserDisplayName(
75       MultiProfileIndex index) const = 0;
76
77   // Gets the display email address for the user with the given |index|.
78   // The display email address might contains some periods in the email name
79   // as well as capitalized letters. For example: "Foo.Bar@mock.com".
80   // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
81   virtual const std::string GetUserEmail(MultiProfileIndex index) const = 0;
82
83   // Gets the user id (sanitized email address) for the user with the given
84   // |index|. The function would return something like "foobar@mock.com".
85   // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
86   virtual const std::string GetUserID(MultiProfileIndex index) const = 0;
87
88   // Gets the avatar image for the user with the given |index|.
89   // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
90   virtual const gfx::ImageSkia& GetUserImage(MultiProfileIndex index) const = 0;
91
92   // Returns a list of all logged in users.
93   virtual void GetLoggedInUsers(UserIdList* users) = 0;
94
95   // Switches to another active user with |user_id|
96   // (if that user has already signed in).
97   virtual void SwitchActiveUser(const std::string& user_id) = 0;
98
99   // Switches the active user to the next user, with the same ordering as
100   // GetLoggedInUsers.
101   virtual void SwitchActiveUserToNext() = 0;
102
103   // Adds or removes sessions state observer.
104   virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0;
105   virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0;
106
107   // Transfers the visibility of a window to another user. Returns true when
108   // transfer was done. This could fail if the |window| belongs to no one and
109   // is therefore shown on the desktop of every user.
110   virtual bool TransferWindowToDesktopOfUser(
111       aura::Window* window,
112       ash::MultiProfileIndex index) = 0;
113 };
114
115 }  // namespace ash
116
117 #endif  // ASH_SESSION_STATE_DELEGATE_H_