Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 "mojo/examples/pepper_container_app/interface_list.h" | |
| 6 | |
| 7 #include "base/memory/singleton.h" | |
| 8 #include "mojo/examples/pepper_container_app/thunk.h" | |
| 9 #include "ppapi/c/ppb_core.h" | |
| 10 #include "ppapi/c/ppb_graphics_3d.h" | |
| 11 #include "ppapi/c/ppb_instance.h" | |
| 12 #include "ppapi/c/ppb_opengles2.h" | |
| 13 #include "ppapi/c/ppb_view.h" | |
| 14 #include "ppapi/thunk/thunk.h" | |
| 15 | |
| 16 namespace mojo { | |
| 17 namespace examples { | |
| 18 | |
| 19 InterfaceList::InterfaceList() { | |
| 20 AddBrowserInterface(PPB_CORE_INTERFACE_1_0, GetPPB_Core_1_0_Thunk()); | |
| 21 AddBrowserInterface(PPB_GRAPHICS_3D_INTERFACE_1_0, | |
| 22 ppapi::thunk::GetPPB_Graphics3D_1_0_Thunk()); | |
| 23 AddBrowserInterface(PPB_OPENGLES2_INTERFACE_1_0, | |
| 24 GetPPB_OpenGLES2_Thunk()); | |
| 25 AddBrowserInterface(PPB_INSTANCE_INTERFACE_1_0, | |
| 26 ppapi::thunk::GetPPB_Instance_1_0_Thunk()); | |
| 27 AddBrowserInterface(PPB_VIEW_INTERFACE_1_0, | |
| 28 ppapi::thunk::GetPPB_View_1_0_Thunk()); | |
| 29 AddBrowserInterface(PPB_VIEW_INTERFACE_1_1, | |
| 30 ppapi::thunk::GetPPB_View_1_1_Thunk()); | |
| 31 } | |
| 32 | |
| 33 InterfaceList::~InterfaceList() {} | |
| 34 | |
| 35 // static | |
| 36 InterfaceList* InterfaceList::GetInstance() { | |
| 37 return Singleton<InterfaceList>::get(); | |
| 38 } | |
| 39 | |
| 40 const void* InterfaceList::GetBrowserInterface(const std::string& name) const { | |
| 41 NameToInterfaceMap::const_iterator iter = browser_interfaces_.find(name); | |
| 42 | |
| 43 if (iter == browser_interfaces_.end()) | |
| 44 return NULL; | |
| 45 | |
| 46 return iter->second; | |
| 47 } | |
| 48 | |
| 49 void InterfaceList::AddBrowserInterface(const char* name, | |
|
viettrungluu
2014/03/21 04:20:00
I don't know that having this helper adds anything
yzshen1
2014/03/21 17:52:08
Removed. :)
| |
| 50 const void* interface) { | |
| 51 browser_interfaces_[name] = interface; | |
| 52 } | |
| 53 | |
| 54 } // namespace examples | |
| 55 } // namespace mojo | |
| OLD | NEW |