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