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

Unified Diff: chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.cc

Issue 2357143004: mash: Support ShelfWindowWatcher via ShelfItem properties. (Closed)
Patch Set: Address comments. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
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,
+ multi_user_util::IsProfileFromActiveUser(browser->profile())
+ ? ash::TYPE_DIALOG
+ : ash::TYPE_UNDEFINED);
}
}
« no previous file with comments | « chrome/browser/ui/ash/launcher/browser_status_monitor.cc ('k') | chrome/browser/ui/views/task_manager_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698