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.
4
5#ifndef CONTENT_PUBLIC_RENDERER_CONTEXT_MENU_CLIENT_H_
6#define CONTENT_PUBLIC_RENDERER_CONTEXT_MENU_CLIENT_H_
7
8#include "base/basictypes.h"
9#include "content/common/content_export.h"
10
11namespace content {
12
13// This mirrors the WebKit API in that the "action selected" and "menu closed"
14// events are separate. When the user selects and item you'll get both events.
15// If the user clicks somewhere else and cancels the menu, you'll just get the
16// "closed" event.
17class CONTENT_EXPORT ContextMenuClient {
18 public:
19  // Called when the user selects a context menu item. The request ID will be
20  // the value returned by RenderView.ShowCustomContextMenu. This will be
21  // followed by a call to OnCustomContextMenuClosed.
22  virtual void OnMenuAction(int request_id, unsigned action) = 0;
23
24  // Called when the context menu is closed. The request ID will be the value
25  // returned by RenderView.ShowCustomContextMenu.
26  virtual void OnMenuClosed(int request_id) = 0;
27
28 protected:
29  virtual ~ContextMenuClient() {}
30};
31
32}  // namespace content
33
34#endif  // CONTENT_PUBLIC_RENDERER_CONTEXT_MENU_CLIENT_H_
35