blob: 3504424e5a8d249b11203708036bc98be1a8e782 [file] [log] [blame]
[email protected]10a67c12012-01-04 19:41:101// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]6570e562011-10-14 21:59:172// 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
[email protected]09af0f72012-02-27 20:23:198#include "ppapi/cpp/instance_handle.h"
9
[email protected]10a67c12012-01-04 19:41:1010/// @file
11/// This file defines the API for handling transitions of a module instance to
12/// and from fullscreen mode.
13
[email protected]6570e562011-10-14 21:59:1714namespace pp {
15
[email protected]6570e562011-10-14 21:59:1716class Size;
17
[email protected]10a67c12012-01-04 19:41:1018/// The Fullscreen class allowing you to check and toggle fullscreen mode.
[email protected]6570e562011-10-14 21:59:1719class Fullscreen {
20 public:
[email protected]10a67c12012-01-04 19:41:1021 /// A constructor for creating a <code>Fullscreen</code>.
22 ///
[email protected]09af0f72012-02-27 20:23:1923 /// @param[in] instance The instance with which this resource will be
24 /// associated.
25 explicit Fullscreen(const InstanceHandle& instance);
[email protected]10a67c12012-01-04 19:41:1026
27 /// Destructor.
[email protected]6570e562011-10-14 21:59:1728 virtual ~Fullscreen();
29
[email protected]10a67c12012-01-04 19:41:1030 /// 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,
[email protected]b47fc322012-01-11 22:57:1034 /// <code>false</code> if the module instance is not in fullscreen mode.
[email protected]6570e562011-10-14 21:59:1735 bool IsFullscreen();
[email protected]10a67c12012-01-04 19:41:1036
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 ///
[email protected]b47fc322012-01-11 22:57:1052 /// @return <code>true</code> on success or <code>false</code> on
[email protected]10a67c12012-01-04 19:41:1053 /// failure.
[email protected]6570e562011-10-14 21:59:1754 bool SetFullscreen(bool fullscreen);
[email protected]10a67c12012-01-04 19:41:1055
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.
[email protected]6570e562011-10-14 21:59:1764 bool GetScreenSize(Size* size);
65
66 private:
[email protected]09af0f72012-02-27 20:23:1967 InstanceHandle instance_;
[email protected]6570e562011-10-14 21:59:1768};
69
70} // namespace pp
71
72#endif // PPAPI_CPP_FULLSCREEN_H_