Upload upstream chromium 114.0.5735.31
[platform/framework/web/chromium-efl.git] / components / renderer_context_menu / context_menu_content_type.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_CONTENT_TYPE_H_
6 #define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_
7
8 #include "base/memory/raw_ptr.h"
9 #include "content/public/browser/context_menu_params.h"
10 #include "ui/base/models/simple_menu_model.h"
11
12 // ContextMenuContentType is a helper to decide which category/group of items
13 // are relevant for a given WebContents and a context.
14 //
15 // Subclasses can override the behavior of showing/hiding a category.
16 class ContextMenuContentType {
17  public:
18   ContextMenuContentType(const ContextMenuContentType&) = delete;
19   ContextMenuContentType& operator=(const ContextMenuContentType&) = delete;
20
21   virtual ~ContextMenuContentType();
22
23   // Represents a group of menu items.
24   // Order matters as they are appended in the enum order.
25   enum ItemGroup {
26     ITEM_GROUP_CUSTOM,
27     ITEM_GROUP_PAGE,
28     ITEM_GROUP_FRAME,
29     ITEM_GROUP_LINK,
30     ITEM_GROUP_SMART_SELECTION,
31     ITEM_GROUP_MEDIA_IMAGE,
32     ITEM_GROUP_SEARCHWEBFORIMAGE,
33     ITEM_GROUP_MEDIA_VIDEO,
34     ITEM_GROUP_MEDIA_AUDIO,
35     ITEM_GROUP_MEDIA_CANVAS,
36     ITEM_GROUP_MEDIA_PLUGIN,
37     ITEM_GROUP_MEDIA_FILE,
38     ITEM_GROUP_EDITABLE,
39     ITEM_GROUP_COPY,
40     ITEM_GROUP_PARTIAL_TRANSLATE,
41     ITEM_GROUP_SEARCH_PROVIDER,
42     ITEM_GROUP_PRINT,
43     ITEM_GROUP_ALL_EXTENSION,
44     ITEM_GROUP_CURRENT_EXTENSION,
45     ITEM_GROUP_DEVELOPER,
46     ITEM_GROUP_DEVTOOLS_UNPACKED_EXT,
47     ITEM_GROUP_PRINT_PREVIEW,
48     ITEM_GROUP_PASSWORD,
49     ITEM_GROUP_EXISTING_LINK_TO_TEXT,
50     ITEM_GROUP_AUTOFILL
51   };
52
53   // Returns if |group| is enabled.
54   virtual bool SupportsGroup(int group);
55
56   ContextMenuContentType(const content::ContextMenuParams& params,
57                          bool supports_custom_items);
58
59  protected:
60   const content::ContextMenuParams& params() const { return params_; }
61
62  private:
63   bool SupportsGroupInternal(int group);
64
65   const content::ContextMenuParams params_;
66   const bool supports_custom_items_;
67 };
68
69 #endif  // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_