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

Unified Diff: content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc

Issue 10824272: Add a skeleton gamepad resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 4 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: content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc
diff --git a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc
index fbe5e6d20f59d310b636f4e1455263cfd6f1a8cc..d5e7e98a92e6939e51d73c55e9167e953b2d2e73 100644
--- a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc
+++ b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc
@@ -4,6 +4,8 @@
#include "content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h"
+#include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
+#include "content/browser/renderer_host/pepper/pepper_gamepad_host.h"
#include "ppapi/host/resource_host.h"
#include "ppapi/proxy/ppapi_messages.h"
@@ -24,7 +26,21 @@ scoped_ptr<ResourceHost> ContentBrowserPepperHostFactory::CreateResourceHost(
const ppapi::proxy::ResourceMessageCallParams& params,
PP_Instance instance,
const IPC::Message& message) {
- // TODO(brettw) implement hosts here.
+ DCHECK(host == host_->GetPpapiHost());
+
+ // Make sure the plugin is giving us a valid instance for this resource.
+ /* TODO(brettw) make this work. The browser should be aware of all valid
+ instances.
+ if (!host_->IsValidInstance(instance))
+ return scoped_ptr<ResourceHost>();
+ */
+
+ // Public interfaces with no permissions required.
+ switch (message.type()) {
+ case PpapiHostMsg_Gamepad_Create::ID:
+ return scoped_ptr<ResourceHost>(new PepperGamepadHost(
+ host_, instance, params.pp_resource()));
+ }
return scoped_ptr<ResourceHost>();
}

Powered by Google App Engine
This is Rietveld 408576698