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

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

Issue 2615663002: Fix MediaClient::RequestCaptureState(). (Closed)
Patch Set: rebase Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chrome_shell_content_state.h" 5 #include "chrome/browser/ui/ash/chrome_shell_content_state.h"
6 6
7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/wm_shell.h"
9 #include "chrome/browser/chromeos/profiles/profile_helper.h" 7 #include "chrome/browser/chromeos/profiles/profile_helper.h"
10 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 8 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
11 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 9 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
12 #include "components/signin/core/account_id/account_id.h" 10 #include "components/signin/core/account_id/account_id.h"
13 #include "components/user_manager/user_manager.h" 11 #include "components/user_manager/user_manager.h"
14 #include "content/public/browser/browser_context.h" 12 #include "content/public/browser/browser_context.h"
15 13
16 content::BrowserContext* ChromeShellContentState::GetBrowserContextByIndex( 14 content::BrowserContext* ChromeShellContentState::GetBrowserContextByIndex(
17 ash::UserIndex index) { 15 ash::UserIndex index) {
18 ash::SessionStateDelegate* session_state_delegate = 16 DCHECK_LT(static_cast<size_t>(index),
19 ash::WmShell::Get()->GetSessionStateDelegate(); 17 user_manager::UserManager::Get()->GetLoggedInUsers().size());
20 DCHECK_LT(index, session_state_delegate->NumberOfLoggedInUsers());
21 user_manager::User* user = 18 user_manager::User* user =
22 user_manager::UserManager::Get()->GetLRULoggedInUsers()[index]; 19 user_manager::UserManager::Get()->GetLRULoggedInUsers()[index];
23 CHECK(user); 20 CHECK(user);
24 return chromeos::ProfileHelper::Get()->GetProfileByUser(user); 21 return chromeos::ProfileHelper::Get()->GetProfileByUser(user);
25 } 22 }
26 23
27 content::BrowserContext* ChromeShellContentState::GetBrowserContextForWindow( 24 content::BrowserContext* ChromeShellContentState::GetBrowserContextForWindow(
28 aura::Window* window) { 25 aura::Window* window) {
29 DCHECK(window); 26 DCHECK(window);
30 // Speculative fix for multi-profile crash. crbug.com/661821 27 // Speculative fix for multi-profile crash. crbug.com/661821
(...skipping 15 matching lines...) Expand all
46 if (!chrome::MultiUserWindowManager::GetInstance()) 43 if (!chrome::MultiUserWindowManager::GetInstance())
47 return nullptr; 44 return nullptr;
48 45
49 const AccountId& account_id = 46 const AccountId& account_id =
50 chrome::MultiUserWindowManager::GetInstance()->GetUserPresentingWindow( 47 chrome::MultiUserWindowManager::GetInstance()->GetUserPresentingWindow(
51 window); 48 window);
52 return account_id.is_valid() 49 return account_id.is_valid()
53 ? multi_user_util::GetProfileFromAccountId(account_id) 50 ? multi_user_util::GetProfileFromAccountId(account_id)
54 : nullptr; 51 : nullptr;
55 } 52 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_content_state.cc ('k') | chrome/browser/ui/ash/media_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698