OLD | NEW |
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/shelf/shelf_model.h" | |
10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
11 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
12 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
13 #include "ash/display/screen_orientation_controller_chromeos.h" | 12 #include "ash/display/screen_orientation_controller_chromeos.h" |
14 #include "ash/shared/app_types.h" | 13 #include "ash/shared/app_types.h" |
15 #include "ash/shell.h" | 14 #include "ash/shell.h" |
16 #include "ash/wm/window_properties.h" | 15 #include "ash/wm/window_properties.h" |
17 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
18 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
19 #include "base/bind.h" | 18 #include "base/bind.h" |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 652 |
654 std::unique_ptr<ArcAppWindowLauncherItemController> controller = | 653 std::unique_ptr<ArcAppWindowLauncherItemController> controller = |
655 base::MakeUnique<ArcAppWindowLauncherItemController>( | 654 base::MakeUnique<ArcAppWindowLauncherItemController>( |
656 app_shelf_id.ToString()); | 655 app_shelf_id.ToString()); |
657 ArcAppWindowLauncherItemController* item_controller = controller.get(); | 656 ArcAppWindowLauncherItemController* item_controller = controller.get(); |
658 const ash::ShelfID shelf_id = | 657 const ash::ShelfID shelf_id = |
659 shelf_delegate_->GetShelfIDForAppID(app_shelf_id.ToString()); | 658 shelf_delegate_->GetShelfIDForAppID(app_shelf_id.ToString()); |
660 if (!shelf_id) { | 659 if (!shelf_id) { |
661 owner()->CreateAppLauncherItem(std::move(controller), ash::STATUS_RUNNING); | 660 owner()->CreateAppLauncherItem(std::move(controller), ash::STATUS_RUNNING); |
662 } else { | 661 } else { |
663 ash::ShelfModel* shelf_model = ash::Shell::Get()->shelf_model(); | 662 owner()->SetShelfItemDelegate(shelf_id, std::move(controller)); |
664 shelf_model->SetShelfItemDelegate(shelf_id, std::move(controller)); | |
665 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING); | 663 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING); |
666 } | 664 } |
667 item_controller->AddTaskId(task_id); | 665 item_controller->AddTaskId(task_id); |
668 app_shelf_group_to_controller_map_[app_shelf_id] = item_controller; | 666 app_shelf_group_to_controller_map_[app_shelf_id] = item_controller; |
669 return item_controller; | 667 return item_controller; |
670 } | 668 } |
671 | 669 |
672 void ArcAppWindowLauncherController::RegisterApp( | 670 void ArcAppWindowLauncherController::RegisterApp( |
673 AppWindowInfo* app_window_info) { | 671 AppWindowInfo* app_window_info) { |
674 AppWindow* app_window = app_window_info->app_window(); | 672 AppWindow* app_window = app_window_info->app_window(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); | 735 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); |
738 if (arc_app_id.empty()) | 736 if (arc_app_id.empty()) |
739 return -1; | 737 return -1; |
740 | 738 |
741 int task_id = -1; | 739 int task_id = -1; |
742 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) | 740 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) |
743 return -1; | 741 return -1; |
744 | 742 |
745 return task_id; | 743 return task_id; |
746 } | 744 } |
OLD | NEW |