1// Copyright 2014 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 COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ 6#define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ 7 8#include "base/memory/scoped_ptr.h" 9 10class RenderViewContextMenu; 11 12namespace content { 13class WebContents; 14struct ContextMenuParams; 15} 16 17// A ContextMenuDelegate can build and show renderer context menu. 18class ContextMenuDelegate { 19 public: 20 explicit ContextMenuDelegate(content::WebContents* web_contents); 21 virtual ~ContextMenuDelegate(); 22 23 static ContextMenuDelegate* FromWebContents( 24 content::WebContents* web_contents); 25 26 // Builds and returns a context menu for a context specified by |params|. 27 // The returned value can be used to display the context menu. 28 virtual scoped_ptr<RenderViewContextMenu> BuildMenu( 29 content::WebContents* web_contents, 30 const content::ContextMenuParams& params) = 0; 31 32 // Displays the context menu. 33 virtual void ShowMenu(scoped_ptr<RenderViewContextMenu> menu) = 0; 34 35 private: 36 DISALLOW_COPY_AND_ASSIGN(ContextMenuDelegate); 37}; 38 39#endif // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ 40