summaryrefslogtreecommitdiffstats
path: root/ash/content/screen_orientation_delegate_chromeos.cc
blob: 68777e675d1649e20ad3f95d595104c4ac5f8a46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/content/screen_orientation_delegate_chromeos.h"

#include "ash/display/screen_orientation_controller_chromeos.h"
#include "ash/shell.h"
#include "content/public/browser/screen_orientation_provider.h"
#include "content/public/browser/web_contents.h"

namespace ash {

ScreenOrientationDelegateChromeos::ScreenOrientationDelegateChromeos() {
  content::ScreenOrientationProvider::SetDelegate(this);
}
ScreenOrientationDelegateChromeos::~ScreenOrientationDelegateChromeos() {
  content::ScreenOrientationProvider::SetDelegate(nullptr);
}

bool ScreenOrientationDelegateChromeos::FullScreenRequired(
    content::WebContents* web_contents) {
  return true;
}

void ScreenOrientationDelegateChromeos::Lock(
    content::WebContents* web_contents,
    blink::WebScreenOrientationLockType lock_orientation) {
  Shell::GetInstance()
      ->screen_orientation_controller()
      ->LockOrientationForWindow(web_contents->GetNativeView(),
                                 lock_orientation);
}

bool ScreenOrientationDelegateChromeos::ScreenOrientationProviderSupported() {
  return Shell::GetInstance()
      ->screen_orientation_controller()
      ->ScreenOrientationProviderSupported();
}
void ScreenOrientationDelegateChromeos::Unlock(
    content::WebContents* web_contents) {
  Shell::GetInstance()
      ->screen_orientation_controller()
      ->UnlockOrientationForWindow(web_contents->GetNativeView());
}

}  // namespace ash