diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 19:27:53 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 19:27:53 +0000 |
commit | 75977a3dddcf0c0cba857d3d25431a6626697634 (patch) | |
tree | d844323c11d11cedb04b9ea8484f0e0878d3fee6 /content/browser/renderer_host/webmenurunner_mac.h | |
parent | 80047dca19a1dc20200d71307ef9e1f695e3c12b (diff) | |
download | chromium_src-75977a3dddcf0c0cba857d3d25431a6626697634.zip chromium_src-75977a3dddcf0c0cba857d3d25431a6626697634.tar.gz chromium_src-75977a3dddcf0c0cba857d3d25431a6626697634.tar.bz2 |
move webkit/glue/webmenurunner_mac* to content/browser/renderer_host
(pipelined on https://codereview.chromium.org/17142003/)
TBR=jamesr@chromium.org
R=thakis@chromium.org,jamesr@chromium.org
BUG=239107
Review URL: https://chromiumcodereview.appspot.com/17285005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207058 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/webmenurunner_mac.h')
-rw-r--r-- | content/browser/renderer_host/webmenurunner_mac.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/content/browser/renderer_host/webmenurunner_mac.h b/content/browser/renderer_host/webmenurunner_mac.h new file mode 100644 index 0000000..cdd7d61 --- /dev/null +++ b/content/browser/renderer_host/webmenurunner_mac.h @@ -0,0 +1,61 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_RENDERER_HOST_WEBMENURUNNER_MAC_H_ +#define CONTENT_BROWSER_RENDERER_HOST_WEBMENURUNNER_MAC_H_ + +#import <Cocoa/Cocoa.h> + +#include <vector> + +#include "base/memory/scoped_nsobject.h" +#include "webkit/common/webmenuitem.h" + + +// WebMenuRunner --------------------------------------------------------------- +// A class for determining whether an item was selected from an HTML select +// control, or if the menu was dismissed without making a selection. If a menu +// item is selected, MenuDelegate is informed and sets a flag which can be +// queried after the menu has finished running. + +@interface WebMenuRunner : NSObject { + @private + // The native menu control. + scoped_nsobject<NSMenu> menu_; + + // A flag set to YES if a menu item was chosen, or NO if the menu was + // dismissed without selecting an item. + BOOL menuItemWasChosen_; + + // The index of the selected menu item. + int index_; + + // The font size being used for the menu. + CGFloat fontSize_; + + // Whether the menu should be displayed right-aligned. + BOOL rightAligned_; +} + +// Initializes the MenuDelegate with a list of items sent from WebKit. +- (id)initWithItems:(const std::vector<WebMenuItem>&)items + fontSize:(CGFloat)fontSize + rightAligned:(BOOL)rightAligned; + +// Returns YES if an item was selected from the menu, NO if the menu was +// dismissed. +- (BOOL)menuItemWasChosen; + +// Displays and runs a native popup menu. +- (void)runMenuInView:(NSView*)view + withBounds:(NSRect)bounds + initialIndex:(int)index; + +// Returns the index of selected menu item, or its initial value (-1) if no item +// was selected. +- (int)indexOfSelectedItem; + +@end // @interface WebMenuRunner + +#endif // CONTENT_BROWSER_RENDERER_HOST_WEBMENURUNNER_MAC_H_ |