summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authornkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-15 16:01:59 +0000
committernkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-15 16:01:59 +0000
commite718e6f7d6eea1371878b26675472e521a24afa7 (patch)
tree16e8c9a030d9c6f9e6b60eb4ff048bcfe6750f73 /ash
parentd86dd76ec38386fab8ffc3197bbb3be01c4006a6 (diff)
downloadchromium_src-e718e6f7d6eea1371878b26675472e521a24afa7.zip
chromium_src-e718e6f7d6eea1371878b26675472e521a24afa7.tar.gz
chromium_src-e718e6f7d6eea1371878b26675472e521a24afa7.tar.bz2
Chrome OS multi-profiles backend and UI.
* Tray - launch login UI for multi-profiles * UserManager: GetLoggedInUsers(), SwitchActiveUser(), add GetActiveUser() which will later replace GetLoggedInUser() * Login UI: support "sign in to add" mode Notifications: * Pass chromeos::User* in details for - NOTIFICATION_LOGIN_USER_CHANGED - NOTIFICATION_ACTIVE_USER_CHANGED - NOTIFICATION_SESSION_STARTED * Add NOTIFICATION_ACTIVE_USER_CHANGED (only when switching users for now) Multi-profile hacks * Initialize BrowserPolicyConnector only for primary user (http://crbug.com/230349) * Redirect logging only once (http://crbug.com/230345) * OAuth2LoginManager tracks only last logged in user (http://crbug.com/230342) Depends on: * Changes in ProfileManager https://codereview.chromium.org/14028010/ * Adding concept of "signin profile" https://codereview.chromium.org/13633003/ BUG=180903,217016 TEST=ProfileManager tests, manual (with all CLs applied and --multi-profiles) Review URL: https://codereview.chromium.org/14139003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194185 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/shell/shell_delegate_impl.cc4
-rw-r--r--ash/shell/shell_delegate_impl.h1
-rw-r--r--ash/shell_delegate.h3
-rw-r--r--ash/system/tray/system_tray_delegate.h13
-rw-r--r--ash/system/tray/test_system_tray_delegate.cc9
-rw-r--r--ash/system/tray/test_system_tray_delegate.h3
-rw-r--r--ash/system/user/tray_user.cc13
-rw-r--r--ash/test/test_shell_delegate.cc4
-rw-r--r--ash/test/test_shell_delegate.h1
9 files changed, 46 insertions, 5 deletions
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index 330ab4d..bb29637 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -55,6 +55,10 @@ bool ShellDelegateImpl::IsFirstRunAfterBoot() const {
return false;
}
+bool ShellDelegateImpl::IsMultiProfilesEnabled() const {
+ return false;
+}
+
bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
return false;
}
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index b001038..b162d7a 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -31,6 +31,7 @@ class ShellDelegateImpl : public ash::ShellDelegate {
virtual bool IsSessionStarted() const OVERRIDE;
virtual bool IsGuestSession() const OVERRIDE;
virtual bool IsFirstRunAfterBoot() const OVERRIDE;
+ virtual bool IsMultiProfilesEnabled() const OVERRIDE;
virtual bool IsRunningInForcedAppMode() const OVERRIDE;
virtual bool CanLockScreen() const OVERRIDE;
virtual void LockScreen() OVERRIDE;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index ce1c3a1..99aeb6e 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -112,6 +112,9 @@ class ASH_EXPORT ShellDelegate {
// restarted, typically due to logging in as a guest or logging out.
virtual bool IsFirstRunAfterBoot() const = 0;
+ // Returns true if multi-profiles feature is enabled.
+ virtual bool IsMultiProfilesEnabled() const = 0;
+
// Returns true if we're running in forced app mode.
virtual bool IsRunningInForcedAppMode() const = 0;
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h
index ba6a24f..7d079eb 100644
--- a/ash/system/tray/system_tray_delegate.h
+++ b/ash/system/tray/system_tray_delegate.h
@@ -110,6 +110,8 @@ typedef std::vector<IMEInfo> IMEInfoList;
class VolumeControlDelegate;
+typedef std::vector<std::string> UserEmailList;
+
class SystemTrayDelegate {
public:
virtual ~SystemTrayDelegate() {}
@@ -123,13 +125,19 @@ class SystemTrayDelegate {
// Returns true if system tray should be visible on startup.
virtual bool GetTrayVisibilityOnStartup() = 0;
- // Gets information about the logged in user.
+ // Gets information about the active user.
virtual const base::string16 GetUserDisplayName() const = 0;
virtual const std::string GetUserEmail() const = 0;
virtual const gfx::ImageSkia& GetUserImage() const = 0;
virtual user::LoginStatus GetUserLoginStatus() const = 0;
virtual bool IsOobeCompleted() const = 0;
+ // Returns a list of all logged in users.
+ virtual void GetLoggedInUsers(UserEmailList* users) = 0;
+
+ // Switches to another active user (if that user has already signed in).
+ virtual void SwitchActiveUser(const std::string& email) = 0;
+
// Shows UI for changing user's profile picture.
virtual void ChangeProfilePicture() = 0;
@@ -184,6 +192,9 @@ class SystemTrayDelegate {
// Shows information about enterprise enrolled devices.
virtual void ShowEnterpriseInfo() = 0;
+ // Shows login UI to add other users to this session.
+ virtual void ShowUserLogin() = 0;
+
// Attempts to shut down the system.
virtual void ShutDown() = 0;
diff --git a/ash/system/tray/test_system_tray_delegate.cc b/ash/system/tray/test_system_tray_delegate.cc
index 54dd036..30e63e4 100644
--- a/ash/system/tray/test_system_tray_delegate.cc
+++ b/ash/system/tray/test_system_tray_delegate.cc
@@ -103,6 +103,12 @@ bool TestSystemTrayDelegate::IsOobeCompleted() const {
return true;
}
+void TestSystemTrayDelegate::GetLoggedInUsers(UserEmailList* users) {
+}
+
+void TestSystemTrayDelegate::SwitchActiveUser(const std::string& email) {
+}
+
void TestSystemTrayDelegate::ChangeProfilePicture() {
}
@@ -162,6 +168,9 @@ void TestSystemTrayDelegate::ShowPublicAccountInfo() {
void TestSystemTrayDelegate::ShowEnterpriseInfo() {
}
+void TestSystemTrayDelegate::ShowUserLogin() {
+}
+
void TestSystemTrayDelegate::ShutDown() {
MessageLoop::current()->Quit();
}
diff --git a/ash/system/tray/test_system_tray_delegate.h b/ash/system/tray/test_system_tray_delegate.h
index 80f9fce..a08b6ef 100644
--- a/ash/system/tray/test_system_tray_delegate.h
+++ b/ash/system/tray/test_system_tray_delegate.h
@@ -31,6 +31,8 @@ class TestSystemTrayDelegate : public SystemTrayDelegate {
virtual const gfx::ImageSkia& GetUserImage() const OVERRIDE;
virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE;
virtual bool IsOobeCompleted() const OVERRIDE;
+ virtual void GetLoggedInUsers(UserEmailList* users) OVERRIDE;
+ virtual void SwitchActiveUser(const std::string& email) OVERRIDE;
virtual void ChangeProfilePicture() OVERRIDE;
virtual const std::string GetEnterpriseDomain() const OVERRIDE;
virtual const base::string16 GetEnterpriseMessage() const OVERRIDE;
@@ -49,6 +51,7 @@ class TestSystemTrayDelegate : public SystemTrayDelegate {
virtual void ShowAccessibilityHelp() OVERRIDE;
virtual void ShowPublicAccountInfo() OVERRIDE;
virtual void ShowEnterpriseInfo() OVERRIDE;
+ virtual void ShowUserLogin() OVERRIDE;
virtual void ShutDown() OVERRIDE;
virtual void SignOut() OVERRIDE;
virtual void RequestLockScreen() OVERRIDE;
diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc
index 23f81a6..60b0d8d 100644
--- a/ash/system/user/tray_user.cc
+++ b/ash/system/user/tray_user.cc
@@ -9,6 +9,7 @@
#include <vector>
#include "ash/shell.h"
+#include "ash/shell_delegate.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/system_tray_notifier.h"
@@ -470,12 +471,16 @@ void UserView::Layout() {
}
void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) {
- if (sender == logout_button_)
+ if (sender == logout_button_) {
ash::Shell::GetInstance()->system_tray_delegate()->SignOut();
- else if (sender == profile_picture_)
- ash::Shell::GetInstance()->system_tray_delegate()->ChangeProfilePicture();
- else
+ } else if (sender == profile_picture_) {
+ if (ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled())
+ ash::Shell::GetInstance()->system_tray_delegate()->ShowUserLogin();
+ else
+ ash::Shell::GetInstance()->system_tray_delegate()->ChangeProfilePicture();
+ } else {
NOTREACHED();
+ }
}
void UserView::AddLogoutButton(ash::user::LoginStatus login) {
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index 6ec196d..ea971d7 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -49,6 +49,10 @@ bool TestShellDelegate::IsFirstRunAfterBoot() const {
return false;
}
+bool TestShellDelegate::IsMultiProfilesEnabled() const {
+ return false;
+}
+
bool TestShellDelegate::IsRunningInForcedAppMode() const {
return false;
}
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index 269d571..1ff9ce9 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -30,6 +30,7 @@ class TestShellDelegate : public ShellDelegate {
virtual bool IsSessionStarted() const OVERRIDE;
virtual bool IsGuestSession() const OVERRIDE;
virtual bool IsFirstRunAfterBoot() const OVERRIDE;
+ virtual bool IsMultiProfilesEnabled() const OVERRIDE;
virtual bool IsRunningInForcedAppMode() const OVERRIDE;
virtual bool CanLockScreen() const OVERRIDE;
virtual void LockScreen() OVERRIDE;