Simplify ChildProcessLauncher
[chromium-blink-merge.git] / content / browser / renderer_host / webmenurunner_mac.h
blob30424d7a6b8d49a1120b309314c871accf595735
1 // Copyright 2013 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 CONTENT_BROWSER_RENDERER_HOST_WEBMENURUNNER_MAC_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_WEBMENURUNNER_MAC_H_
8 #import <Cocoa/Cocoa.h>
10 #include <vector>
12 #include "base/mac/scoped_nsobject.h"
13 #include "content/public/common/menu_item.h"
16 // WebMenuRunner ---------------------------------------------------------------
17 // A class for determining whether an item was selected from an HTML select
18 // control, or if the menu was dismissed without making a selection. If a menu
19 // item is selected, MenuDelegate is informed and sets a flag which can be
20 // queried after the menu has finished running.
22 @interface WebMenuRunner : NSObject {
23 @private
24 // The native menu control.
25 base::scoped_nsobject<NSMenu> menu_;
27 // A flag set to YES if a menu item was chosen, or NO if the menu was
28 // dismissed without selecting an item.
29 BOOL menuItemWasChosen_;
31 // The index of the selected menu item.
32 int index_;
34 // The font size being used for the menu.
35 CGFloat fontSize_;
37 // Whether the menu should be displayed right-aligned.
38 BOOL rightAligned_;
41 // Initializes the MenuDelegate with a list of items sent from WebKit.
42 - (id)initWithItems:(const std::vector<content::MenuItem>&)items
43 fontSize:(CGFloat)fontSize
44 rightAligned:(BOOL)rightAligned;
46 // Returns YES if an item was selected from the menu, NO if the menu was
47 // dismissed.
48 - (BOOL)menuItemWasChosen;
50 // Displays and runs a native popup menu.
51 - (void)runMenuInView:(NSView*)view
52 withBounds:(NSRect)bounds
53 initialIndex:(int)index;
55 // Hides a popup menu if it's visible.
56 - (void)hide;
58 // Returns the index of selected menu item, or its initial value (-1) if no item
59 // was selected.
60 - (int)indexOfSelectedItem;
62 @end // @interface WebMenuRunner
64 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBMENURUNNER_MAC_H_