1a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Copyright 2014 The Chromium Authors. All rights reserved. 2a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Use of this source code is governed by a BSD-style license that can be 3a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// found in the LICENSE file. 4a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 55f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#ifndef COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ 65f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ 7a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 8a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "base/memory/scoped_ptr.h" 9a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 10a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass RenderViewContextMenu; 11a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 12a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochnamespace content { 13a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass WebContents; 14a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochstruct ContextMenuParams; 15a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch} 16a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 17a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// A ContextMenuDelegate can build and show renderer context menu. 18a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass ContextMenuDelegate { 19a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch public: 20a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch explicit ContextMenuDelegate(content::WebContents* web_contents); 21a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch virtual ~ContextMenuDelegate(); 22a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 23a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch static ContextMenuDelegate* FromWebContents( 24a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch content::WebContents* web_contents); 25a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 26a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch // Builds and returns a context menu for a context specified by |params|. 27a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch // The returned value can be used to display the context menu. 28a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch virtual scoped_ptr<RenderViewContextMenu> BuildMenu( 29a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch content::WebContents* web_contents, 30a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch const content::ContextMenuParams& params) = 0; 31a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 32a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch // Displays the context menu. 33a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch virtual void ShowMenu(scoped_ptr<RenderViewContextMenu> menu) = 0; 34a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 35a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch private: 36a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch DISALLOW_COPY_AND_ASSIGN(ContextMenuDelegate); 37a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}; 38a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 395f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#endif // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ 40