Upload upstream chromium 114.0.5735.31
[platform/framework/web/chromium-efl.git] / components / renderer_context_menu / context_menu_delegate.h
1 // Copyright 2014 The Chromium Authors
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 COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_
6 #define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_
7
8 #include <memory>
9
10 class RenderViewContextMenuBase;
11
12 namespace content {
13 class RenderFrameHost;
14 class WebContents;
15 struct ContextMenuParams;
16 }
17
18 // A ContextMenuDelegate can build and show renderer context menu.
19 class ContextMenuDelegate {
20  public:
21   explicit ContextMenuDelegate(content::WebContents* web_contents);
22
23   ContextMenuDelegate(const ContextMenuDelegate&) = delete;
24   ContextMenuDelegate& operator=(const ContextMenuDelegate&) = delete;
25
26   virtual ~ContextMenuDelegate();
27
28   static ContextMenuDelegate* FromWebContents(
29       content::WebContents* web_contents);
30
31   // Builds and returns a context menu for a context specified by |params|.
32   //
33   // The |render_frame_host| represents the frame where the context menu has
34   // been opened (typically this frame is focused, but this is not necessarily
35   // the case - see https://crbug.com/1257907#c14).
36   //
37   // The returned value can be used to display the context menu.
38   virtual std::unique_ptr<RenderViewContextMenuBase> BuildMenu(
39       content::RenderFrameHost& render_frame_host,
40       const content::ContextMenuParams& params) = 0;
41
42   // Displays the context menu.
43   virtual void ShowMenu(std::unique_ptr<RenderViewContextMenuBase> menu) = 0;
44 };
45
46 #endif  // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_