Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/system/chromeos/screen_orientation/screen_orientation_delegate_ash .h" | |
| 6 | |
| 7 #include "ash/shell.h" | |
| 8 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | |
| 9 #include "content/public/browser/screen_orientation_provider.h" | |
| 10 #include "ui/gfx/display.h" | |
| 11 | |
| 12 namespace ash { | |
| 13 | |
| 14 ScreenOrientationDelegateAsh::ScreenOrientationDelegateAsh() { | |
| 15 content::ScreenOrientationProvider::SetDelegate(this); | |
| 16 } | |
| 17 | |
| 18 ScreenOrientationDelegateAsh::~ScreenOrientationDelegateAsh() { | |
| 19 content::ScreenOrientationProvider::SetDelegate(NULL); | |
| 20 } | |
| 21 | |
| 22 bool ScreenOrientationDelegateAsh::FullScreenRequired( | |
| 23 content::WebContents* web_contents) { | |
| 24 return true; | |
| 25 } | |
| 26 | |
| 27 void ScreenOrientationDelegateAsh::Lock( | |
| 28 blink::WebScreenOrientationLockType lock_orientation) { | |
| 29 MaximizeModeController* controller = | |
| 30 Shell::GetInstance()->maximize_mode_controller(); | |
| 31 switch (lock_orientation) { | |
| 32 case blink::WebScreenOrientationLockDefault: | |
| 33 controller->SetRotationLocked(false); | |
|
mlamouri (slow - plz ping)
2014/10/13 09:45:44
Why not, but technically, that should not happen.
jonross
2014/10/14 19:38:04
Done.
| |
| 34 break; | |
| 35 case blink::WebScreenOrientationLockPortraitPrimary: | |
| 36 case blink::WebScreenOrientationLockPortrait: | |
| 37 controller->LockRotation(gfx::Display::ROTATE_90); | |
|
mlamouri (slow - plz ping)
2014/10/13 09:45:44
Two things worry me here:
1. we should allow rotat
jonross
2014/10/14 14:46:57
1) Had not realized that. The ChromeOS user rotati
jonross
2014/10/14 19:38:04
Done.
| |
| 38 break; | |
| 39 case blink::WebScreenOrientationLockPortraitSecondary: | |
| 40 controller->LockRotation(gfx::Display::ROTATE_270); | |
| 41 case blink::WebScreenOrientationLockLandscapeSecondary: | |
| 42 controller->LockRotation(gfx::Display::ROTATE_180); | |
|
mlamouri (slow - plz ping)
2014/10/13 09:45:44
Same regarding the natural orientation for the 'po
| |
| 43 break; | |
| 44 case blink::WebScreenOrientationLockAny: | |
| 45 controller->SetRotationLocked(true); | |
|
mlamouri (slow - plz ping)
2014/10/13 09:45:44
'any' doesn't mean locked to the current orientati
jonross
2014/10/14 19:38:04
Correct it is unlocked. Merging with the DCHEcK fo
| |
| 46 break; | |
| 47 case blink::WebScreenOrientationLockLandscapePrimary: | |
| 48 case blink::WebScreenOrientationLockLandscape: | |
| 49 case blink::WebScreenOrientationLockNatural: | |
| 50 default: | |
| 51 controller->LockRotation(gfx::Display::ROTATE_0); | |
|
mlamouri (slow - plz ping)
2014/10/13 09:45:44
Same comment regarding the natural orientation.
jonross
2014/10/14 19:38:04
Done.
| |
| 52 break; | |
| 53 } | |
| 54 } | |
| 55 | |
| 56 bool ScreenOrientationDelegateAsh::ScreenOrientationProviderSupported() { | |
| 57 return Shell::GetInstance()->maximize_mode_controller()-> | |
| 58 IsMaximizeModeWindowManagerEnabled(); | |
| 59 } | |
| 60 | |
| 61 void ScreenOrientationDelegateAsh::Unlock() { | |
| 62 Shell::GetInstance()->maximize_mode_controller()->SetRotationLocked(false); | |
| 63 } | |
| 64 | |
| 65 } // namespace ash | |
| OLD | NEW |