Skip to content

Commit 4b85a39

Browse files
committed
support 'no-edit-menu' option in manifest
1 parent fa42176 commit 4b85a39

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/browser/app_controller_mac.mm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "content/nw/src/shell_browser_context.h"
2828
#include "content/nw/src/shell_browser_main_parts.h"
2929
#include "content/nw/src/shell_content_browser_client.h"
30+
#include "base/values.h"
3031

3132
@implementation AppController
3233

@@ -59,13 +60,17 @@ - (void) applicationDidFinishLaunching: (NSNotification *) note {
5960
browser_client->shell_browser_main_parts()->Init();
6061

6162
// And init menu.
63+
bool no_edit_menu = false;
64+
browser_client->shell_browser_main_parts()->package()->root()->GetBoolean("no-edit-menu", &no_edit_menu);
65+
6266
[NSApp setMainMenu:[[[NSMenu alloc] init] autorelease]];
6367
[[NSApp mainMenu] addItem:[[[NSMenuItem alloc]
6468
initWithTitle:@"" action:nil keyEquivalent:@""] autorelease]];
6569
nw::StandardMenusMac standard_menus(
6670
browser_client->shell_browser_main_parts()->package()->GetName());
6771
standard_menus.BuildAppleMenu();
68-
standard_menus.BuildEditMenu();
72+
if (!no_edit_menu)
73+
standard_menus.BuildEditMenu();
6974
standard_menus.BuildWindowMenu();
7075
}
7176

src/browser/native_window_mac.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,14 @@ - (NSRect)contentRectForFrameRect:(NSRect)frameRect {
629629
}
630630

631631
void NativeWindowCocoa::SetMenu(api::Menu* menu) {
632+
bool no_edit_menu = false;
633+
shell_->GetPackage()->root()->GetBoolean("no-edit-menu", &no_edit_menu);
634+
632635
StandardMenusMac standard_menus(shell_->GetPackage()->GetName());
633636
[NSApp setMainMenu:menu->menu_];
634637
standard_menus.BuildAppleMenu();
635-
standard_menus.BuildEditMenu();
638+
if (!no_edit_menu)
639+
standard_menus.BuildEditMenu();
636640
standard_menus.BuildWindowMenu();
637641
}
638642

0 commit comments

Comments
 (0)