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
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FULLSCREEN_SCOPED_ALLOW_FULLSCREEN_H_
6 #define THIRD_PARTY_BLINK_RENDERER_CORE_FULLSCREEN_SCOPED_ALLOW_FULLSCREEN_H_
7 
8 #include "base/macros.h"
9 #include "base/optional.h"
10 #include "third_party/blink/renderer/core/core_export.h"
11 #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
12 
13 namespace blink {
14 
15 class CORE_EXPORT ScopedAllowFullscreen {
16   STACK_ALLOCATED();
17 
18  public:
19   enum Reason { kOrientationChange, kXrOverlay };
20 
21   static base::Optional<Reason> FullscreenAllowedReason();
22   explicit ScopedAllowFullscreen(Reason);
23   ~ScopedAllowFullscreen();
24 
25  private:
26   static base::Optional<Reason> reason_;
27   base::Optional<Reason> previous_reason_;
28 
29   DISALLOW_COPY_AND_ASSIGN(ScopedAllowFullscreen);
30 };
31 
32 }  // namespace blink
33 
34 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_FULLSCREEN_SCOPED_ALLOW_FULLSCREEN_H_
35