Chromium Code Reviews| Index: chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.cc |
| diff --git a/chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.cc |
| index ab3fb69fce167516aa2cab3921620ca76371daf2..b75862a01a853ea562ec093531e71642877400e3 100644 |
| --- a/chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.cc |
| +++ b/chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.cc |
| @@ -6,8 +6,8 @@ |
| #include "ash/aura/wm_window_aura.h" |
| #include "ash/common/shelf/shelf_item_types.h" |
| +#include "ash/common/wm_window_observer.h" |
| #include "ash/common/wm_window_property.h" |
| -#include "ash/resources/grit/ash_resources.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| @@ -18,9 +18,6 @@ |
| #include "chrome/browser/ui/browser_window.h" |
| #include "chrome/browser/ui/settings_window_manager.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| -#include "chrome/grit/generated_resources.h" |
| -#include "components/strings/grit/components_strings.h" |
| -#include "ui/base/l10n/l10n_util.h" |
| MultiProfileBrowserStatusMonitor::MultiProfileBrowserStatusMonitor( |
| ChromeLauncherController* launcher_controller) |
| @@ -47,9 +44,7 @@ void MultiProfileBrowserStatusMonitor::ActiveUserChanged( |
| BrowserList* browser_list = BrowserList::GetInstance(); |
| // Remove old (tabbed V1) applications. |
| - for (BrowserList::const_iterator it = browser_list->begin(); |
| - it != browser_list->end(); ++it) { |
| - Browser* browser = *it; |
| + for (Browser* browser : *browser_list) { |
| if (!browser->is_app() && |
| browser->is_type_tabbed() && |
| !multi_user_util::IsProfileFromActiveUser(browser->profile())) { |
| @@ -62,9 +57,7 @@ void MultiProfileBrowserStatusMonitor::ActiveUserChanged( |
| } |
| // Handle apps in browser tabs: Add new (tabbed V1) applications. |
| - for (BrowserList::const_iterator it = browser_list->begin(); |
| - it != browser_list->end(); ++it) { |
| - Browser* browser = *it; |
| + for (Browser* browser : *browser_list) { |
| if (!browser->is_app() && |
| browser->is_type_tabbed() && |
| multi_user_util::IsProfileFromActiveUser(browser->profile())) { |
| @@ -79,24 +72,18 @@ void MultiProfileBrowserStatusMonitor::ActiveUserChanged( |
| } |
| } |
| - // Remove settings window icons not associated with this profile and create |
| - // icons for windows associated with the current profile. |
| - for (BrowserList::const_iterator it = browser_list->begin(); |
| - it != browser_list->end(); ++it) { |
| - Browser* browser = *it; |
| - if (!chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser( |
| + // Hide settings window shelf items not associated with this profile and |
| + // restore items for windows associated with the current profile. |
| + for (Browser* browser : *browser_list) { |
| + if (chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser( |
| browser)) { |
| - continue; |
| - } |
| - aura::Window* aura_window = browser->window()->GetNativeWindow(); |
| - if (multi_user_util::IsProfileFromActiveUser(browser->profile())) { |
| - ash::ShelfItemDetails item_details; |
| - item_details.type = ash::TYPE_DIALOG; |
| - item_details.image_resource_id = IDR_ASH_SHELF_ICON_SETTINGS; |
| - item_details.title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE); |
| - ash::WmWindowAura::Get(aura_window)->SetShelfItemDetails(item_details); |
| - } else { |
| - ash::WmWindowAura::Get(aura_window)->ClearShelfItemDetails(); |
| + aura::Window* aura_window = browser->window()->GetNativeWindow(); |
| + ash::WmWindowAura::Get(aura_window) |
| + ->SetIntProperty( |
| + ash::WmWindowProperty::SHELF_ITEM_TYPE, |
|
James Cook
2016/09/29 02:49:46
Wait, don't we also need to set the icon ID when y
msw
2016/09/29 06:23:36
No, this is effectively just 'hiding' and 'showing
|
| + multi_user_util::IsProfileFromActiveUser(browser->profile()) |
| + ? ash::TYPE_DIALOG |
| + : ash::TYPE_UNDEFINED); |
| } |
| } |