OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
5 #include "ash/content/screen_orientation_delegate_chromeos.h" | 5 #include "ash/content/screen_orientation_delegate_chromeos.h" |
6 | 6 |
7 #include "ash/display/screen_orientation_controller_chromeos.h" | 7 #include "ash/display/screen_orientation_controller_chromeos.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm_window.h" | |
10 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
11 | 10 |
12 namespace ash { | 11 namespace ash { |
13 | 12 |
14 ScreenOrientationDelegateChromeos::ScreenOrientationDelegateChromeos() { | 13 ScreenOrientationDelegateChromeos::ScreenOrientationDelegateChromeos() { |
15 content::WebContents::SetScreenOrientationDelegate(this); | 14 content::WebContents::SetScreenOrientationDelegate(this); |
16 } | 15 } |
17 | 16 |
18 ScreenOrientationDelegateChromeos::~ScreenOrientationDelegateChromeos() { | 17 ScreenOrientationDelegateChromeos::~ScreenOrientationDelegateChromeos() { |
19 content::WebContents::SetScreenOrientationDelegate(nullptr); | 18 content::WebContents::SetScreenOrientationDelegate(nullptr); |
20 } | 19 } |
21 | 20 |
22 bool ScreenOrientationDelegateChromeos::FullScreenRequired( | 21 bool ScreenOrientationDelegateChromeos::FullScreenRequired( |
23 content::WebContents* web_contents) { | 22 content::WebContents* web_contents) { |
24 return true; | 23 return true; |
25 } | 24 } |
26 | 25 |
27 void ScreenOrientationDelegateChromeos::Lock( | 26 void ScreenOrientationDelegateChromeos::Lock( |
28 content::WebContents* web_contents, | 27 content::WebContents* web_contents, |
29 blink::WebScreenOrientationLockType lock_orientation) { | 28 blink::WebScreenOrientationLockType lock_orientation) { |
30 Shell::Get()->screen_orientation_controller()->LockOrientationForWindow( | 29 Shell::Get()->screen_orientation_controller()->LockOrientationForWindow( |
31 WmWindow::Get(web_contents->GetNativeView()), lock_orientation, | 30 web_contents->GetNativeView(), lock_orientation, |
32 ScreenOrientationController::LockCompletionBehavior::None); | 31 ScreenOrientationController::LockCompletionBehavior::None); |
33 } | 32 } |
34 | 33 |
35 bool ScreenOrientationDelegateChromeos::ScreenOrientationProviderSupported() { | 34 bool ScreenOrientationDelegateChromeos::ScreenOrientationProviderSupported() { |
36 return Shell::Get() | 35 return Shell::Get() |
37 ->screen_orientation_controller() | 36 ->screen_orientation_controller() |
38 ->ScreenOrientationProviderSupported(); | 37 ->ScreenOrientationProviderSupported(); |
39 } | 38 } |
40 | 39 |
41 void ScreenOrientationDelegateChromeos::Unlock( | 40 void ScreenOrientationDelegateChromeos::Unlock( |
42 content::WebContents* web_contents) { | 41 content::WebContents* web_contents) { |
43 Shell::Get()->screen_orientation_controller()->UnlockOrientationForWindow( | 42 Shell::Get()->screen_orientation_controller()->UnlockOrientationForWindow( |
44 WmWindow::Get(web_contents->GetNativeView())); | 43 web_contents->GetNativeView()); |
45 } | 44 } |
46 | 45 |
47 } // namespace ash | 46 } // namespace ash |
OLD | NEW |