Skip to content
Permalink
Browse files

chore: bump chromium to bd6aad6a4b37dad7aae42fec349e9 (master) (#18626)

* chore: bump chromium in DEPS to f200986dfaabd6aad6a4b37dad7aae42fec349e9

* chore: BridgedNativeWidgetImpl was renamed to NativeWidgetMacNSWindowHost

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/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: https://chromium-review.googlesource.com/c/chromium/src/+/1627242

* chore: update zip manifests
  • Loading branch information...
electron-bot authored and MarshallOfSound committed Jun 5, 2019
1 parent 9e8bd43 commit 164cc4344095d8ec574ea67707805315a89d6c1c
@@ -612,12 +612,6 @@ if (is_mac) {
electron_login_helper_name = "$electron_product_name Login Helper"
electron_framework_version = "A"

mac_xib_bundle_data("electron_xibs") {
sources = [
"atom/common/resources/mac/MainMenu.xib",
]
}

bundle_data("electron_framework_resources") {
public_deps = [
":packed_resources",
@@ -686,7 +680,6 @@ if (is_mac) {
deps = [
":electron_framework_libraries",
":electron_framework_resources",
":electron_xibs",
]
if (!is_mas_build) {
deps += [ ":electron_crashpad_helper" ]
2 DEPS
@@ -10,7 +10,7 @@ gclient_gn_args = [

vars = {
'chromium_version':
'9b6b84670d32a7aff41ce73adc0eeee67d364989',
'f200986dfaabd6aad6a4b37dad7aae42fec349e9',
'node_version':
'b823596192bb790f9ea2a61022b55bf50e6daa83',
'nan_version':
@@ -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 @@
[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 @@ - (id)initWithShell:(atom::NativeWindowMac*)shell {
// 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 @@ - (void)windowWillClose:(NSNotification*)notification {
// 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();

0 comments on commit 164cc43

Please sign in to comment.
You can’t perform that action at this time.