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

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

Issue 2111443002: mash: Migrate SessionStateDelegate access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 5 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/session_util.h" 5 #include "chrome/browser/ui/ash/session_util.h"
6 6
7 #include "ash/common/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/wm_shell.h"
8 #include "ash/content/shell_content_state.h" 9 #include "ash/content/shell_content_state.h"
9 #include "ash/shell.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/browser/chromeos/profiles/profile_helper.h" 11 #include "chrome/browser/chromeos/profiles/profile_helper.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "components/user_manager/user_manager.h" 14 #include "components/user_manager/user_manager.h"
15 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
16 #include "grit/ash_resources.h" 16 #include "grit/ash_resources.h"
17 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
18 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/image/image_skia_operations.h" 19 #include "ui/gfx/image/image_skia_operations.h"
20 20
21 content::BrowserContext* GetActiveBrowserContext() { 21 content::BrowserContext* GetActiveBrowserContext() {
22 DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size()); 22 DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size());
23 return ProfileManager::GetActiveUserProfile(); 23 return ProfileManager::GetActiveUserProfile();
24 } 24 }
25 25
26 bool CanShowWindowForUser( 26 bool CanShowWindowForUser(
27 aura::Window* window, 27 aura::Window* window,
28 const GetActiveBrowserContextCallback& get_context_callback) { 28 const GetActiveBrowserContextCallback& get_context_callback) {
29 ash::SessionStateDelegate* delegate = 29 ash::SessionStateDelegate* delegate =
30 ash::Shell::GetInstance()->session_state_delegate(); 30 ash::WmShell::Get()->GetSessionStateDelegate();
31 if (delegate->NumberOfLoggedInUsers() > 1) { 31 if (delegate->NumberOfLoggedInUsers() > 1) {
32 content::BrowserContext* active_browser_context = 32 content::BrowserContext* active_browser_context =
33 get_context_callback.Run(); 33 get_context_callback.Run();
34 ash::ShellContentState* state = ash::ShellContentState::GetInstance(); 34 ash::ShellContentState* state = ash::ShellContentState::GetInstance();
35 content::BrowserContext* owner_browser_context = 35 content::BrowserContext* owner_browser_context =
36 state->GetBrowserContextForWindow(window); 36 state->GetBrowserContextForWindow(window);
37 content::BrowserContext* shown_browser_context = 37 content::BrowserContext* shown_browser_context =
38 state->GetUserPresentingBrowserContextForWindow(window); 38 state->GetUserPresentingBrowserContextForWindow(window);
39 39
40 if (owner_browser_context && active_browser_context && 40 if (owner_browser_context && active_browser_context &&
(...skipping 17 matching lines...) Expand all
58 chromeos::ProfileHelper::Get() 58 chromeos::ProfileHelper::Get()
59 ->GetUserByProfile(Profile::FromBrowserContext(context)) 59 ->GetUserByProfile(Profile::FromBrowserContext(context))
60 ->GetImage(); 60 ->GetImage();
61 61
62 gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage( 62 gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage(
63 user_image, skia::ImageOperations::RESIZE_BEST, holder->size()); 63 user_image, skia::ImageOperations::RESIZE_BEST, holder->size());
64 gfx::ImageSkia masked = 64 gfx::ImageSkia masked =
65 gfx::ImageSkiaOperations::CreateMaskedImage(resized, *holder_mask); 65 gfx::ImageSkiaOperations::CreateMaskedImage(resized, *holder_mask);
66 return gfx::ImageSkiaOperations::CreateSuperimposedImage(*holder, masked); 66 return gfx::ImageSkiaOperations::CreateSuperimposedImage(*holder, masked);
67 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698