Commit 4f0f29db authored by nancy's avatar nancy Committed by Commit Bot

Fix the inconsistent app_id issue for ARC shelf id.

Modify app_it to use the shelf id, not the ARC shelf id, when the task
is created, to align with other cases.

Modify app id to get the correct app_id from ARC sheld id for ARC
shortcut in AppServiceAppWindowLauncherController.

BUG=1063386

Change-Id: I97b5d50c205ff2d1a0351f95730d244867569f66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2114474Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752656}
parent 22c92d1e
...@@ -137,8 +137,8 @@ void AppServiceAppWindowArcTracker::OnTaskCreated( ...@@ -137,8 +137,8 @@ void AppServiceAppWindowArcTracker::OnTaskCreated(
state = static_cast<apps::InstanceState>( state = static_cast<apps::InstanceState>(
state | apps::InstanceState::kStarted | apps::InstanceState::kRunning); state | apps::InstanceState::kStarted | apps::InstanceState::kRunning);
app_service_controller_->app_service_instance_helper()->OnInstances( app_service_controller_->app_service_instance_helper()->OnInstances(
task_id_to_arc_app_window_info_[task_id]->app_shelf_id().ToString(), task_id_to_arc_app_window_info_[task_id]->app_shelf_id().app_id(), window,
window, std::string(), state); std::string(), state);
arc_window_candidates_.erase(window); arc_window_candidates_.erase(window);
} }
......
...@@ -38,6 +38,19 @@ ...@@ -38,6 +38,19 @@
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace {
// Returns the app id from the app id or the shelf group id.
std::string GetAppId(const std::string& id) {
const arc::ArcAppShelfId arc_app_shelf_id =
arc::ArcAppShelfId::FromString(id);
if (!arc_app_shelf_id.valid() || !arc_app_shelf_id.has_shelf_group_id())
return id;
return arc_app_shelf_id.app_id();
}
} // namespace
AppServiceAppWindowLauncherController::AppServiceAppWindowLauncherController( AppServiceAppWindowLauncherController::AppServiceAppWindowLauncherController(
ChromeLauncherController* owner) ChromeLauncherController* owner)
: AppWindowLauncherController(owner), : AppWindowLauncherController(owner),
...@@ -185,7 +198,7 @@ void AppServiceAppWindowLauncherController::OnWindowVisibilityChanged( ...@@ -185,7 +198,7 @@ void AppServiceAppWindowLauncherController::OnWindowVisibilityChanged(
// set it as |kVisible|, otherwise, clear the visible bit. // set it as |kVisible|, otherwise, clear the visible bit.
apps::InstanceState state = apps::InstanceState state =
app_service_instance_helper_->CalculateVisibilityState(window, visible); app_service_instance_helper_->CalculateVisibilityState(window, visible);
app_service_instance_helper_->OnInstances(shelf_id.app_id, window, app_service_instance_helper_->OnInstances(GetAppId(shelf_id.app_id), window,
shelf_id.launch_id, state); shelf_id.launch_id, state);
if (!visible || shelf_id.app_id == extension_misc::kChromeAppId) if (!visible || shelf_id.app_id == extension_misc::kChromeAppId)
...@@ -220,8 +233,9 @@ void AppServiceAppWindowLauncherController::OnWindowDestroying( ...@@ -220,8 +233,9 @@ void AppServiceAppWindowLauncherController::OnWindowDestroying(
} }
// Delete the instance from InstanceRegistry. // Delete the instance from InstanceRegistry.
app_service_instance_helper_->OnInstances( app_service_instance_helper_->OnInstances(GetAppId(shelf_id.app_id), window,
shelf_id.app_id, window, std::string(), apps::InstanceState::kDestroyed); std::string(),
apps::InstanceState::kDestroyed);
auto app_window_it = aura_window_to_app_window_.find(window); auto app_window_it = aura_window_to_app_window_.find(window);
if (app_window_it == aura_window_to_app_window_.end()) if (app_window_it == aura_window_to_app_window_.end())
...@@ -413,7 +427,7 @@ void AppServiceAppWindowLauncherController::SetWindowActivated( ...@@ -413,7 +427,7 @@ void AppServiceAppWindowLauncherController::SetWindowActivated(
apps::InstanceState state = apps::InstanceState state =
app_service_instance_helper_->CalculateActivatedState(window, active); app_service_instance_helper_->CalculateActivatedState(window, active);
app_service_instance_helper_->OnInstances(shelf_id.app_id, window, app_service_instance_helper_->OnInstances(GetAppId(shelf_id.app_id), window,
std::string(), state); std::string(), state);
} }
......
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