| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 5 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_stub.h" | 8 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_stub.h" |
| 9 | 9 |
| 10 #if defined(OS_CHROMEOS) | 10 #if defined(OS_CHROMEOS) |
| 11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
| 12 #include "ash/multi_profile_uma.h" | 12 #include "ash/multi_profile_uma.h" |
| 13 #include "ash/session/session_state_delegate.h" | 13 #include "ash/session/session_state_delegate.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/shell_delegate.h" | 15 #include "ash/shell_delegate.h" |
| 16 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 16 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
| 17 #include "components/signin/core/account_id/account_id.h" |
| 17 #include "components/user_manager/user_info.h" | 18 #include "components/user_manager/user_info.h" |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 chrome::MultiUserWindowManager* g_instance = NULL; | 22 chrome::MultiUserWindowManager* g_instance = NULL; |
| 22 } // namespace | 23 } // namespace |
| 23 | 24 |
| 24 namespace chrome { | 25 namespace chrome { |
| 25 | 26 |
| 26 // Caching the current multi profile mode to avoid expensive detection | 27 // Caching the current multi profile mode to avoid expensive detection |
| (...skipping 12 matching lines...) Expand all Loading... |
| 39 multi_user_mode_ = MULTI_PROFILE_MODE_OFF; | 40 multi_user_mode_ = MULTI_PROFILE_MODE_OFF; |
| 40 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 41 ash::MultiProfileUMA::SessionMode mode = | 42 ash::MultiProfileUMA::SessionMode mode = |
| 42 ash::MultiProfileUMA::SESSION_SINGLE_USER_MODE; | 43 ash::MultiProfileUMA::SESSION_SINGLE_USER_MODE; |
| 43 if (!g_instance && | 44 if (!g_instance && |
| 44 ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { | 45 ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { |
| 45 MultiUserWindowManagerChromeOS* manager = | 46 MultiUserWindowManagerChromeOS* manager = |
| 46 new MultiUserWindowManagerChromeOS(ash::Shell::GetInstance() | 47 new MultiUserWindowManagerChromeOS(ash::Shell::GetInstance() |
| 47 ->session_state_delegate() | 48 ->session_state_delegate() |
| 48 ->GetUserInfo(0) | 49 ->GetUserInfo(0) |
| 49 ->GetUserID()); | 50 ->GetAccountId() |
| 51 .GetUserEmail()); |
| 50 g_instance = manager; | 52 g_instance = manager; |
| 51 manager->Init(); | 53 manager->Init(); |
| 52 multi_user_mode_ = MULTI_PROFILE_MODE_SEPARATED; | 54 multi_user_mode_ = MULTI_PROFILE_MODE_SEPARATED; |
| 53 mode = ash::MultiProfileUMA::SESSION_SEPARATE_DESKTOP_MODE; | 55 mode = ash::MultiProfileUMA::SESSION_SEPARATE_DESKTOP_MODE; |
| 54 } else if (ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { | 56 } else if (ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { |
| 55 // The side by side mode is using the Single user window manager since all | 57 // The side by side mode is using the Single user window manager since all |
| 56 // windows are unmanaged side by side. | 58 // windows are unmanaged side by side. |
| 57 multi_user_mode_ = MULTI_PROFILE_MODE_MIXED; | 59 multi_user_mode_ = MULTI_PROFILE_MODE_MIXED; |
| 58 mode = ash::MultiProfileUMA::SESSION_SIDE_BY_SIDE_MODE; | 60 mode = ash::MultiProfileUMA::SESSION_SIDE_BY_SIDE_MODE; |
| 59 } | 61 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 void MultiUserWindowManager::SetInstanceForTest( | 98 void MultiUserWindowManager::SetInstanceForTest( |
| 97 MultiUserWindowManager* instance, | 99 MultiUserWindowManager* instance, |
| 98 MultiProfileMode mode) { | 100 MultiProfileMode mode) { |
| 99 if (g_instance) | 101 if (g_instance) |
| 100 DeleteInstance(); | 102 DeleteInstance(); |
| 101 g_instance = instance; | 103 g_instance = instance; |
| 102 multi_user_mode_ = mode; | 104 multi_user_mode_ = mode; |
| 103 } | 105 } |
| 104 | 106 |
| 105 } // namespace chrome | 107 } // namespace chrome |
| OLD | NEW |