mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* chore: bump chromium to 112.0.5615.10 * 4240798: Get rid of ShowInvalidPrinterSettingsError() in PrintManagerHost. https://chromium-review.googlesource.com/c/chromium/src/+/4240798 * chore: fixup patch * 4173660: Remove unused argument in BeforeUnloadCompleted Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4173660 (cherry picked from commit6d3934f743) * refactor: base value type DICTIONARY replaced with DICT Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4198081 (cherry picked from commitb7acb5c9a4) * 4251237: [StorageKey Cleanup] (2) Rename CreateFirstParty constructors Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4251237 (cherry picked from commit31bdd549d0) * refactor: rename latency metrics Refs: https://chromium-review.googlesource.com/c/chromium/src/+/4048262 (cherry picked from commit1e1b97d387) * refactor: base::span explicit conversion checks Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4219636 (cherry picked from commit020e8c6aae) * chore: iwyu net/cert/cert_verify_result.h (cherry picked from commit24583f5583) * 4258446: Move network::mojom::ClearDataFilter to its own mojom file https://chromium-review.googlesource.com/c/chromium/src/+/4258446 (cherry picked from commit5ff47109cd) * refactor: refactoring geolocation manager Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4161603 (cherry picked from commit1eeaafb45c) * refactor: use modern base values in tracing Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4210912 (cherry picked from commit192c988c1e) * refactor: add sanitized context to clipboard write Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4178264 (cherry picked from commit3ef020b5e5) * 4256866: [Extensions] Replace GetHooksForAPI with a RegisterHooksDelegate Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4256866 (cherry picked from commitb9d905216a) * refactor: s/Rect/WindowFeatures Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4167001 (cherry picked from commit12d121265b) * 4226656: Add response url to SimpleURLLoader::OnRedirectCallback Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4226656 (cherry picked from commit9f66c47930) * Better approach for ShowInvalidPrinterSettingsError() removal * build: use xcode 14 (cherry picked from commit06bd2c0442) * build: update appveyor image 4072083: New toolchain for Windows 11 10.0.22621.755 SDK | https://chromium-review.googlesource.com/c/chromium/src/+/4072083 (cherry picked from commit437c49898f) * 4261434: Remove browser_watcher (1/3): Move ExitCodeWatcher to chrome/app https://chromium-review.googlesource.com/c/chromium/src/+/4261434 (cherry picked from commitedc90d9488) * 4128591: Enable large pdbs by default https://chromium-review.googlesource.com/c/chromium/src/+/4128591 (cherry picked from commite76f2c3f16) * move dbgcore/dbghelp to extensions_to_skip (cherry picked from commit8eeb555145) * 4273450: dpwas: Send announcement when live regions changed https://chromium-review.googlesource.com/c/chromium/src/+/4273450 * 4277708: win7dep: Remove ResolveCoreWinRTStringDelayload https://chromium-review.googlesource.com/c/chromium/src/+/4277708 * Roll clang+rust llvmorg-17-init-3170-g6e30dffe-1 : llvmorg-17-init-3874-g93a2fecc-1 / [skipping Rust] https://chromium-review.googlesource.com/c/chromium/src/+/4308214 * 4285717: Copy d3dcompiler_47.dll on ARM64 Windows builds https://chromium-review.googlesource.com/c/angle/angle/+/4285717 * Revert "Roll clang+rust llvmorg-17-init-3170-g6e30dffe-1 : llvmorg-17-init-3874-g93a2fecc-1 / [skipping Rust]" This reverts commit71080f4f2d. * Revert Roll clang+rust llvmorg-16-init-17653-g39da55e8-3 This clang roll breaks Linux arm 32-bit --------- Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
93 lines
3.1 KiB
Plaintext
93 lines
3.1 KiB
Plaintext
// Copyright (c) 2013 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/browser/electron_browser_main_parts.h"
|
|
|
|
#include <string>
|
|
|
|
#include "base/mac/bundle_locations.h"
|
|
#include "base/mac/foundation_util.h"
|
|
#include "base/path_service.h"
|
|
#include "services/device/public/cpp/geolocation/system_geolocation_source_mac.h"
|
|
#import "shell/browser/mac/electron_application.h"
|
|
#include "shell/browser/mac/electron_application_delegate.h"
|
|
#include "shell/common/electron_paths.h"
|
|
#include "ui/base/l10n/l10n_util_mac.h"
|
|
|
|
namespace electron {
|
|
|
|
void ElectronBrowserMainParts::PreCreateMainMessageLoop() {
|
|
// Set our own application delegate.
|
|
ElectronApplicationDelegate* delegate =
|
|
[[ElectronApplicationDelegate alloc] init];
|
|
[NSApp setDelegate:delegate];
|
|
|
|
PreCreateMainMessageLoopCommon();
|
|
|
|
// Prevent Cocoa from turning command-line arguments into
|
|
// |-application:openFiles:|, since we already handle them directly.
|
|
[[NSUserDefaults standardUserDefaults]
|
|
setObject:@"NO"
|
|
forKey:@"NSTreatUnknownArgumentsAsOpen"];
|
|
|
|
geolocation_manager_ =
|
|
device::SystemGeolocationSourceMac::CreateGeolocationManagerOnMac();
|
|
}
|
|
|
|
void ElectronBrowserMainParts::FreeAppDelegate() {
|
|
[[NSApp delegate] release];
|
|
[NSApp setDelegate:nil];
|
|
}
|
|
|
|
void ElectronBrowserMainParts::RegisterURLHandler() {
|
|
[[AtomApplication sharedApplication] registerURLHandler];
|
|
}
|
|
|
|
// Replicates NSApplicationMain, but doesn't start a run loop.
|
|
void ElectronBrowserMainParts::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];
|
|
}
|
|
|
|
std::string ElectronBrowserMainParts::GetCurrentSystemLocale() {
|
|
NSString* systemLocaleIdentifier =
|
|
[[NSLocale currentLocale] localeIdentifier];
|
|
|
|
// Mac OS X uses "_" instead of "-", so swap to get a real locale value.
|
|
std::string locale_value = [[systemLocaleIdentifier
|
|
stringByReplacingOccurrencesOfString:@"_"
|
|
withString:@"-"] UTF8String];
|
|
|
|
return locale_value;
|
|
}
|
|
|
|
} // namespace electron
|