- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / renderer / pepper / pepper_shared_memory_message_filter.h
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_SHARED_MEMORY_MESSAGE_FILTER_H_
6 #define CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/platform_file.h"
11 #include "ppapi/c/pp_instance.h"
12 #include "ppapi/host/instance_message_filter.h"
13
14 namespace content {
15 class RendererPpapiHost;
16 }
17
18 namespace ppapi {
19 namespace proxy {
20 class SerializedHandle;
21 }
22 }
23
24 // Implements the backend for shared memory messages from a plugin process.
25 class PepperSharedMemoryMessageFilter
26     : public ppapi::host::InstanceMessageFilter {
27  public:
28   explicit PepperSharedMemoryMessageFilter(content::RendererPpapiHost* host);
29   virtual ~PepperSharedMemoryMessageFilter();
30
31   // InstanceMessageFilter:
32   virtual bool OnInstanceMessageReceived(const IPC::Message& msg) OVERRIDE;
33
34   bool Send(IPC::Message* msg);
35
36  private:
37   // Message handlers.
38   void OnHostMsgCreateSharedMemory(
39       PP_Instance instance,
40       uint32_t size,
41       int* host_shm_handle_id,
42       ppapi::proxy::SerializedHandle* plugin_shm_handle);
43
44   content::RendererPpapiHost* host_;
45
46   DISALLOW_COPY_AND_ASSIGN(PepperSharedMemoryMessageFilter);
47 };
48
49 #endif  // CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_