[email protected] | 10a67c1 | 2012-01-04 19:41:10 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 6570e56 | 2011-10-14 21:59:17 | [diff] [blame] | 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 | |||||
[email protected] | 09af0f7 | 2012-02-27 20:23:19 | [diff] [blame] | 8 | #include "ppapi/cpp/instance_handle.h" |
9 | |||||
[email protected] | 10a67c1 | 2012-01-04 19:41:10 | [diff] [blame] | 10 | /// @file |
11 | /// This file defines the API for handling transitions of a module instance to | ||||
12 | /// and from fullscreen mode. | ||||
13 | |||||
[email protected] | 6570e56 | 2011-10-14 21:59:17 | [diff] [blame] | 14 | namespace pp { |
15 | |||||
[email protected] | 6570e56 | 2011-10-14 21:59:17 | [diff] [blame] | 16 | class Size; |
17 | |||||
[email protected] | 10a67c1 | 2012-01-04 19:41:10 | [diff] [blame] | 18 | /// The Fullscreen class allowing you to check and toggle fullscreen mode. |
[email protected] | 6570e56 | 2011-10-14 21:59:17 | [diff] [blame] | 19 | class Fullscreen { |
20 | public: | ||||
[email protected] | 10a67c1 | 2012-01-04 19:41:10 | [diff] [blame] | 21 | /// A constructor for creating a <code>Fullscreen</code>. |
22 | /// | ||||
[email protected] | 09af0f7 | 2012-02-27 20:23:19 | [diff] [blame] | 23 | /// @param[in] instance The instance with which this resource will be |
24 | /// associated. | ||||
25 | explicit Fullscreen(const InstanceHandle& instance); | ||||
[email protected] | 10a67c1 | 2012-01-04 19:41:10 | [diff] [blame] | 26 | |
27 | /// Destructor. | ||||
[email protected] | 6570e56 | 2011-10-14 21:59:17 | [diff] [blame] | 28 | virtual ~Fullscreen(); |
29 | |||||
[email protected] | 10a67c1 | 2012-01-04 19:41:10 | [diff] [blame] | 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, | ||||
[email protected] | b47fc32 | 2012-01-11 22:57:10 | [diff] [blame] | 34 | /// <code>false</code> if the module instance is not in fullscreen mode. |
[email protected] | 6570e56 | 2011-10-14 21:59:17 | [diff] [blame] | 35 | bool IsFullscreen(); |
[email protected] | 10a67c1 | 2012-01-04 19:41:10 | [diff] [blame] | 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 | /// | ||||
[email protected] | b47fc32 | 2012-01-11 22:57:10 | [diff] [blame] | 52 | /// @return <code>true</code> on success or <code>false</code> on |
[email protected] | 10a67c1 | 2012-01-04 19:41:10 | [diff] [blame] | 53 | /// failure. |
[email protected] | 6570e56 | 2011-10-14 21:59:17 | [diff] [blame] | 54 | bool SetFullscreen(bool fullscreen); |
[email protected] | 10a67c1 | 2012-01-04 19:41:10 | [diff] [blame] | 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. | ||||
[email protected] | 6570e56 | 2011-10-14 21:59:17 | [diff] [blame] | 64 | bool GetScreenSize(Size* size); |
65 | |||||
66 | private: | ||||
[email protected] | 09af0f7 | 2012-02-27 20:23:19 | [diff] [blame] | 67 | InstanceHandle instance_; |
[email protected] | 6570e56 | 2011-10-14 21:59:17 | [diff] [blame] | 68 | }; |
69 | |||||
70 | } // namespace pp | ||||
71 | |||||
72 | #endif // PPAPI_CPP_FULLSCREEN_H_ |