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

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc

Issue 2791803002: mash: Move LauncherItemController to ash, rename ShelfItemDelegate. (Closed)
Patch Set: Sync and rebase. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" 4 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
5 5
6 #include <string> 6 #include <string>
7 7
8 #include "ash/common/shelf/shelf_delegate.h" 8 #include "ash/common/shelf/shelf_delegate.h"
9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
10 #include "ash/common/wm/window_state.h" 10 #include "ash/common/wm/window_state.h"
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 int task_id, 634 int task_id,
635 const AppWindowInfo& app_window_info) { 635 const AppWindowInfo& app_window_info) {
636 const arc::ArcAppShelfId& app_shelf_id = app_window_info.app_shelf_id(); 636 const arc::ArcAppShelfId& app_shelf_id = app_window_info.app_shelf_id();
637 const auto it = app_shelf_group_to_controller_map_.find(app_shelf_id); 637 const auto it = app_shelf_group_to_controller_map_.find(app_shelf_id);
638 if (it != app_shelf_group_to_controller_map_.end()) { 638 if (it != app_shelf_group_to_controller_map_.end()) {
639 DCHECK_EQ(it->second->app_id(), app_shelf_id.ToString()); 639 DCHECK_EQ(it->second->app_id(), app_shelf_id.ToString());
640 it->second->AddTaskId(task_id); 640 it->second->AddTaskId(task_id);
641 return it->second; 641 return it->second;
642 } 642 }
643 643
644 ArcAppWindowLauncherItemController* controller = 644 std::unique_ptr<ArcAppWindowLauncherItemController> controller =
645 new ArcAppWindowLauncherItemController(app_shelf_id.ToString(), owner()); 645 base::MakeUnique<ArcAppWindowLauncherItemController>(
646 app_shelf_id.ToString());
647 ArcAppWindowLauncherItemController* item_controller = controller.get();
646 const ash::ShelfID shelf_id = 648 const ash::ShelfID shelf_id =
647 shelf_delegate_->GetShelfIDForAppID(app_shelf_id.ToString()); 649 shelf_delegate_->GetShelfIDForAppID(app_shelf_id.ToString());
648 if (!shelf_id) { 650 if (!shelf_id) {
649 owner()->CreateAppLauncherItem(controller, ash::STATUS_RUNNING); 651 owner()->CreateAppLauncherItem(std::move(controller), ash::STATUS_RUNNING);
650 } else { 652 } else {
651 owner()->SetItemController(shelf_id, controller); 653 owner()->SetShelfItemDelegate(shelf_id, std::move(controller));
652 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING); 654 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING);
653 } 655 }
654 controller->AddTaskId(task_id); 656 item_controller->AddTaskId(task_id);
655 app_shelf_group_to_controller_map_[app_shelf_id] = controller; 657 app_shelf_group_to_controller_map_[app_shelf_id] = item_controller;
656 return controller; 658 return item_controller;
657 } 659 }
658 660
659 void ArcAppWindowLauncherController::RegisterApp( 661 void ArcAppWindowLauncherController::RegisterApp(
660 AppWindowInfo* app_window_info) { 662 AppWindowInfo* app_window_info) {
661 AppWindow* app_window = app_window_info->app_window(); 663 AppWindow* app_window = app_window_info->app_window();
662 ArcAppWindowLauncherItemController* controller = 664 ArcAppWindowLauncherItemController* controller =
663 AttachControllerToTask(app_window->task_id(), *app_window_info); 665 AttachControllerToTask(app_window->task_id(), *app_window_info);
664 DCHECK(controller); 666 DCHECK(controller);
665 667
666 const ash::ShelfID shelf_id = 668 const ash::ShelfID shelf_id =
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); 723 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window);
722 if (arc_app_id.empty()) 724 if (arc_app_id.empty())
723 return -1; 725 return -1;
724 726
725 int task_id = -1; 727 int task_id = -1;
726 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) 728 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1)
727 return -1; 729 return -1;
728 730
729 return task_id; 731 return task_id;
730 } 732 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698