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 #include "ppapi/cpp/fullscreen.h" 6 7 #include "ppapi/c/ppb_fullscreen.h" 8 #include "ppapi/cpp/instance_handle.h" 9 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module_impl.h" 11 #include "ppapi/cpp/size.h" 12 13 namespace pp { 14 15 namespace { 16 interface_name()17template <> const char* interface_name<PPB_Fullscreen_1_0>() { 18 return PPB_FULLSCREEN_INTERFACE_1_0; 19 } 20 21 } // namespace 22 Fullscreen(const InstanceHandle & instance)23Fullscreen::Fullscreen(const InstanceHandle& instance) 24 : instance_(instance) { 25 } 26 ~Fullscreen()27Fullscreen::~Fullscreen() { 28 } 29 IsFullscreen()30bool Fullscreen::IsFullscreen() { 31 return has_interface<PPB_Fullscreen_1_0>() && 32 get_interface<PPB_Fullscreen_1_0>()->IsFullscreen( 33 instance_.pp_instance()); 34 } 35 SetFullscreen(bool fullscreen)36bool Fullscreen::SetFullscreen(bool fullscreen) { 37 if (!has_interface<PPB_Fullscreen_1_0>()) 38 return false; 39 return PP_ToBool(get_interface<PPB_Fullscreen_1_0>()->SetFullscreen( 40 instance_.pp_instance(), PP_FromBool(fullscreen))); 41 } 42 GetScreenSize(Size * size)43bool Fullscreen::GetScreenSize(Size* size) { 44 if (!has_interface<PPB_Fullscreen_1_0>()) 45 return false; 46 return PP_ToBool(get_interface<PPB_Fullscreen_1_0>()->GetScreenSize( 47 instance_.pp_instance(), &size->pp_size())); 48 } 49 50 } // namespace pp 51