Revert of Move NumberOfPlanesForGpuMemoryBufferFormat to gfx (patchset #4 id:120001...
[chromium-blink-merge.git] / ppapi / cpp / private / flash_fullscreen.cc
blob8d33b5f0f7f5441f03433712c13c98193ac465bb
1 // Copyright (c) 2011 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.
5 #include "ppapi/cpp/private/flash_fullscreen.h"
7 #include "ppapi/c/private/ppb_flash_fullscreen.h"
8 #include "ppapi/cpp/instance.h"
9 #include "ppapi/cpp/module.h"
10 #include "ppapi/cpp/module_impl.h"
11 #include "ppapi/cpp/size.h"
13 namespace pp {
15 namespace {
17 template <> const char* interface_name<PPB_FlashFullscreen_0_1>() {
18 return PPB_FLASHFULLSCREEN_INTERFACE_0_1;
21 template <> const char* interface_name<PPB_FlashFullscreen_1_0>() {
22 return PPB_FLASHFULLSCREEN_INTERFACE_1_0;
25 } // namespace
27 FlashFullscreen::FlashFullscreen(const InstanceHandle& instance)
28 : instance_(instance) {
31 FlashFullscreen::~FlashFullscreen() {
34 bool FlashFullscreen::IsFullscreen() {
35 if (has_interface<PPB_FlashFullscreen_1_0>()) {
36 return PP_ToBool(get_interface<PPB_FlashFullscreen_1_0>()->IsFullscreen(
37 instance_.pp_instance()));
39 if (has_interface<PPB_FlashFullscreen_0_1>()) {
40 return PP_ToBool(get_interface<PPB_FlashFullscreen_0_1>()->IsFullscreen(
41 instance_.pp_instance()));
43 return false;
46 bool FlashFullscreen::SetFullscreen(bool fullscreen) {
47 if (has_interface<PPB_FlashFullscreen_1_0>()) {
48 return PP_ToBool(get_interface<PPB_FlashFullscreen_1_0>()->SetFullscreen(
49 instance_.pp_instance(), PP_FromBool(fullscreen)));
51 if (has_interface<PPB_FlashFullscreen_0_1>()) {
52 return PP_ToBool(get_interface<PPB_FlashFullscreen_0_1>()->SetFullscreen(
53 instance_.pp_instance(), PP_FromBool(fullscreen)));
55 return false;
58 bool FlashFullscreen::GetScreenSize(Size* size) {
59 if (has_interface<PPB_FlashFullscreen_1_0>()) {
60 return PP_ToBool(get_interface<PPB_FlashFullscreen_1_0>()->GetScreenSize(
61 instance_.pp_instance(), &size->pp_size()));
63 if (has_interface<PPB_FlashFullscreen_0_1>()) {
64 return PP_ToBool(get_interface<PPB_FlashFullscreen_0_1>()->GetScreenSize(
65 instance_.pp_instance(), &size->pp_size()));
67 return false;
70 bool FlashFullscreen::MustRecreateContexts() {
71 return !get_interface<PPB_FlashFullscreen_1_0>();
74 } // namespace pp