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

Unified Diff: ppapi/proxy/host_dispatcher.cc

Issue 6519057: Implement proxying for FileRef and FileChooser.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix ppapi tests to account for query change Created 9 years, 10 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
« no previous file with comments | « ppapi/proxy/host_dispatcher.h ('k') | ppapi/proxy/interface_id.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/host_dispatcher.cc
===================================================================
--- ppapi/proxy/host_dispatcher.cc (revision 75293)
+++ ppapi/proxy/host_dispatcher.cc (working copy)
@@ -94,17 +94,7 @@
if (!info ||
(info->is_trusted && disallow_trusted_interfaces()))
return true;
-
- const void* local_interface = GetLocalInterface(info->name);
- if (!local_interface) {
- // This should always succeed since the browser should support the stuff
- // the proxy does. If this happens, something is out of sync.
- NOTREACHED();
- return true;
- }
-
- proxy = info->create_proxy(this, local_interface);
- target_proxies_[info->id].reset(proxy);
+ proxy = CreatePPBInterfaceProxy(info);
}
return proxy->OnMessageReceived(msg);
@@ -142,6 +132,26 @@
return NULL;
}
+InterfaceProxy* HostDispatcher::GetOrCreatePPBInterfaceProxy(
+ InterfaceID id) {
+ InterfaceProxy* proxy = target_proxies_[id].get();
+ if (!proxy) {
+ const InterfaceProxy::Info* info = GetPPBInterfaceInfo(id);
+ if (!info)
+ return NULL;
+
+ // Sanity check. This function won't normally be called for trusted
+ // interfaces, but in case somebody does this, we don't want to then give
+ // the plugin the ability to call that trusted interface (since the
+ // checking occurs at proxy-creation time).
+ if (info->is_trusted && disallow_trusted_interfaces())
+ return NULL;
+
+ proxy = CreatePPBInterfaceProxy(info);
+ }
+ return proxy;
+}
+
const PPB_Proxy_Private* HostDispatcher::GetPPBProxy() {
if (!ppb_proxy_) {
ppb_proxy_ = reinterpret_cast<const PPB_Proxy_Private*>(
@@ -150,6 +160,21 @@
return ppb_proxy_;
}
+InterfaceProxy* HostDispatcher::CreatePPBInterfaceProxy(
+ const InterfaceProxy::Info* info) {
+ const void* local_interface = GetLocalInterface(info->name);
+ if (!local_interface) {
+ // This should always succeed since the browser should support the stuff
+ // the proxy does. If this happens, something is out of sync.
+ NOTREACHED();
+ return NULL;
+ }
+
+ InterfaceProxy* proxy = info->create_proxy(this, local_interface);
+ target_proxies_[info->id].reset(proxy);
+ return proxy;
+}
+
} // namespace proxy
} // namespace pp
« no previous file with comments | « ppapi/proxy/host_dispatcher.h ('k') | ppapi/proxy/interface_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698