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