From 6570e56784b0970646c5c4c704e155015400a032 Mon Sep 17 00:00:00 2001 From: "polina@google.com" Date: Fri, 14 Oct 2011 21:59:17 +0000 Subject: PPAPI Fullscreen: move out of Dev. BUG=41780 TEST=in CL Review URL: http://codereview.chromium.org/8291002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105590 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/cpp/fullscreen.cc | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ ppapi/cpp/fullscreen.h | 29 ++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 ppapi/cpp/fullscreen.cc create mode 100644 ppapi/cpp/fullscreen.h (limited to 'ppapi/cpp') diff --git a/ppapi/cpp/fullscreen.cc b/ppapi/cpp/fullscreen.cc new file mode 100644 index 0000000..1c751cc6 --- /dev/null +++ b/ppapi/cpp/fullscreen.cc @@ -0,0 +1,50 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/cpp/fullscreen.h" + +#include "ppapi/c/ppb_fullscreen.h" +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/size.h" + +namespace pp { + +namespace { + +template <> const char* interface_name() { + return PPB_FULLSCREEN_INTERFACE; +} + +} // namespace + +Fullscreen::Fullscreen(Instance* instance) + : instance_(instance) { +} + +Fullscreen::~Fullscreen() { +} + +bool Fullscreen::IsFullscreen() { + return has_interface() && + get_interface()->IsFullscreen( + instance_->pp_instance()); +} + +bool Fullscreen::SetFullscreen(bool fullscreen) { + if (!has_interface()) + return false; + return PP_ToBool(get_interface()->SetFullscreen( + instance_->pp_instance(), PP_FromBool(fullscreen))); +} + +bool Fullscreen::GetScreenSize(Size* size) { + if (!has_interface()) + return false; + return PP_ToBool(get_interface()->GetScreenSize( + instance_->pp_instance(), &size->pp_size())); +} + +} // namespace pp diff --git a/ppapi/cpp/fullscreen.h b/ppapi/cpp/fullscreen.h new file mode 100644 index 0000000..cb6a4f3 --- /dev/null +++ b/ppapi/cpp/fullscreen.h @@ -0,0 +1,29 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_CPP_FULLSCREEN_H_ +#define PPAPI_CPP_FULLSCREEN_H_ + +namespace pp { + +class Instance; +class Size; + +class Fullscreen { + public: + Fullscreen(Instance* instance); + virtual ~Fullscreen(); + + // PPB_Fullscreen methods. + bool IsFullscreen(); + bool SetFullscreen(bool fullscreen); + bool GetScreenSize(Size* size); + + private: + Instance* instance_; +}; + +} // namespace pp + +#endif // PPAPI_CPP_FULLSCREEN_H_ -- cgit v1.1