OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_RENDERER_PEPPER_PEPPER_EXTENSIONS_COMMON_HOST_H_ |
| 6 #define CHROME_RENDERER_PEPPER_PEPPER_EXTENSIONS_COMMON_HOST_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/linked_ptr.h" |
| 14 #include "ppapi/host/resource_host.h" |
| 15 |
| 16 namespace base { |
| 17 class ListValue; |
| 18 } |
| 19 |
| 20 namespace content { |
| 21 class RendererPpapiHost; |
| 22 } |
| 23 |
| 24 namespace ppapi { |
| 25 namespace host { |
| 26 struct ReplyMessageContext; |
| 27 } |
| 28 } |
| 29 |
| 30 namespace chrome { |
| 31 |
| 32 class PepperExtensionsCommonHost : public ppapi::host::ResourceHost { |
| 33 public: |
| 34 virtual ~PepperExtensionsCommonHost(); |
| 35 |
| 36 static PepperExtensionsCommonHost* Create(content::RendererPpapiHost* host, |
| 37 PP_Instance instance, |
| 38 PP_Resource resource); |
| 39 |
| 40 // ppapi::host::ResourceMessageHandler overrides. |
| 41 virtual int32_t OnResourceMessageReceived( |
| 42 const IPC::Message& msg, |
| 43 ppapi::host::HostMessageContext* context) OVERRIDE; |
| 44 |
| 45 private: |
| 46 typedef std::map<int, linked_ptr<ppapi::host::ReplyMessageContext> > |
| 47 PendingRequestMap; |
| 48 |
| 49 PepperExtensionsCommonHost(content::RendererPpapiHost* host, |
| 50 PP_Instance instance, |
| 51 PP_Resource resource); |
| 52 |
| 53 int32_t OnPost(ppapi::host::HostMessageContext* context, |
| 54 const std::string& request_name, |
| 55 const base::ListValue& args); |
| 56 |
| 57 int32_t OnCall(ppapi::host::HostMessageContext* context, |
| 58 const std::string& request_name, |
| 59 const base::ListValue& args); |
| 60 |
| 61 // Non-owning pointer. |
| 62 content::RendererPpapiHost* renderer_ppapi_host_; |
| 63 |
| 64 PendingRequestMap pending_request_map_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(PepperExtensionsCommonHost); |
| 67 }; |
| 68 |
| 69 } // namespace chrome |
| 70 |
| 71 #endif // CHROME_RENDERER_PEPPER_PEPPER_EXTENSIONS_COMMON_HOST_H_ |
OLD | NEW |