1// Copyright (c) 2012 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 PPAPI_CPP_FULLSCREEN_H_
6#define PPAPI_CPP_FULLSCREEN_H_
7
8#include "ppapi/cpp/instance_handle.h"
9
10/// @file
11/// This file defines the API for handling transitions of a module instance to
12/// and from fullscreen mode.
13
14namespace pp {
15
16class Size;
17
18/// The Fullscreen class allowing you to check and toggle fullscreen mode.
19class Fullscreen {
20 public:
21  /// A constructor for creating a <code>Fullscreen</code>.
22  ///
23  /// @param[in] instance The instance with which this resource will be
24  /// associated.
25  explicit Fullscreen(const InstanceHandle& instance);
26
27  /// Destructor.
28  virtual ~Fullscreen();
29
30  /// IsFullscreen() checks whether the module instance is currently in
31  /// fullscreen mode.
32  ///
33  /// @return <code>true</code> if the module instance is in fullscreen mode,
34  /// <code>false</code> if the module instance is not in fullscreen mode.
35  bool IsFullscreen();
36
37  /// SetFullscreen() switches the module instance to and from fullscreen
38  /// mode.
39  ///
40  /// The transition to and from fullscreen mode is asynchronous. During the
41  /// transition, IsFullscreen() will return the previous value and
42  /// no 2D or 3D device can be bound. The transition ends at DidChangeView()
43  /// when IsFullscreen() returns the new value. You might receive other
44  /// DidChangeView() calls while in transition.
45  ///
46  /// The transition to fullscreen mode can only occur while the browser is
47  /// processing a user gesture, even if <code>true</code> is returned.
48  ///
49  /// @param[in] fullscreen <code>true</code> to enter fullscreen mode, or
50  /// <code>false</code> to exit fullscreen mode.
51  ///
52  /// @return <code>true</code> on success or <code>false</code> on
53  /// failure.
54  bool SetFullscreen(bool fullscreen);
55
56  /// GetScreenSize() gets the size of the screen in pixels. The module instance
57  /// will be resized to this size when SetFullscreen() is called to enter
58  /// fullscreen mode.
59  ///
60  /// @param[out] size The size of the entire screen in pixels.
61  ///
62  /// @return <code>true</code> on success or <code>false</code> on
63  /// failure.
64  bool GetScreenSize(Size* size);
65
66 private:
67  InstanceHandle instance_;
68};
69
70}  // namespace pp
71
72#endif  // PPAPI_CPP_FULLSCREEN_H_
73