Update CrOS OOBE throbber to MD throbber; delete old asset
[chromium-blink-merge.git] / chrome / renderer / pepper / pepper_flash_menu_host.h
blob3aa730a6afc39c75fdf502452eaf4245686f81ac
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_
8 #include <vector>
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"
16 namespace content {
17 class RendererPpapiHost;
18 struct MenuItem;
21 namespace ppapi {
22 namespace proxy {
23 class SerializedFlashMenu;
27 class PepperFlashMenuHost : public ppapi::host::ResourceHost,
28 public content::ContextMenuClient {
29 public:
30 PepperFlashMenuHost(content::RendererPpapiHost* host,
31 PP_Instance instance,
32 PP_Resource resource,
33 const ppapi::proxy::SerializedFlashMenu& serial_menu);
34 ~PepperFlashMenuHost() override;
36 int32_t OnResourceMessageReceived(
37 const IPC::Message& msg,
38 ppapi::host::HostMessageContext* context) override;
40 private:
41 int32_t OnHostMsgShow(ppapi::host::HostMessageContext* context,
42 const PP_Point& location);
44 // ContextMenuClient implementation.
45 void OnMenuAction(int request_id, unsigned action) override;
46 void OnMenuClosed(int request_id) override;
48 void SendMenuReply(int32_t result, int action);
50 content::RendererPpapiHost* renderer_ppapi_host_;
52 bool showing_context_menu_;
53 int context_menu_request_id_;
55 std::vector<content::MenuItem> menu_data_;
57 // We send |MenuItem|s, which have an |unsigned| "action" field instead of
58 // an |int32_t| ID. (CONTENT also limits the range of valid values for
59 // actions.) This maps actions to IDs.
60 std::vector<int32_t> menu_id_map_;
62 // Used to send a single context menu "completion" upon menu close.
63 bool has_saved_context_menu_action_;
64 unsigned saved_context_menu_action_;
66 DISALLOW_COPY_AND_ASSIGN(PepperFlashMenuHost);
69 #endif // CHROME_RENDERER_PEPPER_PEPPER_FLASH_MENU_HOST_H_