| 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/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" |
| 11 #include "ash/common/wm_lookup.h" | |
| 12 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 13 #include "ash/common/wm_window.h" | 12 #include "ash/common/wm_window.h" |
| 14 #include "ash/common/wm_window_property.h" | 13 #include "ash/common/wm_window_property.h" |
| 15 #include "ash/display/screen_orientation_controller_chromeos.h" | 14 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 16 #include "ash/shared/app_types.h" | 15 #include "ash/shared/app_types.h" |
| 17 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 18 #include "ash/wm/window_state_aura.h" | 17 #include "ash/wm/window_state_aura.h" |
| 19 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
| 20 #include "base/bind.h" | 19 #include "base/bind.h" |
| 21 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 ArcAppWindowLauncherItemController* controller = app_window->controller(); | 680 ArcAppWindowLauncherItemController* controller = app_window->controller(); |
| 682 if (controller) | 681 if (controller) |
| 683 controller->RemoveWindow(app_window); | 682 controller->RemoveWindow(app_window); |
| 684 app_window->ResetController(); | 683 app_window->ResetController(); |
| 685 app_window_info->set_app_window(nullptr); | 684 app_window_info->set_app_window(nullptr); |
| 686 } | 685 } |
| 687 | 686 |
| 688 void ArcAppWindowLauncherController::SetOrientationLockForAppWindow( | 687 void ArcAppWindowLauncherController::SetOrientationLockForAppWindow( |
| 689 AppWindow* app_window) { | 688 AppWindow* app_window) { |
| 690 ash::WmWindow* window = | 689 ash::WmWindow* window = |
| 691 ash::WmLookup::Get()->GetWindowForWidget(app_window->widget()); | 690 ash::WmWindow::Get(app_window->widget()->GetNativeWindow()); |
| 692 if (!window) | 691 if (!window) |
| 693 return; | 692 return; |
| 694 AppWindowInfo* info = GetAppWindowInfoForTask(app_window->task_id()); | 693 AppWindowInfo* info = GetAppWindowInfoForTask(app_window->task_id()); |
| 695 arc::mojom::OrientationLock orientation_lock; | 694 arc::mojom::OrientationLock orientation_lock; |
| 696 | 695 |
| 697 if (info->has_requested_orientation_lock()) { | 696 if (info->has_requested_orientation_lock()) { |
| 698 orientation_lock = info->requested_orientation_lock(); | 697 orientation_lock = info->requested_orientation_lock(); |
| 699 } else { | 698 } else { |
| 700 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(observed_profile_); | 699 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(observed_profile_); |
| 701 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = | 700 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| (...skipping 18 matching lines...) Expand all Loading... |
| 720 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); | 719 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); |
| 721 if (arc_app_id.empty()) | 720 if (arc_app_id.empty()) |
| 722 return -1; | 721 return -1; |
| 723 | 722 |
| 724 int task_id = -1; | 723 int task_id = -1; |
| 725 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) | 724 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) |
| 726 return -1; | 725 return -1; |
| 727 | 726 |
| 728 return task_id; | 727 return task_id; |
| 729 } | 728 } |
| OLD | NEW |