Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: webkit/glue/webmenurunner_mac.mm

Issue 99088: Style fixes for previous review (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webmenurunner_mac.h ('k') | webkit/tools/test_shell/mac/test_webview_delegate.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webmenurunner_mac.mm
===================================================================
--- webkit/glue/webmenurunner_mac.mm (revision 14785)
+++ webkit/glue/webmenurunner_mac.mm (working copy)
@@ -6,13 +6,24 @@
#include "base/sys_string_conversions.h"
+@interface WebMenuRunner (PrivateAPI)
+
+// Worker function used during initialization.
+- (void)addItem:(const WebMenuItem&)item;
+
+// A callback for the menu controller object to call when an item is selected
+// from the menu. This is not called if the menu is dismissed without a
+// selection.
+- (void)menuItemSelected:(id)sender;
+
+@end // WebMenuRunner (PrivateAPI)
+
@implementation WebMenuRunner
- (id)initWithItems:(const std::vector<WebMenuItem>&)items {
if ((self = [super init])) {
- menu_ = [[NSMenu alloc] initWithTitle:@""];
+ menu_.reset([[NSMenu alloc] initWithTitle:@""]);
[menu_ setAutoenablesItems:NO];
- menuItemWasChosen_ = NO;
index_ = -1;
for (int i = 0; i < static_cast<int>(items.size()); ++i)
[self addItem:items[i]];
@@ -20,11 +31,6 @@
return self;
}
-- (void)dealloc {
- [menu_ release];
- [super dealloc];
-}
-
- (void)addItem:(const WebMenuItem&)item {
if (item.type == WebMenuItem::SEPARATOR) {
[menu_ addItem:[NSMenuItem separatorItem]];
@@ -32,11 +38,11 @@
}
NSString* title = base::SysUTF16ToNSString(item.label);
- NSMenuItem* menu_item = [menu_ addItemWithTitle:title
- action:@selector(menuItemSelected:)
- keyEquivalent:@""];
- [menu_item setEnabled:(item.enabled && item.type != WebMenuItem::GROUP)];
- [menu_item setTarget:self];
+ NSMenuItem* menuItem = [menu_ addItemWithTitle:title
+ action:@selector(menuItemSelected:)
+ keyEquivalent:@""];
+ [menuItem setEnabled:(item.enabled && item.type != WebMenuItem::GROUP)];
+ [menuItem setTarget:self];
}
// Reflects the result of the user's interaction with the popup menu. If NO, the
@@ -76,10 +82,12 @@
@end // WebMenuRunner
+namespace webkit_glue {
+
// Helper function for manufacturing input events to send to WebKit.
-NSEvent* CreateEventForMenuAction(BOOL item_chosen, int window_num,
- int item_height, int selected_index,
- NSRect menu_bounds, NSRect view_bounds) {
+NSEvent* EventWithMenuAction(BOOL item_chosen, int window_num,
+ int item_height, int selected_index,
+ NSRect menu_bounds, NSRect view_bounds) {
NSEvent* event = nil;
double event_time = (double)(AbsoluteToDuration(UpTime())) / 1000.0;
@@ -128,3 +136,5 @@
return event;
}
+
+} // namespace webkit_glue
« no previous file with comments | « webkit/glue/webmenurunner_mac.h ('k') | webkit/tools/test_shell/mac/test_webview_delegate.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698