| OLD | NEW |
| 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" | |
| 8 #include "ash/common/wm_shell.h" | 7 #include "ash/common/wm_shell.h" |
| 9 #include "ash/content/shell_content_state.h" | 8 #include "ash/content/shell_content_state.h" |
| 10 #include "ash/resources/grit/ash_resources.h" | 9 #include "ash/resources/grit/ash_resources.h" |
| 11 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 12 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "components/user_manager/user_manager.h" | 14 #include "components/user_manager/user_manager.h" |
| 16 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
| 17 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/image/image_skia_operations.h" | 18 #include "ui/gfx/image/image_skia_operations.h" |
| 20 | 19 |
| 21 content::BrowserContext* GetActiveBrowserContext() { | 20 content::BrowserContext* GetActiveBrowserContext() { |
| 22 DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size()); | 21 DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size()); |
| 23 return ProfileManager::GetActiveUserProfile(); | 22 return ProfileManager::GetActiveUserProfile(); |
| 24 } | 23 } |
| 25 | 24 |
| 26 bool CanShowWindowForUser( | 25 bool CanShowWindowForUser( |
| 27 aura::Window* window, | 26 aura::Window* window, |
| 28 const GetActiveBrowserContextCallback& get_context_callback) { | 27 const GetActiveBrowserContextCallback& get_context_callback) { |
| 29 DCHECK(window); | 28 DCHECK(window); |
| 30 ash::SessionStateDelegate* delegate = | 29 if (user_manager::UserManager::Get()->GetLoggedInUsers().size() > 1u) { |
| 31 ash::WmShell::Get()->GetSessionStateDelegate(); | |
| 32 if (delegate->NumberOfLoggedInUsers() > 1) { | |
| 33 content::BrowserContext* active_browser_context = | 30 content::BrowserContext* active_browser_context = |
| 34 get_context_callback.Run(); | 31 get_context_callback.Run(); |
| 35 ash::ShellContentState* state = ash::ShellContentState::GetInstance(); | 32 ash::ShellContentState* state = ash::ShellContentState::GetInstance(); |
| 36 content::BrowserContext* owner_browser_context = | 33 content::BrowserContext* owner_browser_context = |
| 37 state->GetBrowserContextForWindow(window); | 34 state->GetBrowserContextForWindow(window); |
| 38 content::BrowserContext* shown_browser_context = | 35 content::BrowserContext* shown_browser_context = |
| 39 state->GetUserPresentingBrowserContextForWindow(window); | 36 state->GetUserPresentingBrowserContextForWindow(window); |
| 40 | 37 |
| 41 if (owner_browser_context && active_browser_context && | 38 if (owner_browser_context && active_browser_context && |
| 42 owner_browser_context != active_browser_context && | 39 owner_browser_context != active_browser_context && |
| (...skipping 16 matching lines...) Expand all Loading... |
| 59 chromeos::ProfileHelper::Get() | 56 chromeos::ProfileHelper::Get() |
| 60 ->GetUserByProfile(Profile::FromBrowserContext(context)) | 57 ->GetUserByProfile(Profile::FromBrowserContext(context)) |
| 61 ->GetImage(); | 58 ->GetImage(); |
| 62 | 59 |
| 63 gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage( | 60 gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage( |
| 64 user_image, skia::ImageOperations::RESIZE_BEST, holder->size()); | 61 user_image, skia::ImageOperations::RESIZE_BEST, holder->size()); |
| 65 gfx::ImageSkia masked = | 62 gfx::ImageSkia masked = |
| 66 gfx::ImageSkiaOperations::CreateMaskedImage(resized, *holder_mask); | 63 gfx::ImageSkiaOperations::CreateMaskedImage(resized, *holder_mask); |
| 67 return gfx::ImageSkiaOperations::CreateSuperimposedImage(*holder, masked); | 64 return gfx::ImageSkiaOperations::CreateSuperimposedImage(*holder, masked); |
| 68 } | 65 } |
| OLD | NEW |