Chromium Code Reviews| Index: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc |
| diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc |
| index 99a8b0763eadb9ce24fdf5bbb9f438f9d4d2f6e5..ab990c92cf68d2096b62c5468010101c670a8b66 100644 |
| --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc |
| +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc |
| @@ -4,6 +4,9 @@ |
| #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
| +#include <set> |
| +#include <vector> |
| + |
| #include "ash/media_controller.h" |
| #include "ash/multi_profile_uma.h" |
| #include "ash/public/cpp/shell_window_ids.h" |
| @@ -23,6 +26,7 @@ |
| #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| #include "chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.h" |
| #include "chrome/browser/ui/ash/session_controller_client.h" |
| +#include "chrome/browser/ui/ash/session_util.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_list.h" |
| @@ -526,6 +530,25 @@ bool MultiUserWindowManagerChromeOS::ShowWindowForUserIntern( |
| WindowToEntryMap::iterator it = window_to_entry_.find(window); |
| it->second->set_show_for_user(account_id); |
| + // Show avatar icon on the teleported window for separated mode. |
| + if (GetMultiProfileMode() == MULTI_PROFILE_MODE_SEPARATED) { |
| + // Tests could either not have a UserManager or the UserManager does not |
| + // know the window owner. |
| + const user_manager::User* const window_owner = |
| + user_manager::UserManager::IsInitialized() |
| + ? user_manager::UserManager::Get()->FindUser(owner) |
| + : nullptr; |
| + |
| + const bool teleported = !IsWindowOnDesktopOfUser(window, owner); |
| + if (window_owner && teleported) { |
| + window->SetProperty( |
| + aura::client::kAvatarIconKey, |
| + new gfx::ImageSkia(GetAvatarImageForUser(window_owner))); |
| + } else { |
| + window->ClearProperty(aura::client::kAvatarIconKey); |
| + } |
| + } |
|
James Cook
2017/05/30 21:27:15
If it's not too hard, could you add test coverage
xiyuan
2017/05/30 22:44:14
Done.
|
| + |
| // Show the window if the added user is the current one. |
| if (account_id == current_account_id_) { |
| // Only show the window if it should be shown according to its state. |