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

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

Issue 10909138: Convert the async device ID getter to a chrome resource host (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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/browser_ppapi_host_impl.cc
diff --git a/content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc b/content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc
index 92e5b7621f21bfde7f04006b7f91f2e0ebac4d94..dedd51ee810c8f039746f6cede22295f7057ad54 100644
--- a/content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc
+++ b/content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc
@@ -4,6 +4,8 @@
#include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_view_host.h"
#include "ipc/ipc_message_macros.h"
namespace content {
@@ -11,9 +13,10 @@ namespace content {
BrowserPpapiHostImpl::BrowserPpapiHostImpl(
IPC::Sender* sender,
const ppapi::PpapiPermissions& permissions)
- : host_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
- ppapi_host_(sender, &host_factory_, permissions),
+ : ppapi_host_(sender, permissions),
plugin_process_handle_(base::kNullProcessHandle) {
+ ppapi_host_.AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>(
+ new ContentBrowserPepperHostFactory(this)));
}
BrowserPpapiHostImpl::~BrowserPpapiHostImpl() {
@@ -41,4 +44,44 @@ base::ProcessHandle BrowserPpapiHostImpl::GetPluginProcessHandle() const {
return plugin_process_handle_;
}
+bool BrowserPpapiHostImpl::IsValidInstance(PP_Instance instance) const {
+ return instance_to_view_.find(instance) != instance_to_view_.end();
+}
+
+bool BrowserPpapiHostImpl::GetRenderViewIDsForInstance(
+ PP_Instance instance,
+ int* render_process_id,
+ int* render_view_id) const {
+ InstanceToViewMap::const_iterator found = instance_to_view_.find(instance);
+ if (found == instance_to_view_.end()) {
+ *render_process_id = 0;
+ *render_view_id = 0;
+ return false;
+ }
+
+ *render_process_id = found->second.process_id;
+ *render_view_id = found->second.view_id;
+ return true;
+}
+
+void BrowserPpapiHostImpl::AddInstanceForView(PP_Instance instance,
+ int render_process_id,
+ int render_view_id) {
+ DCHECK(instance_to_view_.find(instance) == instance_to_view_.end());
+
+ RenderViewIDs ids;
+ ids.process_id = render_process_id;
+ ids.view_id = render_view_id;
+ instance_to_view_[instance] = ids;
+}
+
+void BrowserPpapiHostImpl::DeleteInstanceForView(PP_Instance instance) {
+ InstanceToViewMap::iterator found = instance_to_view_.find(instance);
+ if (found == instance_to_view_.end()) {
+ NOTREACHED();
+ return;
+ }
+ instance_to_view_.erase(found);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698