Commit c03911e2 authored by nancy's avatar nancy Committed by Commit Bot

Inactive and active the app windows when the active user is changed.

BUG=1011235

Change-Id: I8de563d0dccff8db1b1a6229c2bdd68c8bb77e08
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1939991
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721795}
parent 7f0d8b94
...@@ -49,12 +49,34 @@ void AppServiceAppWindowLauncherController::ActiveUserChanged( ...@@ -49,12 +49,34 @@ void AppServiceAppWindowLauncherController::ActiveUserChanged(
if (proxy_) if (proxy_)
Observe(nullptr); Observe(nullptr);
// TODO(crbug.com/1011235): Inactive the running app windows in auto* new_proxy =
// InstanceRegistry for the inactive user, and active the app windows for the apps::AppServiceProxyFactory::GetForProfile(owner()->profile());
// active user. DCHECK(new_proxy);
// Deactivates the running app windows in InstanceRegistry for the inactive
// user, and activates the app windows for the active user.
for (const auto& window_item : aura_window_to_app_window_) {
AppWindowBase* app_window = window_item.second.get();
const std::string app_id = app_window->shelf_id().app_id;
// Skips ARC apps, because task id is used for ARC apps.
if (app_id == ash::kInternalAppIdKeyboardShortcutViewer ||
proxy_->AppRegistryCache().GetAppType(app_id) ==
apps::mojom::AppType::kArc ||
new_proxy->AppRegistryCache().GetAppType(app_id) ==
apps::mojom::AppType::kArc) {
continue;
}
proxy_ = apps::AppServiceProxyFactory::GetForProfile(owner()->profile()); if (!new_proxy->InstanceRegistry()
DCHECK(proxy_); .GetWindows(app_window->shelf_id().app_id)
.empty()) {
AddToShelf(app_window);
} else {
RemoveFromShelf(app_window);
}
}
proxy_ = new_proxy;
Observe(&proxy_->InstanceRegistry()); Observe(&proxy_->InstanceRegistry());
app_service_instance_helper_->ActiveUserChanged(); app_service_instance_helper_->ActiveUserChanged();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment