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 #ifndef PPAPI_CPP_MODULE_IMPL_H_
6 #define PPAPI_CPP_MODULE_IMPL_H_
9 /// This file defines some simple function templates that help the C++ wrappers
10 /// (and are not for external developers to use).
12 #include "ppapi/cpp/module.h"
18 // Specialize this function to return the interface string corresponding to the
20 template <typename T
> const char* interface_name() {
24 template <typename T
> inline T
const* get_interface() {
25 static T
const* funcs
= reinterpret_cast<T
const*>(
26 pp::Module::Get()->GetBrowserInterface(interface_name
<T
>()));
30 template <typename T
> inline bool has_interface() {
31 return get_interface
<T
>() != NULL
;
38 #endif // PPAPI_CPP_MODULE_IMPL_H_