| 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/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return blink::WebScreenOrientationLockLandscapePrimary; | 81 return blink::WebScreenOrientationLockLandscapePrimary; |
| 82 case arc::mojom::OrientationLock::PORTRAIT_SECONDARY: | 82 case arc::mojom::OrientationLock::PORTRAIT_SECONDARY: |
| 83 return blink::WebScreenOrientationLockPortraitSecondary; | 83 return blink::WebScreenOrientationLockPortraitSecondary; |
| 84 case arc::mojom::OrientationLock::LANDSCAPE_SECONDARY: | 84 case arc::mojom::OrientationLock::LANDSCAPE_SECONDARY: |
| 85 return blink::WebScreenOrientationLockLandscapeSecondary; | 85 return blink::WebScreenOrientationLockLandscapeSecondary; |
| 86 default: | 86 default: |
| 87 return blink::WebScreenOrientationLockAny; | 87 return blink::WebScreenOrientationLockAny; |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 int GetWindowTaskId(aura::Window* window) { | |
| 92 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); | |
| 93 if (arc_app_id.empty()) | |
| 94 return -1; | |
| 95 | |
| 96 int task_id = -1; | |
| 97 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) | |
| 98 return -1; | |
| 99 | |
| 100 return task_id; | |
| 101 } | |
| 102 | |
| 103 } // namespace | 91 } // namespace |
| 104 | 92 |
| 105 // The information about the arc application window which has to be kept | 93 // The information about the arc application window which has to be kept |
| 106 // even when its AppWindow is not present. | 94 // even when its AppWindow is not present. |
| 107 class ArcAppWindowLauncherController::AppWindowInfo { | 95 class ArcAppWindowLauncherController::AppWindowInfo { |
| 108 public: | 96 public: |
| 109 explicit AppWindowInfo(const std::string& shelf_app_id) | 97 explicit AppWindowInfo(const std::string& shelf_app_id) |
| 110 : shelf_app_id_(shelf_app_id) {} | 98 : shelf_app_id_(shelf_app_id) {} |
| 111 ~AppWindowInfo() {} | 99 ~AppWindowInfo() {} |
| 112 | 100 |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 | 704 |
| 717 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { | 705 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { |
| 718 // Resolve the orientation when it first resolved. | 706 // Resolve the orientation when it first resolved. |
| 719 orientation_lock = GetCurrentOrientation(); | 707 orientation_lock = GetCurrentOrientation(); |
| 720 info->set_requested_orientation_lock(orientation_lock); | 708 info->set_requested_orientation_lock(orientation_lock); |
| 721 } | 709 } |
| 722 ash::Shell* shell = ash::Shell::GetInstance(); | 710 ash::Shell* shell = ash::Shell::GetInstance(); |
| 723 shell->screen_orientation_controller()->LockOrientationForWindow( | 711 shell->screen_orientation_controller()->LockOrientationForWindow( |
| 724 window, BlinkOrientationLockFromMojom(orientation_lock)); | 712 window, BlinkOrientationLockFromMojom(orientation_lock)); |
| 725 } | 713 } |
| 714 |
| 715 // static |
| 716 int ArcAppWindowLauncherController::GetWindowTaskId(aura::Window* window) { |
| 717 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); |
| 718 if (arc_app_id.empty()) |
| 719 return -1; |
| 720 |
| 721 int task_id = -1; |
| 722 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) |
| 723 return -1; |
| 724 |
| 725 return task_id; |
| 726 } |
| OLD | NEW |