diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-30 05:26:52 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-30 05:26:52 +0000 |
commit | 4dec5802baac225df48fb9153d2af7621d5850e6 (patch) | |
tree | cc52ebc1c7171654b9bdbc6b394fa2c8df1ff059 /ppapi/host/resource_host.h | |
parent | 250c074059ca38cbc7474d3332ba3edcf8e86e65 (diff) | |
download | chromium_src-4dec5802baac225df48fb9153d2af7621d5850e6.zip chromium_src-4dec5802baac225df48fb9153d2af7621d5850e6.tar.gz chromium_src-4dec5802baac225df48fb9153d2af7621d5850e6.tar.bz2 |
Create a PPAPI host for new resource message routing.
This infrastructure will be used in the renderer and in the browser as the backing for new resources.
The PpapiHost object doues the routing for the resource messages, and also has hooks for the embedder (the renderer or the browser) to create resources. This adds a content_renderer factory which currently does nothing (we'll add most of the resources here).
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/10572040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/host/resource_host.h')
-rw-r--r-- | ppapi/host/resource_host.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/ppapi/host/resource_host.h b/ppapi/host/resource_host.h new file mode 100644 index 0000000..c1e4b74 --- /dev/null +++ b/ppapi/host/resource_host.h @@ -0,0 +1,66 @@ +// Copyright (c) 2012 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. + +#ifndef PPAPI_HOST_RESOURCE_HOST_H_ +#define PPAPI_HOST_RESOURCE_HOST_H_ + +#include "base/basictypes.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/host/ppapi_host_export.h" +#include "ppapi/shared_impl/host_resource.h" + +namespace IPC { +class Message; +} + +namespace ppapi { +namespace host { + +struct HostMessageContext; +class PpapiHost; + +// Some (but not all) resources have a corresponding object in the host side +// that is kept alive as long as the resource in the plugin is alive. This is +// the base class for such objects. +class PPAPI_HOST_EXPORT ResourceHost { + public: + ResourceHost(PpapiHost* host, PP_Instance instance, PP_Resource resource); + virtual ~ResourceHost(); + + PpapiHost* host() { return host_; } + PP_Instance pp_instance() const { return pp_instance_; } + PP_Resource pp_resource() const { return pp_resource_; } + + // Handles messages associated with a given resource object. If the flags + // indicate that a response is required, the return value of this function + // will be sent as a resource message "response" along with the message + // specified in the reply of the context. + // + // You can do a response asynchronously by returning PP_OK_COMPLETIONPENDING. + // This will cause the reply to be skipped, and the class implementing this + // function will take responsibility for issuing the callback later. + // + // If you don't have a particular reply message, you can just ignore + // the reply in the message context. However, if you have a reply more than + // just the int32_t result code, set the reply to be the message of your + // choosing. + // + // The default implementation just returns PP_ERROR_NOTSUPPORTED. + virtual int32_t OnResourceMessageReceived(const IPC::Message& msg, + HostMessageContext* context); + + private: + // The host that owns this object. + PpapiHost* host_; + + PP_Instance pp_instance_; + PP_Resource pp_resource_; + + DISALLOW_COPY_AND_ASSIGN(ResourceHost); +}; + +} // namespace host +} // namespace ppapi + +#endif // PPAPI_HOST_RESOURCE_HOST_H_ |