chore: bump chromium to bd6aad6a4b37dad7aae42fec349e9 (master) (#18626)
* chore: bump chromium in DEPS to f200986dfaabd6aad6a4b37dad7aae42fec349e9 * chore: BridgedNativeWidgetImpl was renamed to NativeWidgetMacNSWindowHost Refs:1640804
* refactor: remove MainMenu.xib as Chromium has removed its dependency on xcode and therefore all xibs As we set default menus in JS land the default native menu is tiny, just has a Quit button Refs:1627242
* chore: update zip manifests
This commit is contained in:
parent
9e8bd433df
commit
164cc43440
11 changed files with 55 additions and 273 deletions
|
@ -483,7 +483,7 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
|||
|
||||
void AtomBrowserMainParts::PreMainMessageLoopStartCommon() {
|
||||
#if defined(OS_MACOSX)
|
||||
InitializeMainNib();
|
||||
InitializeEmptyApplicationMenu();
|
||||
#endif
|
||||
media::SetLocalizedStringProvider(MediaStringProvider);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class AtomBrowserMainParts : public content::BrowserMainParts {
|
|||
|
||||
#if defined(OS_MACOSX)
|
||||
void FreeAppDelegate();
|
||||
void InitializeMainNib();
|
||||
void InitializeEmptyApplicationMenu();
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
|
|
@ -6,13 +6,53 @@
|
|||
|
||||
#include "atom/browser/atom_paths.h"
|
||||
#include "atom/browser/mac/atom_application_delegate.h"
|
||||
#include "base/mac/bundle_locations.h"
|
||||
#include "base/mac/foundation_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "ui/base/l10n/l10n_util_mac.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace {
|
||||
|
||||
base::scoped_nsobject<NSMenuItem> CreateMenuItem(NSString* title,
|
||||
SEL action,
|
||||
NSString* key_equivalent) {
|
||||
return base::scoped_nsobject<NSMenuItem>([[NSMenuItem alloc]
|
||||
initWithTitle:title
|
||||
action:action
|
||||
keyEquivalent:key_equivalent]);
|
||||
}
|
||||
|
||||
// The App Menu refers to the dropdown titled "Electron".
|
||||
base::scoped_nsobject<NSMenu> BuildAppMenu() {
|
||||
// The title is not used, as the title will always be the name of the App.
|
||||
base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]);
|
||||
|
||||
NSString* app_name = [[[NSBundle mainBundle] infoDictionary]
|
||||
objectForKey:(id)kCFBundleNameKey];
|
||||
|
||||
base::scoped_nsobject<NSMenuItem> item =
|
||||
CreateMenuItem([NSString stringWithFormat:@"Quit %@", app_name],
|
||||
@selector(terminate:), @"q");
|
||||
[menu addItem:item];
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
base::scoped_nsobject<NSMenu> BuildEmptyMainMenu() {
|
||||
base::scoped_nsobject<NSMenu> main_menu([[NSMenu alloc] initWithTitle:@""]);
|
||||
|
||||
using Builder = base::scoped_nsobject<NSMenu> (*)();
|
||||
static const Builder kBuilderFuncs[] = {&BuildAppMenu};
|
||||
for (auto* builder : kBuilderFuncs) {
|
||||
NSMenuItem* item = [[[NSMenuItem alloc] initWithTitle:@""
|
||||
action:NULL
|
||||
keyEquivalent:@""] autorelease];
|
||||
item.submenu = builder();
|
||||
[main_menu addItem:item];
|
||||
}
|
||||
return main_menu;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
||||
// Set our own application delegate.
|
||||
AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
|
||||
|
@ -32,37 +72,9 @@ void AtomBrowserMainParts::FreeAppDelegate() {
|
|||
[NSApp setDelegate:nil];
|
||||
}
|
||||
|
||||
// Replicates NSApplicationMain, but doesn't start a run loop.
|
||||
void AtomBrowserMainParts::InitializeMainNib() {
|
||||
auto infoDictionary = base::mac::OuterBundle().infoDictionary;
|
||||
|
||||
auto principalClass =
|
||||
NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]);
|
||||
auto application = [principalClass sharedApplication];
|
||||
|
||||
NSString* mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
|
||||
|
||||
NSNib* mainNib;
|
||||
|
||||
@try {
|
||||
mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
|
||||
bundle:base::mac::FrameworkBundle()];
|
||||
// Handle failure of initWithNibNamed on SMB shares
|
||||
// TODO(codebytere): Remove when
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=932935 is fixed
|
||||
} @catch (NSException* exception) {
|
||||
NSString* nibPath =
|
||||
[NSString stringWithFormat:@"Resources/%@.nib", mainNibName];
|
||||
nibPath = [base::mac::FrameworkBundle().bundlePath
|
||||
stringByAppendingPathComponent:nibPath];
|
||||
|
||||
NSData* data = [NSData dataWithContentsOfFile:nibPath];
|
||||
mainNib = [[NSNib alloc] initWithNibData:data
|
||||
bundle:base::mac::FrameworkBundle()];
|
||||
}
|
||||
|
||||
[mainNib instantiateWithOwner:application topLevelObjects:nil];
|
||||
[mainNib release];
|
||||
void AtomBrowserMainParts::InitializeEmptyApplicationMenu() {
|
||||
base::scoped_nsobject<NSMenu> main_menu = BuildEmptyMainMenu();
|
||||
[[NSApplication sharedApplication] setMainMenu:main_menu];
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "base/mac/mac_util.h"
|
||||
#include "base/mac/scoped_cftyperef.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "components/remote_cocoa/app_shim/bridged_native_widget_impl.h"
|
||||
#include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
|
||||
#include "content/public/browser/browser_accessibility_state.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "skia/ext/skia_utils_mac.h"
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
<string>public.app-category.developer-tools</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.10.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>AtomApplication</string>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include "atom/browser/ui/cocoa/atom_preview_item.h"
|
||||
#include "atom/browser/ui/cocoa/atom_touch_bar.h"
|
||||
#include "base/mac/mac_util.h"
|
||||
#include "components/remote_cocoa/app_shim/bridged_native_widget_impl.h"
|
||||
#include "ui/views/cocoa/bridged_native_widget_host_impl.h"
|
||||
#include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
|
||||
#include "ui/views/cocoa/native_widget_mac_ns_window_host.h"
|
||||
#include "ui/views/widget/native_widget_mac.h"
|
||||
|
||||
using TitleBarStyle = atom::NativeWindowMac::TitleBarStyle;
|
||||
|
@ -26,7 +26,7 @@ using TitleBarStyle = atom::NativeWindowMac::TitleBarStyle;
|
|||
// on the fly.
|
||||
// TODO(zcbenz): Add interface in NativeWidgetMac to allow overriding creating
|
||||
// window delegate.
|
||||
auto* bridge_host = views::BridgedNativeWidgetHostImpl::GetFromNativeWindow(
|
||||
auto* bridge_host = views::NativeWidgetMacNSWindowHost::GetFromNativeWindow(
|
||||
shell->GetNativeWindow());
|
||||
auto* bridged_view = bridge_host->bridge_impl();
|
||||
if ((self = [super initWithBridgedNativeWidget:bridged_view])) {
|
||||
|
@ -247,7 +247,7 @@ using TitleBarStyle = atom::NativeWindowMac::TitleBarStyle;
|
|||
// Clears the delegate when window is going to be closed, since EL Capitan it
|
||||
// is possible that the methods of delegate would get called after the window
|
||||
// has been closed.
|
||||
auto* bridge_host = views::BridgedNativeWidgetHostImpl::GetFromNativeWindow(
|
||||
auto* bridge_host = views::NativeWidgetMacNSWindowHost::GetFromNativeWindow(
|
||||
shell_->GetNativeWindow());
|
||||
auto* bridged_view = bridge_host->bridge_impl();
|
||||
bridged_view->OnWindowWillClose();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue