| 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_state_delegate.h" | 13 #include "ash/session/session_state_delegate.h" |
| 14 #include "ash/session/user_info.h" |
| 14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 15 #include "ash/shell_delegate.h" | 16 #include "ash/shell_delegate.h" |
| 16 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
| 17 #endif | 18 #endif |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 chrome::MultiUserWindowManager* g_instance = NULL; | 21 chrome::MultiUserWindowManager* g_instance = NULL; |
| 21 } // namespace | 22 } // namespace |
| 22 | 23 |
| 23 namespace chrome { | 24 namespace chrome { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 } | 35 } |
| 35 | 36 |
| 36 MultiUserWindowManager* MultiUserWindowManager::CreateInstance() { | 37 MultiUserWindowManager* MultiUserWindowManager::CreateInstance() { |
| 37 DCHECK(!g_instance); | 38 DCHECK(!g_instance); |
| 38 multi_user_mode_ = MULTI_PROFILE_MODE_OFF; | 39 multi_user_mode_ = MULTI_PROFILE_MODE_OFF; |
| 39 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
| 40 ash::MultiProfileUMA::SessionMode mode = | 41 ash::MultiProfileUMA::SessionMode mode = |
| 41 ash::MultiProfileUMA::SESSION_SINGLE_USER_MODE; | 42 ash::MultiProfileUMA::SESSION_SINGLE_USER_MODE; |
| 42 if (!g_instance && | 43 if (!g_instance && |
| 43 ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { | 44 ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { |
| 44 g_instance = new MultiUserWindowManagerChromeOS( | 45 g_instance = |
| 45 ash::Shell::GetInstance()->session_state_delegate()->GetUserID(0)); | 46 new MultiUserWindowManagerChromeOS(ash::Shell::GetInstance() |
| 47 ->session_state_delegate() |
| 48 ->GetUserInfo(0) |
| 49 ->GetID()); |
| 46 multi_user_mode_ = MULTI_PROFILE_MODE_SEPARATED; | 50 multi_user_mode_ = MULTI_PROFILE_MODE_SEPARATED; |
| 47 mode = ash::MultiProfileUMA::SESSION_SEPARATE_DESKTOP_MODE; | 51 mode = ash::MultiProfileUMA::SESSION_SEPARATE_DESKTOP_MODE; |
| 48 } else if (ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { | 52 } else if (ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { |
| 49 // The side by side mode is using the Single user window manager since all | 53 // The side by side mode is using the Single user window manager since all |
| 50 // windows are unmanaged side by side. | 54 // windows are unmanaged side by side. |
| 51 multi_user_mode_ = MULTI_PROFILE_MODE_MIXED; | 55 multi_user_mode_ = MULTI_PROFILE_MODE_MIXED; |
| 52 mode = ash::MultiProfileUMA::SESSION_SIDE_BY_SIDE_MODE; | 56 mode = ash::MultiProfileUMA::SESSION_SIDE_BY_SIDE_MODE; |
| 53 } | 57 } |
| 54 ash::MultiProfileUMA::RecordSessionMode(mode); | 58 ash::MultiProfileUMA::RecordSessionMode(mode); |
| 55 #endif | 59 #endif |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 void MultiUserWindowManager::SetInstanceForTest( | 94 void MultiUserWindowManager::SetInstanceForTest( |
| 91 MultiUserWindowManager* instance, | 95 MultiUserWindowManager* instance, |
| 92 MultiProfileMode mode) { | 96 MultiProfileMode mode) { |
| 93 if (g_instance) | 97 if (g_instance) |
| 94 DeleteInstance(); | 98 DeleteInstance(); |
| 95 g_instance = instance; | 99 g_instance = instance; |
| 96 multi_user_mode_ = mode; | 100 multi_user_mode_ = mode; |
| 97 } | 101 } |
| 98 | 102 |
| 99 } // namespace chrome | 103 } // namespace chrome |
| OLD | NEW |