![electron-roller[bot]](/assets/img/avatar_default.png)
* chore: bump chromium in DEPS to 138.0.7166.0 * chore: bump chromium in DEPS to 138.0.7166.2 * 6508373: Add WebContents, Tab getters for future Clank navigation capture rework6508373
* 6470924: Introduce auto-populated Search Engine icons.6470924
* 6502977: Force same tab navigation while actor coordinator is acting on a tab6502977
* chore: bump chromium in DEPS to 138.0.7168.0 * chore: update patches * fix grit patch * chore: bump Chromium to 138.0.7169.2 * fixup! 6508373: Add WebContents, Tab getters for future Clank navigation capture rework * 6493688: NavigationThrottleRunner2: void CreateThrottlesForNavigation6493688
* 6488755: Reland "WebSQL: Remove WebPreference"6488755
* 6428707: FSA: Only normalize the hardcoded rules once during initialization6428707
* chore: fixup patch indices * chore: bump chromium in DEPS to 138.0.7170.0 * 6514121: Remove origin calculation debug info and related methods6514121
* chore: bump chromium in DEPS to 138.0.7172.0 * chore: bump chromium in DEPS to 138.0.7173.0 * chore: bump chromium in DEPS to 138.0.7175.0 * fixup! 6514121: Remove origin calculation debug info and related methods Refs6514121
* 6531585: Don't retry LayerTreeSink creation on the high priority queue Refs6531585
* 6512253: Modernize base::apple's base bundle ID Refs6512253
* fixup! 6428707: FSA: Only normalize the hardcoded rules once during initialization Refs6428707
* fixup! 6508373: Add WebContents, Tab getters for future Clank navigation capture rework Refs6508373
* chore: update patches --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
88 lines
2.9 KiB
Text
88 lines
2.9 KiB
Text
// Copyright (c) 2014 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/app/electron_main_delegate.h"
|
|
|
|
#include <string>
|
|
|
|
#include "base/apple/bundle_locations.h"
|
|
#include "base/apple/foundation_util.h"
|
|
#include "base/files/file_path.h"
|
|
#include "base/files/file_util.h"
|
|
#include "base/path_service.h"
|
|
#include "base/strings/sys_string_conversions.h"
|
|
#include "content/browser/mac_helpers.h"
|
|
#include "content/public/common/content_paths.h"
|
|
#include "shell/browser/mac/electron_application.h"
|
|
#include "shell/common/application_info.h"
|
|
#include "shell/common/mac/main_application_bundle.h"
|
|
|
|
namespace electron {
|
|
|
|
namespace {
|
|
|
|
base::FilePath GetFrameworksPath() {
|
|
return MainApplicationBundlePath().Append("Contents").Append("Frameworks");
|
|
}
|
|
|
|
base::FilePath GetHelperAppPath(const base::FilePath& frameworks_path,
|
|
const std::string& name) {
|
|
// Figure out what helper we are running
|
|
base::FilePath path;
|
|
base::PathService::Get(base::FILE_EXE, &path);
|
|
|
|
std::string helper_name = "Helper";
|
|
if (const auto& val = path.value();
|
|
val.ends_with(content::kMacHelperSuffix_renderer)) {
|
|
helper_name += content::kMacHelperSuffix_renderer;
|
|
} else if (val.ends_with(content::kMacHelperSuffix_gpu)) {
|
|
helper_name += content::kMacHelperSuffix_gpu;
|
|
} else if (val.ends_with(content::kMacHelperSuffix_plugin)) {
|
|
helper_name += content::kMacHelperSuffix_plugin;
|
|
}
|
|
|
|
return frameworks_path.Append(name + " " + helper_name + ".app")
|
|
.Append("Contents")
|
|
.Append("MacOS")
|
|
.Append(name + " " + helper_name);
|
|
}
|
|
|
|
} // namespace
|
|
|
|
void ElectronMainDelegate::OverrideFrameworkBundlePath() {
|
|
base::apple::SetOverrideFrameworkBundlePath(
|
|
GetFrameworksPath().Append(ELECTRON_PRODUCT_NAME " Framework.framework"));
|
|
}
|
|
|
|
void ElectronMainDelegate::OverrideChildProcessPath() {
|
|
base::FilePath frameworks_path = GetFrameworksPath();
|
|
base::FilePath helper_path =
|
|
GetHelperAppPath(frameworks_path, ELECTRON_PRODUCT_NAME);
|
|
if (!base::PathExists(helper_path))
|
|
helper_path = GetHelperAppPath(frameworks_path, GetApplicationName());
|
|
if (!base::PathExists(helper_path))
|
|
LOG(FATAL) << "Unable to find helper app";
|
|
base::PathService::OverrideAndCreateIfNeeded(
|
|
content::CHILD_PROCESS_EXE, helper_path, /*is_absolute=*/true,
|
|
/*create=*/false);
|
|
}
|
|
|
|
void ElectronMainDelegate::SetUpBundleOverrides() {
|
|
@autoreleasepool {
|
|
NSBundle* bundle = MainApplicationBundle();
|
|
std::string base_bundle_id =
|
|
base::SysNSStringToUTF8([bundle bundleIdentifier]);
|
|
NSString* team_id = [bundle objectForInfoDictionaryKey:@"ElectronTeamID"];
|
|
if (team_id)
|
|
base_bundle_id = base::SysNSStringToUTF8(team_id) + "." + base_bundle_id;
|
|
base::apple::SetBaseBundleIDOverride(base_bundle_id);
|
|
}
|
|
}
|
|
|
|
void RegisterAtomCrApp() {
|
|
// Force the NSApplication subclass to be used.
|
|
[AtomApplication sharedApplication];
|
|
}
|
|
|
|
} // namespace electron
|