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 "ash/multi_profile_uma.h" | 7 #include "ash/multi_profile_uma.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/ui/ash/ash_util.h" |
12 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 13 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
13 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_stub.h" | 14 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_stub.h" |
14 #include "components/signin/core/account_id/account_id.h" | 15 #include "components/signin/core/account_id/account_id.h" |
15 #include "components/user_manager/user_info.h" | 16 #include "components/user_manager/user_info.h" |
16 #include "components/user_manager/user_manager.h" | 17 #include "components/user_manager/user_manager.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 chrome::MultiUserWindowManager* g_instance = NULL; | 20 chrome::MultiUserWindowManager* g_instance = NULL; |
20 } // namespace | 21 } // namespace |
21 | 22 |
22 namespace chrome { | 23 namespace chrome { |
23 | 24 |
24 // Caching the current multi profile mode to avoid expensive detection | 25 // Caching the current multi profile mode to avoid expensive detection |
25 // operations. | 26 // operations. |
26 chrome::MultiUserWindowManager::MultiProfileMode | 27 chrome::MultiUserWindowManager::MultiProfileMode |
27 chrome::MultiUserWindowManager::multi_user_mode_ = | 28 chrome::MultiUserWindowManager::multi_user_mode_ = |
28 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_UNINITIALIZED; | 29 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_UNINITIALIZED; |
29 | 30 |
30 // static | 31 // static |
31 MultiUserWindowManager* MultiUserWindowManager::GetInstance() { | 32 MultiUserWindowManager* MultiUserWindowManager::GetInstance() { |
32 return g_instance; | 33 return g_instance; |
33 } | 34 } |
34 | 35 |
35 MultiUserWindowManager* MultiUserWindowManager::CreateInstance() { | 36 MultiUserWindowManager* MultiUserWindowManager::CreateInstance() { |
36 DCHECK(!g_instance); | 37 DCHECK(!g_instance); |
37 multi_user_mode_ = MULTI_PROFILE_MODE_OFF; | 38 multi_user_mode_ = MULTI_PROFILE_MODE_OFF; |
38 ash::MultiProfileUMA::SessionMode mode = | 39 ash::MultiProfileUMA::SessionMode mode = |
39 ash::MultiProfileUMA::SESSION_SINGLE_USER_MODE; | 40 ash::MultiProfileUMA::SESSION_SINGLE_USER_MODE; |
40 if (ash::Shell::Get()->shell_delegate()->IsMultiProfilesEnabled()) { | 41 // TODO(crbug.com/557406): Enable this component in Mash. |
| 42 if (!ash_util::IsRunningInMash() && |
| 43 ash::Shell::Get()->shell_delegate()->IsMultiProfilesEnabled()) { |
41 if (!g_instance) { | 44 if (!g_instance) { |
42 MultiUserWindowManagerChromeOS* manager = | 45 MultiUserWindowManagerChromeOS* manager = |
43 new MultiUserWindowManagerChromeOS(user_manager::UserManager::Get() | 46 new MultiUserWindowManagerChromeOS(user_manager::UserManager::Get() |
44 ->GetActiveUser() | 47 ->GetActiveUser() |
45 ->GetAccountId()); | 48 ->GetAccountId()); |
46 g_instance = manager; | 49 g_instance = manager; |
47 manager->Init(); | 50 manager->Init(); |
48 multi_user_mode_ = MULTI_PROFILE_MODE_SEPARATED; | 51 multi_user_mode_ = MULTI_PROFILE_MODE_SEPARATED; |
49 mode = ash::MultiProfileUMA::SESSION_SEPARATE_DESKTOP_MODE; | 52 mode = ash::MultiProfileUMA::SESSION_SEPARATE_DESKTOP_MODE; |
50 } else { | 53 } else { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void MultiUserWindowManager::SetInstanceForTest( | 96 void MultiUserWindowManager::SetInstanceForTest( |
94 MultiUserWindowManager* instance, | 97 MultiUserWindowManager* instance, |
95 MultiProfileMode mode) { | 98 MultiProfileMode mode) { |
96 if (g_instance) | 99 if (g_instance) |
97 DeleteInstance(); | 100 DeleteInstance(); |
98 g_instance = instance; | 101 g_instance = instance; |
99 multi_user_mode_ = mode; | 102 multi_user_mode_ = mode; |
100 } | 103 } |
101 | 104 |
102 } // namespace chrome | 105 } // namespace chrome |
OLD | NEW |