| 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/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 if (!display::Display::HasInternalDisplay()) | 46 if (!display::Display::HasInternalDisplay()) |
| 47 return arc::mojom::OrientationLock::NONE; | 47 return arc::mojom::OrientationLock::NONE; |
| 48 display::Display internal_display = | 48 display::Display internal_display = |
| 49 ash::Shell::GetInstance()->display_manager()->GetDisplayForId( | 49 ash::Shell::GetInstance()->display_manager()->GetDisplayForId( |
| 50 display::Display::InternalDisplayId()); | 50 display::Display::InternalDisplayId()); |
| 51 | 51 |
| 52 // ChromeOS currently assumes that the internal panel is always | 52 // ChromeOS currently assumes that the internal panel is always |
| 53 // landscape (ROTATE_0 == landscape). | 53 // landscape (ROTATE_0 == landscape). |
| 54 switch (internal_display.rotation()) { | 54 switch (internal_display.rotation()) { |
| 55 case display::Display::ROTATE_0: | 55 case display::Display::ROTATE_0: |
| 56 return arc::mojom::OrientationLock::LANDSCAPE_PRIMARY; |
| 57 case display::Display::ROTATE_90: |
| 58 return arc::mojom::OrientationLock::PORTRAIT_PRIMARY; |
| 56 case display::Display::ROTATE_180: | 59 case display::Display::ROTATE_180: |
| 57 return arc::mojom::OrientationLock::LANDSCAPE; | 60 return arc::mojom::OrientationLock::LANDSCAPE_SECONDARY; |
| 58 case display::Display::ROTATE_90: | |
| 59 case display::Display::ROTATE_270: | 61 case display::Display::ROTATE_270: |
| 60 return arc::mojom::OrientationLock::PORTRAIT; | 62 return arc::mojom::OrientationLock::PORTRAIT_SECONDARY; |
| 61 } | 63 } |
| 62 return arc::mojom::OrientationLock::NONE; | 64 return arc::mojom::OrientationLock::NONE; |
| 63 } | 65 } |
| 64 | 66 |
| 65 blink::WebScreenOrientationLockType BlinkOrientationLockFromMojom( | 67 blink::WebScreenOrientationLockType BlinkOrientationLockFromMojom( |
| 66 arc::mojom::OrientationLock orientation_lock) { | 68 arc::mojom::OrientationLock orientation_lock) { |
| 67 DCHECK_NE(arc::mojom::OrientationLock::CURRENT, orientation_lock); | 69 DCHECK_NE(arc::mojom::OrientationLock::CURRENT, orientation_lock); |
| 68 if (orientation_lock == arc::mojom::OrientationLock::PORTRAIT) { | 70 switch (orientation_lock) { |
| 69 return blink::WebScreenOrientationLockPortrait; | 71 case arc::mojom::OrientationLock::PORTRAIT: |
| 70 } else if (orientation_lock == arc::mojom::OrientationLock::LANDSCAPE) { | 72 return blink::WebScreenOrientationLockPortrait; |
| 71 return blink::WebScreenOrientationLockLandscape; | 73 case arc::mojom::OrientationLock::LANDSCAPE: |
| 72 } else { | 74 return blink::WebScreenOrientationLockLandscape; |
| 73 return blink::WebScreenOrientationLockAny; | 75 case arc::mojom::OrientationLock::PORTRAIT_PRIMARY: |
| 76 return blink::WebScreenOrientationLockPortraitPrimary; |
| 77 case arc::mojom::OrientationLock::LANDSCAPE_PRIMARY: |
| 78 return blink::WebScreenOrientationLockLandscapePrimary; |
| 79 case arc::mojom::OrientationLock::PORTRAIT_SECONDARY: |
| 80 return blink::WebScreenOrientationLockPortraitSecondary; |
| 81 case arc::mojom::OrientationLock::LANDSCAPE_SECONDARY: |
| 82 return blink::WebScreenOrientationLockLandscapeSecondary; |
| 83 default: |
| 84 return blink::WebScreenOrientationLockAny; |
| 74 } | 85 } |
| 75 } | 86 } |
| 76 | 87 |
| 77 } // namespace | 88 } // namespace |
| 78 | 89 |
| 79 class ArcAppWindowLauncherController::AppWindow : public ui::BaseWindow { | 90 class ArcAppWindowLauncherController::AppWindow : public ui::BaseWindow { |
| 80 public: | 91 public: |
| 81 AppWindow(int task_id, | 92 AppWindow(int task_id, |
| 82 const std::string app_id, | 93 const std::string app_id, |
| 83 ArcAppWindowLauncherController* owner) | 94 ArcAppWindowLauncherController* owner) |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 | 645 |
| 635 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { | 646 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { |
| 636 // Resolve the orientation when it first resolved. | 647 // Resolve the orientation when it first resolved. |
| 637 orientation_lock = GetCurrentOrientation(); | 648 orientation_lock = GetCurrentOrientation(); |
| 638 app_window->set_requested_orientation_lock(orientation_lock); | 649 app_window->set_requested_orientation_lock(orientation_lock); |
| 639 } | 650 } |
| 640 | 651 |
| 641 shell->screen_orientation_controller()->LockOrientationForWindow( | 652 shell->screen_orientation_controller()->LockOrientationForWindow( |
| 642 window, BlinkOrientationLockFromMojom(orientation_lock)); | 653 window, BlinkOrientationLockFromMojom(orientation_lock)); |
| 643 } | 654 } |
| OLD | NEW |