Browse Source

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
Electron Bot 5 years ago
parent
commit
164cc43440

+ 0 - 7
BUILD.gn

@@ -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" ]

+ 1 - 1
DEPS

@@ -10,7 +10,7 @@ gclient_gn_args = [
 
 vars = {
   'chromium_version':
-    '9b6b84670d32a7aff41ce73adc0eeee67d364989',
+    'f200986dfaabd6aad6a4b37dad7aae42fec349e9',
   'node_version':
     'b823596192bb790f9ea2a61022b55bf50e6daa83',
   'nan_version':

+ 1 - 1
atom/browser/atom_browser_main_parts.cc

@@ -483,7 +483,7 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
 
 void AtomBrowserMainParts::PreMainMessageLoopStartCommon() {
 #if defined(OS_MACOSX)
-  InitializeMainNib();
+  InitializeEmptyApplicationMenu();
 #endif
   media::SetLocalizedStringProvider(MediaStringProvider);
 }

+ 1 - 1
atom/browser/atom_browser_main_parts.h

@@ -97,7 +97,7 @@ class AtomBrowserMainParts : public content::BrowserMainParts {
 
 #if defined(OS_MACOSX)
   void FreeAppDelegate();
-  void InitializeMainNib();
+  void InitializeEmptyApplicationMenu();
 #endif
 
 #if defined(OS_MACOSX)

+ 47 - 35
atom/browser/atom_browser_main_parts_mac.mm

@@ -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

+ 1 - 1
atom/browser/native_window_mac.mm

@@ -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"

+ 0 - 2
atom/browser/resources/mac/Info.plist

@@ -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>

+ 4 - 4
atom/browser/ui/cocoa/atom_ns_window_delegate.mm

@@ -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();

+ 0 - 219
atom/common/resources/mac/MainMenu.xib

@@ -1,219 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
-	<data>
-		<int key="IBDocument.SystemTarget">101000</int>
-		<string key="IBDocument.SystemVersion">14D136</string>
-		<string key="IBDocument.InterfaceBuilderVersion">7531</string>
-		<string key="IBDocument.AppKitVersion">1347.57</string>
-		<string key="IBDocument.HIToolboxVersion">758.70</string>
-		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-			<string key="NS.object.0">7531</string>
-		</object>
-		<array key="IBDocument.IntegratedClassDependencies">
-			<string>NSCustomObject</string>
-			<string>NSMenu</string>
-			<string>NSMenuItem</string>
-		</array>
-		<array key="IBDocument.PluginDependencies">
-			<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-		</array>
-		<object class="NSMutableDictionary" key="IBDocument.Metadata">
-			<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
-			<integer value="1" key="NS.object.0"/>
-		</object>
-		<array class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
-			<object class="NSCustomObject" id="1021">
-				<string key="NSClassName">AtomApplication</string>
-			</object>
-			<object class="NSCustomObject" id="1014">
-				<string key="NSClassName">FirstResponder</string>
-			</object>
-			<object class="NSCustomObject" id="1050">
-				<string key="NSClassName">NSApplication</string>
-			</object>
-			<object class="NSCustomObject" id="903638069">
-				<string key="NSClassName">NSFontManager</string>
-			</object>
-			<object class="NSMenu" id="649796088">
-				<string key="NSTitle">Main Menu</string>
-				<array class="NSMutableArray" key="NSMenuItems">
-					<object class="NSMenuItem" id="694149608">
-						<reference key="NSMenu" ref="649796088"/>
-						<string key="NSTitle">Electron</string>
-						<string key="NSKeyEquiv"/>
-						<int key="NSMnemonicLoc">2147483647</int>
-						<object class="NSCustomResource" key="NSOnImage" id="229763992">
-							<string key="NSClassName">NSImage</string>
-							<string key="NSResourceName">NSMenuCheckmark</string>
-						</object>
-						<object class="NSCustomResource" key="NSMixedImage" id="909111550">
-							<string key="NSClassName">NSImage</string>
-							<string key="NSResourceName">NSMenuMixedState</string>
-						</object>
-						<string key="NSAction">submenuAction:</string>
-						<reference key="NSTarget" ref="110575045"/>
-						<object class="NSMenu" key="NSSubmenu" id="110575045">
-							<string key="NSTitle">Electron</string>
-							<array class="NSMutableArray" key="NSMenuItems">
-								<object class="NSMenuItem" id="632727374">
-									<reference key="NSMenu" ref="110575045"/>
-									<string key="NSTitle">Quit</string>
-									<string key="NSKeyEquiv">q</string>
-									<int key="NSKeyEquivModMask">1048576</int>
-									<int key="NSMnemonicLoc">2147483647</int>
-									<reference key="NSOnImage" ref="229763992"/>
-									<reference key="NSMixedImage" ref="909111550"/>
-								</object>
-								<object class="NSMenuItem" id="1025936716">
-									<reference key="NSMenu" ref="110575045"/>
-									<string key="NSTitle">Open Recent</string>
-									<string key="NSKeyEquiv"/>
-									<int key="NSKeyEquivModMask">1048576</int>
-									<int key="NSMnemonicLoc">2147483647</int>
-									<bool key="NSIsHidden">YES</bool>
-									<reference key="NSOnImage" ref="229763992"/>
-									<reference key="NSMixedImage" ref="909111550"/>
-									<string key="NSAction">submenuAction:</string>
-									<object class="NSMenu" key="NSSubmenu" id="1065607017">
-										<string key="NSTitle">Open Recent</string>
-										<array class="NSMutableArray" key="NSMenuItems"></array>
-										<string key="NSName">_NSRecentDocumentsMenu</string>
-									</object>
-								</object>
-							</array>
-							<string key="NSName">_NSAppleMenu</string>
-						</object>
-					</object>
-				</array>
-				<string key="NSName">_NSMainMenu</string>
-			</object>
-		</array>
-		<object class="IBObjectContainer" key="IBDocument.Objects">
-			<array key="connectionRecords">
-				<object class="IBConnectionRecord">
-					<object class="IBActionConnection" key="connection">
-						<string key="label">terminate:</string>
-						<reference key="source" ref="1014"/>
-						<reference key="destination" ref="632727374"/>
-					</object>
-					<int key="connectionID">807</int>
-				</object>
-			</array>
-			<object class="IBMutableOrderedSet" key="objectRecords">
-				<array key="orderedObjects">
-					<object class="IBObjectRecord">
-						<int key="objectID">0</int>
-						<array key="object" id="0"/>
-						<reference key="children" ref="1048"/>
-						<nil key="parent"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-2</int>
-						<reference key="object" ref="1021"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">File's Owner</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-1</int>
-						<reference key="object" ref="1014"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">First Responder</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-3</int>
-						<reference key="object" ref="1050"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">Application</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">371</int>
-						<reference key="object" ref="903638069"/>
-						<reference key="parent" ref="0"/>
-					</object>
-					<!-- NSMenu Main Menu -->
-					<object class="IBObjectRecord">
-						<int key="objectID">29</int>
-						<reference key="object" ref="649796088"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="694149608"/>
-						</array>
-						<reference key="parent" ref="0"/>
-					</object>
-					<!-- NSMenuItem Electron -->
-					<object class="IBObjectRecord">
-						<int key="objectID">56</int>
-						<reference key="object" ref="694149608"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="110575045"/>
-						</array>
-						<reference key="parent" ref="649796088"/>
-					</object>
-					<!-- NSMenu Electron -->
-					<object class="IBObjectRecord">
-						<int key="objectID">57</int>
-						<reference key="object" ref="110575045"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="632727374"/>
-							<reference ref="1025936716"/>
-						</array>
-						<reference key="parent" ref="694149608"/>
-					</object>
-					<!-- NSMenuItem Quit -->
-					<object class="IBObjectRecord">
-						<int key="objectID">136</int>
-						<reference key="object" ref="632727374"/>
-						<reference key="parent" ref="110575045"/>
-					</object>
-					<!-- NSMenuItem Open Recent -->
-					<object class="IBObjectRecord">
-						<int key="objectID">124</int>
-						<reference key="object" ref="1025936716"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="1065607017"/>
-						</array>
-						<reference key="parent" ref="110575045"/>
-					</object>
-					<!-- NSMenu Open Recent -->
-					<object class="IBObjectRecord">
-						<int key="objectID">125</int>
-						<reference key="object" ref="1065607017"/>
-						<array class="NSMutableArray" key="children"></array>
-						<reference key="parent" ref="1025936716"/>
-					</object>
-				</array>
-			</object>
-			<dictionary class="NSMutableDictionary" key="flattenedProperties">
-				<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="29.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="56.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="57.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="136.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="124.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="125.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-			</dictionary>
-			<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
-			<nil key="activeLocalization"/>
-			<dictionary class="NSMutableDictionary" key="localizations"/>
-			<nil key="sourceID"/>
-			<int key="maxID">807</int>
-		</object>
-		<int key="IBDocument.localizationMode">0</int>
-		<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
-		<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">NO</bool>
-		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
-			<integer value="4600" key="NS.object.0"/>
-		</object>
-		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
-		<int key="IBDocument.defaultPropertyAccessControl">3</int>
-		<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
-			<string key="NSMenuCheckmark">{12, 12}</string>
-			<string key="NSMenuMixedState">{10, 2}</string>
-		</dictionary>
-		<bool key="IBDocument.UseAutolayout">YES</bool>
-	</data>
-</archive>

+ 0 - 1
script/dist_zip.mac.x64.manifest

@@ -12,7 +12,6 @@ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Librari
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/Info.plist
-Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/locale.pak
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ar.lproj/

+ 0 - 1
script/dist_zip.mac_mas.x64.manifest

@@ -12,7 +12,6 @@ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Librari
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/Info.plist
-Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/locale.pak
 Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ar.lproj/