| 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_PROXY_PLUGIN_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_RESOURCE_H_ |
| 6 #define PPAPI_PROXY_PLUGIN_RESOURCE_H_ | 6 #define PPAPI_PROXY_PLUGIN_RESOURCE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class PluginDispatcher; | 27 class PluginDispatcher; |
| 28 | 28 |
| 29 class PPAPI_PROXY_EXPORT PluginResource : public Resource { | 29 class PPAPI_PROXY_EXPORT PluginResource : public Resource { |
| 30 public: | 30 public: |
| 31 enum Destination { | 31 enum Destination { |
| 32 RENDERER = 0, | 32 RENDERER = 0, |
| 33 BROWSER = 1 | 33 BROWSER = 1 |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 PluginResource(Connection connection, PP_Instance instance); | 36 PluginResource(Connection connection, PP_Instance instance); |
| 37 virtual ~PluginResource(); | 37 ~PluginResource() override; |
| 38 | 38 |
| 39 // Returns true if we've previously sent a create message to the browser | 39 // Returns true if we've previously sent a create message to the browser |
| 40 // or renderer. Generally resources will use these to tell if they should | 40 // or renderer. Generally resources will use these to tell if they should |
| 41 // lazily send create messages. | 41 // lazily send create messages. |
| 42 bool sent_create_to_browser() const { return sent_create_to_browser_; } | 42 bool sent_create_to_browser() const { return sent_create_to_browser_; } |
| 43 bool sent_create_to_renderer() const { return sent_create_to_renderer_; } | 43 bool sent_create_to_renderer() const { return sent_create_to_renderer_; } |
| 44 | 44 |
| 45 // This handles a reply to a resource call. It works by looking up the | 45 // This handles a reply to a resource call. It works by looking up the |
| 46 // callback that was registered when CallBrowser/CallRenderer was called | 46 // callback that was registered when CallBrowser/CallRenderer was called |
| 47 // and calling it with |params| and |msg|. | 47 // and calling it with |params| and |msg|. |
| 48 virtual void OnReplyReceived(const proxy::ResourceMessageReplyParams& params, | 48 void OnReplyReceived(const proxy::ResourceMessageReplyParams& params, |
| 49 const IPC::Message& msg) override; | 49 const IPC::Message& msg) override; |
| 50 | 50 |
| 51 // Resource overrides. | 51 // Resource overrides. |
| 52 // Note: Subclasses shouldn't override these methods directly. Instead, they | 52 // Note: Subclasses shouldn't override these methods directly. Instead, they |
| 53 // should implement LastPluginRefWasDeleted() or InstanceWasDeleted() to get | 53 // should implement LastPluginRefWasDeleted() or InstanceWasDeleted() to get |
| 54 // notified. | 54 // notified. |
| 55 virtual void NotifyLastPluginRefWasDeleted() override; | 55 void NotifyLastPluginRefWasDeleted() override; |
| 56 virtual void NotifyInstanceWasDeleted() override; | 56 void NotifyInstanceWasDeleted() override; |
| 57 | |
| 58 | 57 |
| 59 // Sends a create message to the browser or renderer for the current resource. | 58 // Sends a create message to the browser or renderer for the current resource. |
| 60 void SendCreate(Destination dest, const IPC::Message& msg); | 59 void SendCreate(Destination dest, const IPC::Message& msg); |
| 61 | 60 |
| 62 // When the host returnes a resource to the plugin, it will create a pending | 61 // When the host returnes a resource to the plugin, it will create a pending |
| 63 // ResourceHost and send an ID back to the plugin that identifies the pending | 62 // ResourceHost and send an ID back to the plugin that identifies the pending |
| 64 // object. The plugin uses this function to connect the plugin resource with | 63 // object. The plugin uses this function to connect the plugin resource with |
| 65 // the pending host resource. See also PpapiHostMsg_AttachToPendingHost. This | 64 // the pending host resource. See also PpapiHostMsg_AttachToPendingHost. This |
| 66 // is in lieu of sending a create message. | 65 // is in lieu of sending a create message. |
| 67 void AttachToPendingHost(Destination dest, int pending_host_id); | 66 void AttachToPendingHost(Destination dest, int pending_host_id); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 278 |
| 280 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d, e)) | 279 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d, e)) |
| 281 return result; | 280 return result; |
| 282 return PP_ERROR_FAILED; | 281 return PP_ERROR_FAILED; |
| 283 } | 282 } |
| 284 | 283 |
| 285 } // namespace proxy | 284 } // namespace proxy |
| 286 } // namespace ppapi | 285 } // namespace ppapi |
| 287 | 286 |
| 288 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_H_ | 287 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_H_ |
| OLD | NEW |