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

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

Issue 2870683002: ash: Remove ShelfModel id conversion functions. (Closed)
Patch Set: Address comments. Created 3 years, 7 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/arc_app_window_launcher_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc
index cc480b7427e3ec2cb2a9078371bec849e161934a..d96c0053fa3c39002e24ba5c074f4096dde1065c 100644
--- a/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc
@@ -654,13 +654,12 @@ ArcAppWindowLauncherController::AttachControllerToTask(
base::MakeUnique<ArcAppWindowLauncherItemController>(
app_shelf_id.ToString());
ArcAppWindowLauncherItemController* item_controller = controller.get();
- ash::ShelfModel* shelf_model = ash::Shell::Get()->shelf_model();
- const ash::ShelfID shelf_id =
- shelf_model->GetShelfIDForAppID(app_shelf_id.ToString());
- if (shelf_id.IsNull()) {
+ const ash::ShelfID shelf_id(app_shelf_id.ToString());
+ if (!owner()->GetItem(shelf_id)) {
owner()->CreateAppLauncherItem(std::move(controller), ash::STATUS_RUNNING);
} else {
- shelf_model->SetShelfItemDelegate(shelf_id, std::move(controller));
+ owner()->shelf_model()->SetShelfItemDelegate(shelf_id,
+ std::move(controller));
owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING);
}
item_controller->AddTaskId(task_id);
@@ -673,12 +672,9 @@ void ArcAppWindowLauncherController::RegisterApp(
AppWindow* app_window = app_window_info->app_window();
ArcAppWindowLauncherItemController* controller =
AttachControllerToTask(app_window->task_id(), *app_window_info);
- DCHECK(controller);
-
- const ash::ShelfID shelf_id =
- ash::Shell::Get()->shelf_model()->GetShelfIDForAppID(
- controller->app_id());
- DCHECK(!shelf_id.IsNull());
+ DCHECK(!controller->app_id().empty());
+ const ash::ShelfID shelf_id(controller->app_id());
+ DCHECK(owner()->GetItem(shelf_id));
controller->AddWindow(app_window);
owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING);

Powered by Google App Engine
This is Rietveld 408576698