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
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_PEPPER_PEPPER_FLASH_MENU_HOST_H_
6 #define CHROME_RENDERER_PEPPER_PEPPER_FLASH_MENU_HOST_H_
10 #include "base/compiler_specific.h"
11 #include "content/public/renderer/context_menu_client.h"
12 #include "ppapi/c/pp_point.h"
13 #include "ppapi/host/host_message_context.h"
14 #include "ppapi/host/resource_host.h"
17 class RendererPpapiHost
;
23 class SerializedFlashMenu
;
29 class PepperFlashMenuHost
: public ppapi::host::ResourceHost
,
30 public content::ContextMenuClient
{
32 PepperFlashMenuHost(content::RendererPpapiHost
* host
,
35 const ppapi::proxy::SerializedFlashMenu
& serial_menu
);
36 virtual ~PepperFlashMenuHost();
38 virtual int32_t OnResourceMessageReceived(
39 const IPC::Message
& msg
,
40 ppapi::host::HostMessageContext
* context
) OVERRIDE
;
43 int32_t OnHostMsgShow(ppapi::host::HostMessageContext
* context
,
44 const PP_Point
& location
);
46 // ContextMenuClient implementation.
47 virtual void OnMenuAction(int request_id
, unsigned action
) OVERRIDE
;
48 virtual void OnMenuClosed(int request_id
) OVERRIDE
;
50 void SendMenuReply(int32_t result
, int action
);
52 content::RendererPpapiHost
* renderer_ppapi_host_
;
54 bool showing_context_menu_
;
55 int context_menu_request_id_
;
57 std::vector
<content::MenuItem
> menu_data_
;
59 // We send |MenuItem|s, which have an |unsigned| "action" field instead of
60 // an |int32_t| ID. (CONTENT also limits the range of valid values for
61 // actions.) This maps actions to IDs.
62 std::vector
<int32_t> menu_id_map_
;
64 // Used to send a single context menu "completion" upon menu close.
65 bool has_saved_context_menu_action_
;
66 unsigned saved_context_menu_action_
;
68 DISALLOW_COPY_AND_ASSIGN(PepperFlashMenuHost
);
73 #endif // CHROME_RENDERER_PEPPER_PEPPER_FLASH_MENU_HOST_H_