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.
5 #ifndef COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_
6 #define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_
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"
12 // ContextMenuContentType is a helper to decide which category/group of items
13 // are relevant for a given WebContents and a context.
15 // Subclasses can override the behavior of showing/hiding a category.
16 class ContextMenuContentType {
18 ContextMenuContentType(const ContextMenuContentType&) = delete;
19 ContextMenuContentType& operator=(const ContextMenuContentType&) = delete;
21 virtual ~ContextMenuContentType();
23 // Represents a group of menu items.
24 // Order matters as they are appended in the enum order.
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,
40 ITEM_GROUP_PARTIAL_TRANSLATE,
41 ITEM_GROUP_SEARCH_PROVIDER,
43 ITEM_GROUP_ALL_EXTENSION,
44 ITEM_GROUP_CURRENT_EXTENSION,
46 ITEM_GROUP_DEVTOOLS_UNPACKED_EXT,
47 ITEM_GROUP_PRINT_PREVIEW,
49 ITEM_GROUP_EXISTING_LINK_TO_TEXT,
53 // Returns if |group| is enabled.
54 virtual bool SupportsGroup(int group);
56 ContextMenuContentType(const content::ContextMenuParams& params,
57 bool supports_custom_items);
60 const content::ContextMenuParams& params() const { return params_; }
63 bool SupportsGroupInternal(int group);
65 const content::ContextMenuParams params_;
66 const bool supports_custom_items_;
69 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_