Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/ui/ash/session_state_delegate_chromeos.cc

Issue 1053013007: Minimized windows should not be activated by another user in multiprofile scenario. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698