1// Copyright 2013 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_simple/ps.h"
6#include "ppapi_simple/ps_interface.h"
7
8#define DEFINE_INTERFACE_FUNC(Name)                         \
9  static const PPB_##Name* s_##Name;                        \
10  const PPB_##Name* PSInterface##Name() { return s_##Name; }
11
12DEFINE_INTERFACE_FUNC(Audio)
13DEFINE_INTERFACE_FUNC(AudioConfig)
14DEFINE_INTERFACE_FUNC(Console)
15DEFINE_INTERFACE_FUNC(Core)
16DEFINE_INTERFACE_FUNC(FileIO)
17DEFINE_INTERFACE_FUNC(FileRef)
18DEFINE_INTERFACE_FUNC(FileSystem)
19DEFINE_INTERFACE_FUNC(Fullscreen)
20DEFINE_INTERFACE_FUNC(Gamepad)
21DEFINE_INTERFACE_FUNC(Graphics2D)
22DEFINE_INTERFACE_FUNC(Graphics3D)
23DEFINE_INTERFACE_FUNC(ImageData)
24DEFINE_INTERFACE_FUNC(Instance)
25DEFINE_INTERFACE_FUNC(Messaging)
26DEFINE_INTERFACE_FUNC(MessageLoop)
27DEFINE_INTERFACE_FUNC(MouseCursor)
28DEFINE_INTERFACE_FUNC(URLLoader)
29DEFINE_INTERFACE_FUNC(URLRequestInfo)
30DEFINE_INTERFACE_FUNC(URLResponseInfo)
31DEFINE_INTERFACE_FUNC(Var)
32DEFINE_INTERFACE_FUNC(VarArrayBuffer)
33DEFINE_INTERFACE_FUNC(View)
34DEFINE_INTERFACE_FUNC(WebSocket)
35
36
37#define REQUEST_INTERFACE(x, y)                        \
38  s_##x = static_cast<const PPB_##x*>(PSGetInterface(PPB_ ## y ##_INTERFACE));
39
40void PSInterfaceInit() {
41  REQUEST_INTERFACE(Audio, AUDIO)
42  REQUEST_INTERFACE(AudioConfig, AUDIO_CONFIG)
43  REQUEST_INTERFACE(Console, CONSOLE)
44  REQUEST_INTERFACE(Core, CORE)
45  REQUEST_INTERFACE(FileIO, FILEIO)
46  REQUEST_INTERFACE(FileRef, FILEREF)
47  REQUEST_INTERFACE(FileSystem, FILESYSTEM)
48  REQUEST_INTERFACE(Fullscreen, FULLSCREEN)
49  REQUEST_INTERFACE(Gamepad, GAMEPAD)
50  REQUEST_INTERFACE(Graphics2D, GRAPHICS_2D)
51  REQUEST_INTERFACE(Graphics3D, GRAPHICS_3D)
52  REQUEST_INTERFACE(ImageData, IMAGEDATA)
53  REQUEST_INTERFACE(Instance, INSTANCE)
54  REQUEST_INTERFACE(Messaging, MESSAGING)
55  REQUEST_INTERFACE(MessageLoop, MESSAGELOOP)
56  REQUEST_INTERFACE(MouseCursor, MOUSECURSOR)
57  REQUEST_INTERFACE(URLLoader, URLLOADER)
58  REQUEST_INTERFACE(URLRequestInfo, URLREQUESTINFO)
59  REQUEST_INTERFACE(URLResponseInfo, URLRESPONSEINFO)
60  REQUEST_INTERFACE(Var, VAR)
61  REQUEST_INTERFACE(VarArrayBuffer, VAR_ARRAY_BUFFER)
62  REQUEST_INTERFACE(View, VIEW)
63  REQUEST_INTERFACE(WebSocket, WEBSOCKET)
64}
65