BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / renderer_context_menu / render_view_context_menu_test_util.h
blob52cb9049a634f35d06d14599e0b0cd41bbf5dc43
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.
5 #ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_TEST_UTIL_H_
6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_TEST_UTIL_H_
8 #include "base/basictypes.h"
9 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
10 #include "url/gurl.h"
12 #if defined(ENABLE_EXTENSIONS)
13 #include "chrome/browser/extensions/context_menu_matcher.h"
14 #endif
16 class Browser;
18 namespace content {
19 class WebContents;
21 namespace ui {
22 class MenuModel;
25 class TestRenderViewContextMenu : public RenderViewContextMenu {
26 public:
27 TestRenderViewContextMenu(content::RenderFrameHost* render_frame_host,
28 content::ContextMenuParams params);
29 ~TestRenderViewContextMenu() override;
31 // Factory.
32 // This is a lightweight method to create a test RenderViewContextMenu
33 // instance.
34 // Use the constructor if you want to create menu with fine-grained params.
35 static TestRenderViewContextMenu* Create(content::WebContents* web_contents,
36 const GURL& page_url,
37 const GURL& link_url,
38 const GURL& frame_url);
40 // Implementation of pure virtuals in RenderViewContextMenu.
41 bool GetAcceleratorForCommandId(int command_id,
42 ui::Accelerator* accelerator) override;
44 // Returns true if command specified by |command_id| is present
45 // in the menu.
46 // List of command ids can be found in chrome/app/chrome_command_ids.h.
47 bool IsItemPresent(int command_id);
49 // Searches for an menu item with |command_id|. If it's found, the return
50 // value is true and the model and index where it appears in that model are
51 // returned in |found_model| and |found_index|. Otherwise returns false.
52 bool GetMenuModelAndItemIndex(int command_id,
53 ui::MenuModel** found_model,
54 int* found_index);
56 #if defined(ENABLE_EXTENSIONS)
57 extensions::ContextMenuMatcher& extension_items() { return extension_items_; }
58 #endif
60 void Show() override;
62 private:
63 DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu);
66 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_TEST_UTIL_H_