cef/libcef/browser/chrome/chrome_context_menu_handler.h
Marshall Greenblatt fe24ce3c71 chrome: Add cleanup when context menu isn't running (fixes #3711)
The menu may not be running in the following cases:

- If the menu is empty (e.g. cleared in OnBeforeContextMenu).
- If the menu is disabled (see e.g. RenderViewContextMenuViews::Show).
- When the run call blocks until the menu is dismissed (macOS behavior).

We explicitly clean up in these cases instead of waiting for OnMenuClosed
which will otherwise never be called for the first 2 cases.

Menu run status is exposed via new ContextMenuDelegate and
RenderViewContextMenuBase methods.
2024-06-13 13:38:41 -04:00

29 lines
848 B
C++

// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTEXT_MENU_HANDLER_H_
#define CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTEXT_MENU_HANDLER_H_
#pragma once
#include "content/public/browser/context_menu_params.h"
namespace content {
class WebContents;
}
namespace context_menu {
// Register RenderViewContextMenu callbacks.
void RegisterCallbacks();
// Returns true if the menu was handled.
bool HandleContextMenu(content::WebContents* opener,
const content::ContextMenuParams& params);
void MaybeResetContextMenu(content::WebContents* opener);
} // namespace context_menu
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTEXT_MENU_HANDLER_H_