| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef PPAPI_HOST_RESOURCE_HOST_H_ | 5 #ifndef PPAPI_HOST_RESOURCE_HOST_H_ | 
| 6 #define PPAPI_HOST_RESOURCE_HOST_H_ | 6 #define PPAPI_HOST_RESOURCE_HOST_H_ | 
| 7 | 7 | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 24 struct HostMessageContext; | 24 struct HostMessageContext; | 
| 25 class PpapiHost; | 25 class PpapiHost; | 
| 26 class ResourceMessageFilter; | 26 class ResourceMessageFilter; | 
| 27 | 27 | 
| 28 // Some (but not all) resources have a corresponding object in the host side | 28 // Some (but not all) resources have a corresponding object in the host side | 
| 29 // that is kept alive as long as the resource in the plugin is alive. This is | 29 // that is kept alive as long as the resource in the plugin is alive. This is | 
| 30 // the base class for such objects. | 30 // the base class for such objects. | 
| 31 class PPAPI_HOST_EXPORT ResourceHost : public ResourceMessageHandler { | 31 class PPAPI_HOST_EXPORT ResourceHost : public ResourceMessageHandler { | 
| 32  public: | 32  public: | 
| 33   ResourceHost(PpapiHost* host, PP_Instance instance, PP_Resource resource); | 33   ResourceHost(PpapiHost* host, PP_Instance instance, PP_Resource resource); | 
| 34   virtual ~ResourceHost(); | 34   ~ResourceHost() override; | 
| 35 | 35 | 
| 36   PpapiHost* host() { return host_; } | 36   PpapiHost* host() { return host_; } | 
| 37   PP_Instance pp_instance() const { return pp_instance_; } | 37   PP_Instance pp_instance() const { return pp_instance_; } | 
| 38   PP_Resource pp_resource() const { return pp_resource_; } | 38   PP_Resource pp_resource() const { return pp_resource_; } | 
| 39 | 39 | 
| 40   // This runs any message filters in |message_filters_|. If the message is not | 40   // This runs any message filters in |message_filters_|. If the message is not | 
| 41   // handled by these filters then the host's own message handler is run. True | 41   // handled by these filters then the host's own message handler is run. True | 
| 42   // is always returned (the message will always be handled in some way). | 42   // is always returned (the message will always be handled in some way). | 
| 43   virtual bool HandleMessage(const IPC::Message& msg, | 43   bool HandleMessage(const IPC::Message& msg, | 
| 44                              HostMessageContext* context) override; | 44                      HostMessageContext* context) override; | 
| 45 | 45 | 
| 46   // Sets the PP_Resource ID when the plugin attaches to a pending resource | 46   // Sets the PP_Resource ID when the plugin attaches to a pending resource | 
| 47   // host. This will notify subclasses by calling | 47   // host. This will notify subclasses by calling | 
| 48   // DidConnectPendingHostToResource. | 48   // DidConnectPendingHostToResource. | 
| 49   // | 49   // | 
| 50   // The current PP_Resource for all pending hosts should be 0. See | 50   // The current PP_Resource for all pending hosts should be 0. See | 
| 51   // PpapiHostMsg_AttachToPendingHost. | 51   // PpapiHostMsg_AttachToPendingHost. | 
| 52   void SetPPResourceForPendingHost(PP_Resource pp_resource); | 52   void SetPPResourceForPendingHost(PP_Resource pp_resource); | 
| 53 | 53 | 
| 54   virtual void SendReply(const ReplyMessageContext& context, | 54   void SendReply(const ReplyMessageContext& context, | 
| 55                          const IPC::Message& msg) override; | 55                  const IPC::Message& msg) override; | 
| 56 | 56 | 
| 57   // Simple RTTI. A subclass that is a host for one of these APIs will override | 57   // Simple RTTI. A subclass that is a host for one of these APIs will override | 
| 58   // the appropriate function and return true. | 58   // the appropriate function and return true. | 
| 59   virtual bool IsCompositorHost(); | 59   virtual bool IsCompositorHost(); | 
| 60   virtual bool IsFileRefHost(); | 60   virtual bool IsFileRefHost(); | 
| 61   virtual bool IsFileSystemHost(); | 61   virtual bool IsFileSystemHost(); | 
| 62   virtual bool IsGraphics2DHost(); | 62   virtual bool IsGraphics2DHost(); | 
| 63   virtual bool IsMediaStreamVideoTrackHost(); | 63   virtual bool IsMediaStreamVideoTrackHost(); | 
| 64 | 64 | 
| 65  protected: | 65  protected: | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 87   // messages to. | 87   // messages to. | 
| 88   std::vector<scoped_refptr<ResourceMessageFilter> > message_filters_; | 88   std::vector<scoped_refptr<ResourceMessageFilter> > message_filters_; | 
| 89 | 89 | 
| 90   DISALLOW_COPY_AND_ASSIGN(ResourceHost); | 90   DISALLOW_COPY_AND_ASSIGN(ResourceHost); | 
| 91 }; | 91 }; | 
| 92 | 92 | 
| 93 }  // namespace host | 93 }  // namespace host | 
| 94 }  // namespace ppapi | 94 }  // namespace ppapi | 
| 95 | 95 | 
| 96 #endif  // PPAPI_HOST_RESOURCE_HOST_H_ | 96 #endif  // PPAPI_HOST_RESOURCE_HOST_H_ | 
| OLD | NEW | 
|---|