OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/session_state_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" |
6 | 6 |
7 #include "ash/multi_profile_uma.h" | 7 #include "ash/multi_profile_uma.h" |
8 #include "ash/session/session_state_observer.h" | 8 #include "ash/session/session_state_observer.h" |
9 #include "ash/system/chromeos/multi_user/user_switch_util.h" | 9 #include "ash/system/chromeos/multi_user/user_switch_util.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 return chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); | 59 return chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
60 } | 60 } |
61 | 61 |
62 content::BrowserContext* | 62 content::BrowserContext* |
63 SessionStateDelegateChromeos::GetBrowserContextForWindow( | 63 SessionStateDelegateChromeos::GetBrowserContextForWindow( |
64 aura::Window* window) { | 64 aura::Window* window) { |
65 const std::string& user_id = | 65 const std::string& user_id = |
66 chrome::MultiUserWindowManager::GetInstance()->GetWindowOwner(window); | 66 chrome::MultiUserWindowManager::GetInstance()->GetWindowOwner(window); |
67 const user_manager::User* user = | 67 const user_manager::User* user = |
68 user_manager::UserManager::Get()->FindUser(user_id); | 68 user_manager::UserManager::Get()->FindUser(user_id); |
69 DCHECK(user); | 69 return user ? (chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user)) |
70 return chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); | 70 : NULL; |
oshima
2015/04/07 19:53:44
why this change?
xdai1
2015/04/09 17:22:40
In Login screen, we might fail this check since th
oshima
2015/04/09 17:50:48
Why this wasn't an issue before? Do you think this
xdai1
2015/04/09 22:45:25
Because in this fix we will call this GetBrowserCo
oshima
2015/04/10 20:39:48
what kind of "user_id" would you get if it's in lo
| |
71 } | |
72 | |
73 const std::string& SessionStateDelegateChromeos::GetUserPresentingWindow( | |
74 aura::Window* window) { | |
75 return chrome::MultiUserWindowManager::GetInstance()->GetUserPresentingWindow( | |
76 window); | |
71 } | 77 } |
72 | 78 |
73 int SessionStateDelegateChromeos::GetMaximumNumberOfLoggedInUsers() const { | 79 int SessionStateDelegateChromeos::GetMaximumNumberOfLoggedInUsers() const { |
74 // We limit list of logged in users to 10 due to memory constraints. | 80 // We limit list of logged in users to 10 due to memory constraints. |
75 // Note that 10 seems excessive, but we want to test how many users are | 81 // Note that 10 seems excessive, but we want to test how many users are |
76 // actually added to a session. | 82 // actually added to a session. |
77 // TODO(nkostylev): Adjust this limitation based on device capabilites. | 83 // TODO(nkostylev): Adjust this limitation based on device capabilites. |
78 // http://crbug.com/230865 | 84 // http://crbug.com/230865 |
79 return 10; | 85 return 10; |
80 } | 86 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 } | 290 } |
285 | 291 |
286 void DoSwitchUser(const std::string& user_id) { | 292 void DoSwitchUser(const std::string& user_id) { |
287 user_manager::UserManager::Get()->SwitchActiveUser(user_id); | 293 user_manager::UserManager::Get()->SwitchActiveUser(user_id); |
288 } | 294 } |
289 | 295 |
290 void SessionStateDelegateChromeos::TryToSwitchUser( | 296 void SessionStateDelegateChromeos::TryToSwitchUser( |
291 const std::string& user_id) { | 297 const std::string& user_id) { |
292 ash::TrySwitchingActiveUser(base::Bind(&DoSwitchUser, user_id)); | 298 ash::TrySwitchingActiveUser(base::Bind(&DoSwitchUser, user_id)); |
293 } | 299 } |
OLD | NEW |