Files
electron/shell/browser/extensions/api/runtime/electron_runtime_api_delegate.cc
electron-roller[bot] 26e1bda335 chore: bump chromium to 140.0.7301.0 (main) (#47747)
* chore: bump chromium in DEPS to 140.0.7296.0

* chore: update patches

* 6702959: Remove OwnedByWidgetPassKey usage from content analysis dialog tests | https://chromium-review.googlesource.com/c/chromium/src/+/6702959

* 6722750: Remove un-used `stream_id` argument for `AidaCodeComplete` | https://chromium-review.googlesource.com/c/chromium/src/+/6722750

* 6696478: Reland Reland [video pip] Add fade in/out animation to controls visibility changes | https://chromium-review.googlesource.com/c/chromium/src/+/6696478

* chore: update libc++-filenames

* build: explicitly include cstdlib in Boyer-Moore patch

* chore: bump chromium in DEPS to 140.0.7297.0

* chore: update patches

* 6729537: [FPF] Pipe flag state from the browser to the renderer | https://chromium-review.googlesource.com/c/chromium/src/+/6729537

* 6727996: [Win] Detect pre-IPC crashes in sandboxed utility processes | https://chromium-review.googlesource.com/c/chromium/src/+/6727996

* 6707182: Move wtf/cross_thread_copier*.* to "blink" namespace | https://chromium-review.googlesource.com/c/chromium/src/+/6707182

* 6730796: extensions: Extract safe browsing/telemetry methods to new client class | https://chromium-review.googlesource.com/c/chromium/src/+/6730796

* chore: bump chromium in DEPS to 140.0.7299.0

* chore: update patches

* chore: update main patches

* build: reset the minimum macOS SDK to 15 to match upstream

This reverts commit 499e987c77.

* 6730215: Remove IPC_MESSAGE_LOG_ENABLED ifdef blocks. | https://chromium-review.googlesource.com/c/chromium/src/+/6730215

* 6690442: Delete ppapi/buildflags/buildflags.h | https://chromium-review.googlesource.com/c/chromium/src/+/6690442

* [wip]: 6667681: Use more binaries from clang toolchain in mac build | https://chromium-review.googlesource.com/c/chromium/src/+/6667681

* chore: bump chromium in DEPS to 140.0.7301.0

* chore: update patches

* 6656309: extensions: Port proxy API to desktop Android | https://chromium-review.googlesource.com/c/chromium/src/+/6656309

* 6758510: Reland 'Move GN enable_plugins variable out of //ppapi' | https://chromium-review.googlesource.com/c/chromium/src/+/6758510

* 6701466: [Extensions] Remove NaCl arch info from Update Client URLs | https://chromium-review.googlesource.com/c/chromium/src/+/6701466

* 6735979: [FSA] Replace `request_writable` with a new enum `FileSystemAccessPermissionMode`. | https://chromium-review.googlesource.com/c/chromium/src/+/6735979

* 6712080: Reland "Turn on gender translation PAK generation everywhere" | https://chromium-review.googlesource.com/c/chromium/src/+/6712080

* 6730796: extensions: Extract safe browsing/telemetry methods to new client class | https://chromium-review.googlesource.com/c/chromium/src/+/6730796

* build: restore minimum macOS SDK to 10, restore patch

This reverts commit a04c579b99.

* fixup! 6701466: [Extensions] Remove NaCl arch info from Update Client URLs | https://chromium-review.googlesource.com/c/chromium/src/+/6701466

* chore: correct node patches

* fixup! 6667681: Use more binaries from clang toolchain in mac build | https://chromium-review.googlesource.com/c/chromium/src/+/6667681

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: patchup[bot] <73610968+patchup[bot]@users.noreply.github.com>
2025-07-21 09:32:53 -07:00

84 lines
2.7 KiB
C++

// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "shell/browser/extensions/api/runtime/electron_runtime_api_delegate.h"
#include <string>
#include <string_view>
#include "components/update_client/update_query_params.h"
#include "extensions/common/api/runtime.h"
#include "shell/browser/extensions/electron_extension_system.h"
using extensions::api::runtime::PlatformInfo;
namespace extensions {
ElectronRuntimeAPIDelegate::ElectronRuntimeAPIDelegate(
content::BrowserContext* browser_context)
: browser_context_(browser_context) {
DCHECK(browser_context_);
}
ElectronRuntimeAPIDelegate::~ElectronRuntimeAPIDelegate() = default;
void ElectronRuntimeAPIDelegate::AddUpdateObserver(UpdateObserver* observer) {}
void ElectronRuntimeAPIDelegate::RemoveUpdateObserver(
UpdateObserver* observer) {}
void ElectronRuntimeAPIDelegate::ReloadExtension(
const std::string& extension_id) {
static_cast<ElectronExtensionSystem*>(ExtensionSystem::Get(browser_context_))
->ReloadExtension(extension_id);
}
bool ElectronRuntimeAPIDelegate::CheckForUpdates(
const std::string& extension_id,
UpdateCheckCallback callback) {
LOG(INFO) << "chrome.runtime.requestUpdateCheck is not supported in Electron";
return false;
}
void ElectronRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) {
LOG(INFO) << "chrome.runtime.openURL is not supported in Electron";
}
bool ElectronRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) {
if (const std::string_view os = update_client::UpdateQueryParams::GetOS();
os == "mac") {
info->os = extensions::api::runtime::PlatformOs::kMac;
} else if (os == "win") {
info->os = extensions::api::runtime::PlatformOs::kWin;
} else if (os == "linux") {
info->os = extensions::api::runtime::PlatformOs::kLinux;
} else if (os == "openbsd") {
info->os = extensions::api::runtime::PlatformOs::kOpenbsd;
} else {
NOTREACHED();
}
if (const std::string_view arch = update_client::UpdateQueryParams::GetArch();
arch == "arm") {
info->arch = extensions::api::runtime::PlatformArch::kArm;
} else if (arch == "arm64") {
info->arch = extensions::api::runtime::PlatformArch::kArm64;
} else if (arch == "x86") {
info->arch = extensions::api::runtime::PlatformArch::kX86_32;
} else if (arch == "x64") {
info->arch = extensions::api::runtime::PlatformArch::kX86_64;
} else {
NOTREACHED();
}
return true;
}
bool ElectronRuntimeAPIDelegate::RestartDevice(std::string* error_message) {
*error_message = "Restart is not supported in Electron";
return false;
}
} // namespace extensions