Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(838)

Unified Diff: mojo/examples/pepper_container_app/interface_list.cc

Issue 178953003: Mojo container example for hosting Pepper plugins (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/examples/pepper_container_app/interface_list.cc
diff --git a/mojo/examples/pepper_container_app/interface_list.cc b/mojo/examples/pepper_container_app/interface_list.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5361c6c9f9164a54282e5f45a0a55d1e34602306
--- /dev/null
+++ b/mojo/examples/pepper_container_app/interface_list.cc
@@ -0,0 +1,55 @@
+// Copyright 2014 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 "mojo/examples/pepper_container_app/interface_list.h"
+
+#include "base/memory/singleton.h"
+#include "mojo/examples/pepper_container_app/thunk.h"
+#include "ppapi/c/ppb_core.h"
+#include "ppapi/c/ppb_graphics_3d.h"
+#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_opengles2.h"
+#include "ppapi/c/ppb_view.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace mojo {
+namespace examples {
+
+InterfaceList::InterfaceList() {
+ AddBrowserInterface(PPB_CORE_INTERFACE_1_0, GetPPB_Core_1_0_Thunk());
+ AddBrowserInterface(PPB_GRAPHICS_3D_INTERFACE_1_0,
+ ppapi::thunk::GetPPB_Graphics3D_1_0_Thunk());
+ AddBrowserInterface(PPB_OPENGLES2_INTERFACE_1_0,
+ GetPPB_OpenGLES2_Thunk());
+ AddBrowserInterface(PPB_INSTANCE_INTERFACE_1_0,
+ ppapi::thunk::GetPPB_Instance_1_0_Thunk());
+ AddBrowserInterface(PPB_VIEW_INTERFACE_1_0,
+ ppapi::thunk::GetPPB_View_1_0_Thunk());
+ AddBrowserInterface(PPB_VIEW_INTERFACE_1_1,
+ ppapi::thunk::GetPPB_View_1_1_Thunk());
+}
+
+InterfaceList::~InterfaceList() {}
+
+// static
+InterfaceList* InterfaceList::GetInstance() {
+ return Singleton<InterfaceList>::get();
+}
+
+const void* InterfaceList::GetBrowserInterface(const std::string& name) const {
+ NameToInterfaceMap::const_iterator iter = browser_interfaces_.find(name);
+
+ if (iter == browser_interfaces_.end())
+ return NULL;
+
+ return iter->second;
+}
+
+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. :)
+ const void* interface) {
+ browser_interfaces_[name] = interface;
+}
+
+} // namespace examples
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698