| 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" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 if (!display::Display::HasInternalDisplay()) | 47 if (!display::Display::HasInternalDisplay()) |
| 48 return arc::mojom::OrientationLock::NONE; | 48 return arc::mojom::OrientationLock::NONE; |
| 49 display::Display internal_display = | 49 display::Display internal_display = |
| 50 ash::Shell::GetInstance()->display_manager()->GetDisplayForId( | 50 ash::Shell::GetInstance()->display_manager()->GetDisplayForId( |
| 51 display::Display::InternalDisplayId()); | 51 display::Display::InternalDisplayId()); |
| 52 | 52 |
| 53 // ChromeOS currently assumes that the internal panel is always | 53 // ChromeOS currently assumes that the internal panel is always |
| 54 // landscape (ROTATE_0 == landscape). | 54 // landscape (ROTATE_0 == landscape). |
| 55 switch (internal_display.rotation()) { | 55 switch (internal_display.rotation()) { |
| 56 case display::Display::ROTATE_0: | 56 case display::Display::ROTATE_0: |
| 57 return arc::mojom::OrientationLock::LANDSCAPE_PRIMARY; |
| 58 case display::Display::ROTATE_90: |
| 59 return arc::mojom::OrientationLock::PORTRAIT_PRIMARY; |
| 57 case display::Display::ROTATE_180: | 60 case display::Display::ROTATE_180: |
| 58 return arc::mojom::OrientationLock::LANDSCAPE; | 61 return arc::mojom::OrientationLock::LANDSCAPE_SECONDARY; |
| 59 case display::Display::ROTATE_90: | |
| 60 case display::Display::ROTATE_270: | 62 case display::Display::ROTATE_270: |
| 61 return arc::mojom::OrientationLock::PORTRAIT; | 63 return arc::mojom::OrientationLock::PORTRAIT_SECONDARY; |
| 62 } | 64 } |
| 63 return arc::mojom::OrientationLock::NONE; | 65 return arc::mojom::OrientationLock::NONE; |
| 64 } | 66 } |
| 65 | 67 |
| 66 blink::WebScreenOrientationLockType BlinkOrientationLockFromMojom( | 68 blink::WebScreenOrientationLockType BlinkOrientationLockFromMojom( |
| 67 arc::mojom::OrientationLock orientation_lock) { | 69 arc::mojom::OrientationLock orientation_lock) { |
| 68 DCHECK_NE(arc::mojom::OrientationLock::CURRENT, orientation_lock); | 70 DCHECK_NE(arc::mojom::OrientationLock::CURRENT, orientation_lock); |
| 69 if (orientation_lock == arc::mojom::OrientationLock::PORTRAIT) { | 71 switch (orientation_lock) { |
| 70 return blink::WebScreenOrientationLockPortrait; | 72 case arc::mojom::OrientationLock::PORTRAIT: |
| 71 } else if (orientation_lock == arc::mojom::OrientationLock::LANDSCAPE) { | 73 return blink::WebScreenOrientationLockPortrait; |
| 72 return blink::WebScreenOrientationLockLandscape; | 74 case arc::mojom::OrientationLock::LANDSCAPE: |
| 73 } else { | 75 return blink::WebScreenOrientationLockLandscape; |
| 74 return blink::WebScreenOrientationLockAny; | 76 case arc::mojom::OrientationLock::PORTRAIT_PRIMARY: |
| 77 return blink::WebScreenOrientationLockPortraitPrimary; |
| 78 case arc::mojom::OrientationLock::LANDSCAPE_PRIMARY: |
| 79 return blink::WebScreenOrientationLockLandscapePrimary; |
| 80 case arc::mojom::OrientationLock::PORTRAIT_SECONDARY: |
| 81 return blink::WebScreenOrientationLockPortraitSecondary; |
| 82 case arc::mojom::OrientationLock::LANDSCAPE_SECONDARY: |
| 83 return blink::WebScreenOrientationLockLandscapeSecondary; |
| 84 default: |
| 85 return blink::WebScreenOrientationLockAny; |
| 75 } | 86 } |
| 76 } | 87 } |
| 77 | 88 |
| 78 } // namespace | 89 } // namespace |
| 79 | 90 |
| 80 class ArcAppWindowLauncherController::AppWindow : public ui::BaseWindow { | 91 class ArcAppWindowLauncherController::AppWindow : public ui::BaseWindow { |
| 81 public: | 92 public: |
| 82 AppWindow(int task_id, | 93 AppWindow(int task_id, |
| 83 const std::string app_id, | 94 const std::string app_id, |
| 84 ArcAppWindowLauncherController* owner) | 95 ArcAppWindowLauncherController* owner) |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { | 618 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { |
| 608 // Resolve the orientation when it first resolved. | 619 // Resolve the orientation when it first resolved. |
| 609 orientation_lock = GetCurrentOrientation(); | 620 orientation_lock = GetCurrentOrientation(); |
| 610 app_window->set_requested_orientation_lock(orientation_lock); | 621 app_window->set_requested_orientation_lock(orientation_lock); |
| 611 } | 622 } |
| 612 | 623 |
| 613 ash::Shell* shell = ash::Shell::GetInstance(); | 624 ash::Shell* shell = ash::Shell::GetInstance(); |
| 614 shell->screen_orientation_controller()->LockOrientationForWindow( | 625 shell->screen_orientation_controller()->LockOrientationForWindow( |
| 615 window, BlinkOrientationLockFromMojom(orientation_lock)); | 626 window, BlinkOrientationLockFromMojom(orientation_lock)); |
| 616 } | 627 } |
| OLD | NEW |