chore: bump chromium to 100.0.4857.0 (main) (#32419)

* chore: bump chromium in DEPS to 99.0.4819.0

* chore: update patches

* chore: bump chromium in DEPS to 99.0.4824.0

* chore: update patches

* chore: bump chromium in DEPS to 99.0.4827.0

* chore: update patches

* 3352511: PiP: Add inkdrop and pointer cursor to PiP window buttons

3352511

* 3309164: webhid: Show FIDO devices in the chooser if allowed

3309164

* 3297868: hid: Add experimental HIDDevice.forget()

3297868

* 3362491: [Extensions] Move i18n API to //extensions

3362491

* MCC Refactor step0: Allow embedders to register associated_interface binders with RenderFrameHostImpl::associated_registry_.

3281481

* 3352616: [Gtk] Remove libgtk from the link-line

3352616

* 3249211: Clear-Site-Data support for partitioned cookies

3249211

* [Extensions][COIL] Use [allow|block]list in //extensions/common

3372668

* Begin ScopedUserPrefUpdate migration to modern base::Value

3376154

* [Code Health] Refactor PrefService GetDict + GetList to use base::Value

3343526

* 3354997: [CodeHealth] Remove deprecated SetDictionary method

3354997

* 3287323: Add LacrosPrefStore for lacros settings

3287323

* 3365916: [PA] Clean up remaining lazy commit code

3365916

* [MPArch] Target the external protocol error at the responsible frame.

3011560

* Pass origin to RegisterNonNetworkSubresourceURLLoaderFactories

3350608

* Linux: Send OSCrypt raw encryption key to the Network Service

3320484

* [PlzServiceWorker] Remove remaining references to PlzServiceWorker.

3359441

* chore: fixup for lint

* 3327621: Fix tablet mode detection for Win 11.

3327621

* 3342428: ax_mac: move AXTextMarker conversion utils under ui umbrella

3342428

* 3353974: Mac: Use base::Feature for overlay features

3353974

* chore: bump chromium in DEPS to 99.0.4828.0

* chore: update patches

* chore: bump chromium in DEPS to 99.0.4837.0

* chore: update patches

* chore: update patches

* 3379142: Drop FALLTHROUGH macro
Ref: 3379142

* 3381749: C++17: Allow use of std::map::try_emplace and std::map::insert_or_assign
Ref: 3381749

* chore: bump chromium in DEPS to 99.0.4839.0

* chore: update patches

* chore: bump chromium in DEPS to 99.0.4840.0

* chore: bump chromium in DEPS to 99.0.4844.0

* 3395881: [api] Deprecate Local<v8::Context> v8::Object::CreationContext()

Ref: 3395881

* chore: update patches

* chore: bump chromium in DEPS to 100.0.4845.0

* chore: update patches

* chore: bump chromium in DEPS to 100.0.4847.0

* chore: update patches

* chore: bump chromium in DEPS to 100.0.4849.0

* chore: update patches

* chore: bump chromium in DEPS to 100.0.4851.0

* chore: bump chromium in DEPS to 100.0.4853.0

* update patches

* chore: update patches

* update patches

* 3383599: Fonts Access: Remove prototype that uses a font picker.

3383599

* 3404768: Remove ALLOW_UNUSED macros

3404768

* 3374762: Remove ignore_result.h

3374762

* 3399305: [unseasoned-pdf] Apply proper frame offsets for touch selections

3399305

* 3402210: [Extensions] Don't trigger unload event for already unloaded extension

3402210

* 3410912: Combine URLLoaderClient OnReceiveResponse and OnStartLoadingResponseBody.

3410912

* 3370428: Make the AuthSchemes policy support dynamic refresh

3370428

* 3407603: Finish ScopedUserPrefUpdate migration to modern base::Value

3407603

* 3378352: ozone/x11: move code from //ui/p/x11 to //ui/ozone/p/x11

3378352

* 3370810: Delete chrome/service, AKA the Cloud Print service process.

3370810

* chore: bump chromium in DEPS to 100.0.4855.0

* chore: update patches

* fixup! 3370810: Delete chrome/service, AKA the Cloud Print service process.

* revert 3348007 to fix windows build

* 3318572: [Code health] Fix gn check errors in //extensions/browser:*

3318572

* fix printing.patch

* fix iwyu issue

* 3408515: win: Make ShorcutOperation an enum class and modernize names

3408515

* 3388333: [UIA] Remove dead code accessibility_misc_utils.h/cc

3388333

* fix windows build? i hope

* patch gn visibility of //ui/ozone/platform/x11

* missing include base/logging.h

* use BUILDFLAG for USE_NSS_CERTS

3379123

* defined(OS_*) ==> BUILDFLAG(IS_*)

https://bugs.chromium.org/p/chromium/issues/detail?id=1234043

* fixup! 3404768: Remove ALLOW_UNUSED macros

* another attempt to fix windows build

* temporarily disable the custom scheme service worker test

https://github.com/electron/electron/issues/32664

* fix loading mv3 extensions

not sure what cl broke this unfort.

* fixup! 3404768: Remove ALLOW_UNUSED macros

* patch nan

3395880

* fix node test

* fix nullptr in FindPdfFrame

* patch perfetto to fix build issue on win-ia32

bc44c3c753

* fix build for linux-x64-testing-no-run-as-node

* fix patch

* skip <webview>.capturePage() test

https://github.com/electron/electron/issues/32705

* test: fix failing tests of focus/blur events of WebContents (#32711)

* inherit stdio from app module test child processes

this prevents them from timing out due to full stdout buffers

* test to see if we can get better logs on windows ci

* try again for appveyor log things

* skip contentTracing tests on ia32

* ci: disable gpu compositing

* drop applied patch

* fix merge fail

* Revert "ci: disable gpu compositing"

This reverts commit 0344129fcb19ea3e87e06c1110d751f22eba3fec.

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
This commit is contained in:
electron-roller[bot] 2022-02-09 18:58:52 -08:00 committed by GitHub
parent e9a43be9be
commit 28ada6ea8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
279 changed files with 1681 additions and 2236 deletions

View file

@ -32,6 +32,7 @@
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/content_switches.h"
#include "crypto/crypto_buildflags.h"
#include "media/audio/audio_manager.h"
#include "net/dns/public/dns_over_https_server_config.h"
#include "net/dns/public/util.h"
@ -70,12 +71,12 @@
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image.h"
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
#include "base/strings/utf_string_conversions.h"
#include "shell/browser/ui/win/jump_list.h"
#endif
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
#include <CoreFoundation/CoreFoundation.h>
#include "shell/browser/ui/cocoa/electron_bundle_mover.h"
#endif
@ -84,7 +85,7 @@ using electron::Browser;
namespace gin {
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
template <>
struct Converter<electron::ProcessIntegrityLevel> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
@ -346,7 +347,7 @@ struct Converter<JumpListResult> {
};
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
template <>
struct Converter<Browser::LaunchItem> {
static bool FromV8(v8::Isolate* isolate,
@ -390,7 +391,7 @@ struct Converter<Browser::LoginItemSettings> {
dict.Get("openAsHidden", &(out->open_as_hidden));
dict.Get("path", &(out->path));
dict.Get("args", &(out->args));
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
dict.Get("enabled", &(out->enabled));
dict.Get("name", &(out->name));
#endif
@ -405,7 +406,7 @@ struct Converter<Browser::LoginItemSettings> {
dict.Set("restoreState", val.restore_state);
dict.Set("wasOpenedAtLogin", val.opened_at_login);
dict.Set("wasOpenedAsHidden", val.opened_as_hidden);
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
dict.Set("launchItems", val.launch_items);
dict.Set("executableWillLaunchAtLogin",
val.executable_will_launch_at_login);
@ -475,7 +476,7 @@ int GetPathConstant(const std::string& name) {
else if (name == "userData")
return chrome::DIR_USER_DATA;
else if (name == "cache")
#if defined(OS_POSIX)
#if BUILDFLAG(IS_POSIX)
return base::DIR_CACHE;
#else
return base::DIR_ROAMING_APP_DATA;
@ -506,7 +507,7 @@ int GetPathConstant(const std::string& name) {
return chrome::DIR_USER_PICTURES;
else if (name == "videos")
return chrome::DIR_USER_VIDEOS;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
else if (name == "recent")
return electron::DIR_RECENT;
#endif
@ -597,7 +598,7 @@ void OnClientCertificateSelected(
}
}
#if defined(USE_NSS_CERTS)
#if BUILDFLAG(USE_NSS_CERTS)
int ImportIntoCertStore(CertificateManagerModel* model, base::Value options) {
std::string file_data, cert_path;
std::u16string password;
@ -706,7 +707,7 @@ void App::OnWillFinishLaunching() {
}
void App::OnFinishLaunching(const base::DictionaryValue& launch_info) {
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
// Set the application name for audio streams shown in external
// applications. Only affects pulseaudio currently.
media::AudioManager::SetGlobalAppName(Browser::Get()->GetName());
@ -740,7 +741,7 @@ void App::OnAccessibilitySupportChanged() {
Emit("accessibility-support-changed", IsAccessibilitySupportEnabled());
}
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
void App::OnWillContinueUserActivity(bool* prevent_default,
const std::string& type) {
if (Emit("will-continue-activity", type)) {
@ -940,7 +941,7 @@ void App::ChildProcessLaunched(int process_type,
base::ProcessHandle handle,
const std::string& service_name,
const std::string& name) {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
auto metrics = base::ProcessMetrics::CreateProcessMetrics(
handle, content::BrowserChildProcessHost::GetPortProvider());
#else
@ -962,7 +963,7 @@ void App::SetAppPath(const base::FilePath& app_path) {
app_path_ = app_path;
}
#if !defined(OS_MAC)
#if !BUILDFLAG(IS_MAC)
void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
absl::optional<base::FilePath> custom_path) {
if (custom_path.has_value()) {
@ -998,7 +999,7 @@ bool App::IsPackaged() {
base::FilePath::StringType base_name =
base::ToLowerASCII(exe_path.BaseName().value());
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
return base_name != FILE_PATH_LITERAL("electron.exe");
#else
return base_name != FILE_PATH_LITERAL("electron");
@ -1031,7 +1032,7 @@ void App::SetPath(gin_helper::ErrorThrower thrower,
}
void App::SetDesktopName(const std::string& desktop_name) {
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
auto env = base::Environment::Create();
env->SetVar("CHROME_DESKTOP", desktop_name);
#endif
@ -1043,7 +1044,7 @@ std::string App::GetLocale() {
std::string App::GetLocaleCountryCode() {
std::string region;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
WCHAR locale_name[LOCALE_NAME_MAX_LENGTH] = {0};
if (GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME,
@ -1054,7 +1055,7 @@ std::string App::GetLocaleCountryCode() {
sizeof(locale_name) / sizeof(WCHAR))) {
base::WideToUTF8(locale_name, wcslen(locale_name), &region);
}
#elif defined(OS_MAC)
#elif BUILDFLAG(IS_MAC)
CFLocaleRef locale = CFLocaleCopyCurrent();
CFStringRef value = CFStringRef(
static_cast<CFTypeRef>(CFLocaleGetValue(locale, kCFLocaleCountryCode)));
@ -1155,7 +1156,7 @@ bool App::RequestSingleInstanceLock(gin::Arguments* args) {
blink::CloneableMessage additional_data_message;
args->GetNext(&additional_data_message);
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
bool app_is_sandboxed =
IsSandboxEnabled(base::CommandLine::ForCurrentProcess());
process_singleton_ = std::make_unique<ProcessSingleton>(
@ -1278,7 +1279,7 @@ Browser::LoginItemSettings App::GetLoginItemSettings(gin::Arguments* args) {
return Browser::Get()->GetLoginItemSettings(options);
}
#if defined(USE_NSS_CERTS)
#if BUILDFLAG(USE_NSS_CERTS)
void App::ImportCertificate(gin_helper::ErrorThrower thrower,
base::Value options,
net::CompletionOnceCallback callback) {
@ -1313,7 +1314,7 @@ void App::OnCertificateManagerModelCreated(
}
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
v8::Local<v8::Value> App::GetJumpListSettings() {
JumpList jump_list(Browser::Get()->GetAppUserModelID());
@ -1369,7 +1370,7 @@ JumpListResult App::SetJumpList(v8::Local<v8::Value> val,
return result;
}
#endif // defined(OS_WIN)
#endif // BUILDFLAG(IS_WIN)
v8::Local<v8::Promise> App::GetFileIcon(const base::FilePath& path,
gin::Arguments* args) {
@ -1418,7 +1419,7 @@ std::vector<gin_helper::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
process_metric.second->metrics->GetPlatformIndependentCPUUsage() /
processor_count);
#if !defined(OS_WIN)
#if !BUILDFLAG(IS_WIN)
cpu_dict.Set("idleWakeupsPerSecond",
process_metric.second->metrics->GetIdleWakeupsPerSecond());
#else
@ -1443,7 +1444,7 @@ std::vector<gin_helper::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
pid_dict.Set("name", process_metric.second->name);
}
#if !defined(OS_LINUX)
#if !BUILDFLAG(IS_LINUX)
auto memory_info = process_metric.second->GetMemoryInfo();
gin_helper::Dictionary memory_dict = gin::Dictionary::CreateEmpty(isolate);
@ -1454,7 +1455,7 @@ std::vector<gin_helper::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
"peakWorkingSetSize",
static_cast<double>(memory_info.peak_working_set_size >> 10));
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
memory_dict.Set("privateBytes",
static_cast<double>(memory_info.private_bytes >> 10));
#endif
@ -1462,9 +1463,9 @@ std::vector<gin_helper::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
pid_dict.Set("memory", memory_dict);
#endif
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
pid_dict.Set("sandboxed", process_metric.second->IsSandboxed());
#elif defined(OS_WIN)
#elif BUILDFLAG(IS_WIN)
auto integrity_level = process_metric.second->GetIntegrityLevel();
auto sandboxed = ProcessMetric::IsSandboxed(integrity_level);
pid_dict.Set("integrityLevel", integrity_level);
@ -1499,7 +1500,7 @@ v8::Local<v8::Promise> App::GetGPUInfo(v8::Isolate* isolate,
auto* const info_mgr = GPUInfoManager::GetInstance();
if (info_type == "complete") {
#if defined(OS_WIN) || defined(OS_MAC)
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
info_mgr->FetchCompleteInfo(std::move(promise));
#else
info_mgr->FetchBasicInfo(std::move(promise));
@ -1541,7 +1542,7 @@ void App::SetUserAgentFallback(const std::string& user_agent) {
ElectronBrowserClient::Get()->SetUserAgent(user_agent);
}
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
bool App::IsRunningUnderARM64Translation() const {
USHORT processMachine = 0;
@ -1566,7 +1567,7 @@ std::string App::GetUserAgentFallback() {
return ElectronBrowserClient::Get()->GetUserAgent();
}
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
bool App::MoveToApplicationsFolder(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
return ElectronBundleMover::Move(thrower, args);
@ -1732,7 +1733,7 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
base::BindRepeating(&Browser::AddRecentDocument, browser))
.SetMethod("clearRecentDocuments",
base::BindRepeating(&Browser::ClearRecentDocuments, browser))
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
.SetMethod("setAppUserModelId",
base::BindRepeating(&Browser::SetAppUserModelID, browser))
#endif
@ -1745,7 +1746,7 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
.SetMethod(
"removeAsDefaultProtocolClient",
base::BindRepeating(&Browser::RemoveAsDefaultProtocolClient, browser))
#if !defined(OS_LINUX)
#if !BUILDFLAG(IS_LINUX)
.SetMethod(
"getApplicationInfoForProtocol",
base::BindRepeating(&Browser::GetApplicationInfoForProtocol, browser))
@ -1762,7 +1763,7 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
base::BindRepeating(&Browser::SetLoginItemSettings, browser))
.SetMethod("isEmojiPanelSupported",
base::BindRepeating(&Browser::IsEmojiPanelSupported, browser))
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
.SetMethod("hide", base::BindRepeating(&Browser::Hide, browser))
.SetMethod("show", base::BindRepeating(&Browser::Show, browser))
.SetMethod("setUserActivity",
@ -1784,7 +1785,7 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
base::BindRepeating(&Browser::SetAboutPanelOptions, browser))
.SetMethod("showAboutPanel",
base::BindRepeating(&Browser::ShowAboutPanel, browser))
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
.SetMethod(
"isSecureKeyboardEntryEnabled",
base::BindRepeating(&Browser::IsSecureKeyboardEntryEnabled, browser))
@ -1792,17 +1793,17 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
"setSecureKeyboardEntryEnabled",
base::BindRepeating(&Browser::SetSecureKeyboardEntryEnabled, browser))
#endif
#if defined(OS_MAC) || defined(OS_WIN)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
.SetMethod("showEmojiPanel",
base::BindRepeating(&Browser::ShowEmojiPanel, browser))
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
.SetMethod("setUserTasks",
base::BindRepeating(&Browser::SetUserTasks, browser))
.SetMethod("getJumpListSettings", &App::GetJumpListSettings)
.SetMethod("setJumpList", &App::SetJumpList)
#endif
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
.SetMethod("isUnityRunning",
base::BindRepeating(&Browser::IsUnityRunning, browser))
#endif
@ -1815,7 +1816,7 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
.SetMethod("setDesktopName", &App::SetDesktopName)
.SetMethod("getLocale", &App::GetLocale)
.SetMethod("getLocaleCountryCode", &App::GetLocaleCountryCode)
#if defined(USE_NSS_CERTS)
#if BUILDFLAG(USE_NSS_CERTS)
.SetMethod("importCertificate", &App::ImportCertificate)
#endif
.SetMethod("hasSingleInstanceLock", &App::HasSingleInstanceLock)
@ -1838,12 +1839,12 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
.SetMethod("startAccessingSecurityScopedResource",
&App::StartAccessingSecurityScopedResource)
#endif
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
.SetProperty("dock", &App::GetDockAPI)
.SetProperty("runningUnderRosettaTranslation",
&App::IsRunningUnderRosettaTranslation)
#endif
#if defined(OS_MAC) || defined(OS_WIN)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
.SetProperty("runningUnderARM64Translation",
&App::IsRunningUnderARM64Translation)
#endif

View file

@ -16,6 +16,7 @@
#include "content/public/browser/browser_child_process_observer.h"
#include "content/public/browser/gpu_data_manager_observer.h"
#include "content/public/browser/render_process_host.h"
#include "crypto/crypto_buildflags.h"
#include "gin/handle.h"
#include "net/base/completion_once_callback.h"
#include "net/base/completion_repeating_callback.h"
@ -29,7 +30,7 @@
#include "shell/common/gin_helper/error_thrower.h"
#include "shell/common/gin_helper/promise.h"
#if defined(USE_NSS_CERTS)
#if BUILDFLAG(USE_NSS_CERTS)
#include "shell/browser/certificate_manager_model.h"
#endif
@ -39,7 +40,7 @@ class FilePath;
namespace electron {
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
enum class JumpListResult : int;
#endif
@ -64,7 +65,7 @@ class App : public ElectronBrowserClient::Delegate,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
#if defined(USE_NSS_CERTS)
#if BUILDFLAG(USE_NSS_CERTS)
void OnCertificateManagerModelCreated(
base::Value options,
net::CompletionOnceCallback callback,
@ -99,7 +100,7 @@ class App : public ElectronBrowserClient::Delegate,
void OnAccessibilitySupportChanged() override;
void OnPreMainMessageLoopRun() override;
void OnPreCreateThreads() override;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
void OnWillContinueUserActivity(bool* prevent_default,
const std::string& type) override;
void OnDidFailToContinueUserActivity(const std::string& type,
@ -208,7 +209,7 @@ class App : public ElectronBrowserClient::Delegate,
void SetAccessibilitySupportEnabled(gin_helper::ErrorThrower thrower,
bool enabled);
Browser::LoginItemSettings GetLoginItemSettings(gin::Arguments* args);
#if defined(USE_NSS_CERTS)
#if BUILDFLAG(USE_NSS_CERTS)
void ImportCertificate(gin_helper::ErrorThrower thrower,
base::Value options,
net::CompletionOnceCallback callback);
@ -224,7 +225,7 @@ class App : public ElectronBrowserClient::Delegate,
void SetUserAgentFallback(const std::string& user_agent);
std::string GetUserAgentFallback();
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
void SetActivationPolicy(gin_helper::ErrorThrower thrower,
const std::string& policy);
bool MoveToApplicationsFolder(gin_helper::ErrorThrower, gin::Arguments* args);
@ -234,7 +235,7 @@ class App : public ElectronBrowserClient::Delegate,
v8::Global<v8::Value> dock_;
#endif
#if defined(OS_MAC) || defined(OS_WIN)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
bool IsRunningUnderARM64Translation() const;
#endif
@ -243,17 +244,17 @@ class App : public ElectronBrowserClient::Delegate,
gin::Arguments* args);
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
// Get the current Jump List settings.
v8::Local<v8::Value> GetJumpListSettings();
// Set or remove a custom Jump List for the application.
JumpListResult SetJumpList(v8::Local<v8::Value> val, gin::Arguments* args);
#endif // defined(OS_WIN)
#endif // BUILDFLAG(IS_WIN)
std::unique_ptr<ProcessSingleton> process_singleton_;
#if defined(USE_NSS_CERTS)
#if BUILDFLAG(USE_NSS_CERTS)
std::unique_ptr<CertificateManagerModel> certificate_manager_model_;
#endif

View file

@ -32,12 +32,12 @@
#include "shell/browser/native_window_views.h"
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
#include "shell/browser/ui/win/taskbar_host.h"
#include "ui/base/win/shell.h"
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
namespace gin {
template <>
@ -305,7 +305,7 @@ void BaseWindow::OnSystemContextMenu(int x, int y, bool* prevent_default) {
}
}
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
void BaseWindow::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {
if (IsWindowMessageHooked(message)) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
@ -875,7 +875,7 @@ void BaseWindow::SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value) {
window_->SetVibrancy(type);
}
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
std::string BaseWindow::GetAlwaysOnTopLevel() {
return window_->GetAlwaysOnTopLevel();
}
@ -1028,7 +1028,7 @@ bool BaseWindow::IsModal() const {
}
bool BaseWindow::SetThumbarButtons(gin_helper::Arguments* args) {
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
std::vector<TaskbarHost::ThumbarButton> buttons;
if (!args->GetNext(&buttons)) {
args->ThrowError();
@ -1055,18 +1055,18 @@ void BaseWindow::SetIconImpl(v8::Isolate* isolate,
on_error))
return;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
static_cast<NativeWindowViews*>(window_.get())
->SetIcon(native_image->GetHICON(GetSystemMetrics(SM_CXSMICON)),
native_image->GetHICON(GetSystemMetrics(SM_CXICON)));
#elif defined(OS_LINUX)
#elif BUILDFLAG(IS_LINUX)
static_cast<NativeWindowViews*>(window_.get())
->SetIcon(native_image->image().AsImageSkia());
#endif
}
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
bool BaseWindow::HookWindowMessage(UINT message,
const MessageCallback& callback) {
messages_callback_map_[message] = callback;
@ -1266,12 +1266,12 @@ void BaseWindow::BuildPrototype(v8::Isolate* isolate,
&BaseWindow::SetVisibleOnAllWorkspaces)
.SetMethod("isVisibleOnAllWorkspaces",
&BaseWindow::IsVisibleOnAllWorkspaces)
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
.SetMethod("_getAlwaysOnTopLevel", &BaseWindow::GetAlwaysOnTopLevel)
.SetMethod("setAutoHideCursor", &BaseWindow::SetAutoHideCursor)
#endif
.SetMethod("setVibrancy", &BaseWindow::SetVibrancy)
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
.SetMethod("setTrafficLightPosition",
&BaseWindow::SetTrafficLightPosition)
.SetMethod("getTrafficLightPosition",
@ -1280,7 +1280,7 @@ void BaseWindow::BuildPrototype(v8::Isolate* isolate,
.SetMethod("_setTouchBarItems", &BaseWindow::SetTouchBar)
.SetMethod("_refreshTouchBarItem", &BaseWindow::RefreshTouchBarItem)
.SetMethod("_setEscapeTouchBarItem", &BaseWindow::SetEscapeTouchBarItem)
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
.SetMethod("selectPreviousTab", &BaseWindow::SelectPreviousTab)
.SetMethod("selectNextTab", &BaseWindow::SelectNextTab)
.SetMethod("mergeAllWindows", &BaseWindow::MergeAllWindows)
@ -1312,7 +1312,7 @@ void BaseWindow::BuildPrototype(v8::Isolate* isolate,
#if defined(TOOLKIT_VIEWS)
.SetMethod("setIcon", &BaseWindow::SetIcon)
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
.SetMethod("hookWindowMessage", &BaseWindow::HookWindowMessage)
.SetMethod("isWindowMessageHooked", &BaseWindow::IsWindowMessageHooked)
.SetMethod("unhookWindowMessage", &BaseWindow::UnhookWindowMessage)

View file

@ -86,7 +86,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
const base::DictionaryValue& details) override;
void OnNewWindowForTab() override;
void OnSystemContextMenu(int x, int y, bool* prevent_default) override;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) override;
#endif
@ -193,7 +193,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
void SetAutoHideCursor(bool auto_hide);
virtual void SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value);
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
std::string GetAlwaysOnTopLevel();
void SetWindowButtonVisibility(bool visible);
bool GetWindowButtonVisibility() const;
@ -234,7 +234,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
v8::Local<v8::Value> icon,
NativeImage::OnConvertError on_error);
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
typedef base::RepeatingCallback<void(v8::Local<v8::Value>,
v8::Local<v8::Value>)>
MessageCallback;
@ -264,7 +264,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
weak_factory_.GetWeakPtr(), eventName));
}
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
typedef std::map<UINT, MessageCallback> MessageCallbackMap;
MessageCallbackMap messages_callback_map_;
#endif

View file

@ -41,7 +41,7 @@ BrowserWindow::BrowserWindow(gin::Arguments* args,
options.Get(options::kTransparent, &transparent);
std::string vibrancy_type;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
options.Get(options::kVibrancyType, &vibrancy_type);
#endif
@ -109,7 +109,7 @@ BrowserWindow::BrowserWindow(gin::Arguments* args,
// Install the content view after BaseWindow's JS code is initialized.
SetContentView(gin::CreateHandle<View>(isolate, web_contents_view.get()));
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
OverrideNSWindowContentView(
web_contents->inspectable_web_contents()->GetView());
#endif
@ -219,7 +219,7 @@ void BrowserWindow::OnSetContentBounds(const gfx::Rect& rect) {
void BrowserWindow::OnActivateContents() {
// Hide the auto-hide menu when webContents is focused.
#if !defined(OS_MAC)
#if !BUILDFLAG(IS_MAC)
if (IsMenuBarAutoHide() && IsMenuBarVisible())
window()->SetMenuBarVisibility(false);
#endif
@ -294,7 +294,7 @@ void BrowserWindow::OnWindowFocus() {
// focus/blur events might be emitted while closing window.
if (api_web_contents_) {
web_contents()->RestoreFocus();
#if !defined(OS_MAC)
#if !BUILDFLAG(IS_MAC)
if (!api_web_contents_->IsDevToolsOpened())
web_contents()->Focus();
#endif
@ -304,7 +304,7 @@ void BrowserWindow::OnWindowFocus() {
}
void BrowserWindow::OnWindowIsKeyChanged(bool is_key) {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
auto* rwhv = web_contents()->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetActive(is_key);
@ -313,7 +313,7 @@ void BrowserWindow::OnWindowIsKeyChanged(bool is_key) {
}
void BrowserWindow::OnWindowResize() {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
if (!draggable_regions_.empty()) {
UpdateDraggableRegions(draggable_regions_);
} else {
@ -326,7 +326,7 @@ void BrowserWindow::OnWindowResize() {
}
void BrowserWindow::OnWindowLeaveFullScreen() {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
if (web_contents()->IsFullscreen())
web_contents()->ExitFullscreen(true);
#endif
@ -392,21 +392,21 @@ void BrowserWindow::SetBackgroundColor(const std::string& color_name) {
void BrowserWindow::SetBrowserView(v8::Local<v8::Value> value) {
BaseWindow::ResetBrowserViews();
BaseWindow::AddBrowserView(value);
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
UpdateDraggableRegions(draggable_regions_);
#endif
}
void BrowserWindow::AddBrowserView(v8::Local<v8::Value> value) {
BaseWindow::AddBrowserView(value);
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
UpdateDraggableRegions(draggable_regions_);
#endif
}
void BrowserWindow::RemoveBrowserView(v8::Local<v8::Value> value) {
BaseWindow::RemoveBrowserView(value);
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
UpdateDraggableRegions(draggable_regions_);
#endif
}
@ -414,14 +414,14 @@ void BrowserWindow::RemoveBrowserView(v8::Local<v8::Value> value) {
void BrowserWindow::SetTopBrowserView(v8::Local<v8::Value> value,
gin_helper::Arguments* args) {
BaseWindow::SetTopBrowserView(value, args);
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
UpdateDraggableRegions(draggable_regions_);
#endif
}
void BrowserWindow::ResetBrowserViews() {
BaseWindow::ResetBrowserViews();
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
UpdateDraggableRegions(draggable_regions_);
#endif
}

View file

@ -101,7 +101,7 @@ class BrowserWindow : public BaseWindow,
v8::Local<v8::Value> GetWebContents(v8::Isolate* isolate);
private:
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
void OverrideNSWindowContentView(InspectableWebContentsView* webView);
#endif

View file

@ -38,7 +38,7 @@
#include "third_party/crashpad/crashpad/client/crashpad_info.h" // nogncheck
#endif
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
#include "base/containers/span.h"
#include "base/files/file_util.h"
#include "base/guid.h"
@ -51,13 +51,13 @@
namespace {
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
std::map<std::string, std::string>& GetGlobalCrashKeysMutable() {
static base::NoDestructor<std::map<std::string, std::string>>
global_crash_keys;
return *global_crash_keys;
}
#endif // defined(OS_LINUX)
#endif // BUILDFLAG(IS_LINUX)
bool g_crash_reporter_initialized = false;
@ -81,7 +81,7 @@ bool IsCrashReporterEnabled() {
return g_crash_reporter_initialized;
}
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
const std::map<std::string, std::string>& GetGlobalCrashKeys() {
return GetGlobalCrashKeysMutable();
}
@ -150,7 +150,7 @@ void Start(const std::string& submit_url,
is_node_process
? "node"
: command_line->GetSwitchValueASCII(::switches::kProcessType);
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
if (::crash_reporter::IsCrashpadEnabled()) {
for (const auto& pair : extra)
electron::crash_keys::SetCrashKey(pair.first, pair.second);
@ -174,7 +174,7 @@ void Start(const std::string& submit_url,
electron::crash_keys::SetCrashKey(pair.first, pair.second);
breakpad::InitCrashReporter(process_type);
}
#elif defined(OS_MAC)
#elif BUILDFLAG(IS_MAC)
for (const auto& pair : extra)
electron::crash_keys::SetCrashKey(pair.first, pair.second);
::crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
@ -182,7 +182,7 @@ void Start(const std::string& submit_url,
crashpad::CrashpadInfo::GetCrashpadInfo()
->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled);
}
#elif defined(OS_WIN)
#elif BUILDFLAG(IS_WIN)
for (const auto& pair : extra)
electron::crash_keys::SetCrashKey(pair.first, pair.second);
base::FilePath user_data_dir;
@ -210,7 +210,7 @@ void GetUploadedReports(
}
#else
scoped_refptr<UploadList> CreateCrashUploadList() {
#if defined(OS_MAC) || defined(OS_WIN)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
return base::MakeRefCounted<CrashUploadListCrashpad>();
#else
base::FilePath crash_dir_path;
@ -231,7 +231,7 @@ scoped_refptr<UploadList> CreateCrashUploadList() {
result = base::MakeRefCounted<CombiningUploadList>(std::move(uploaders));
}
return result;
#endif // defined(OS_MAC) || defined(OS_WIN)
#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
}
v8::Local<v8::Value> GetUploadedReports(v8::Isolate* isolate) {

View file

@ -17,7 +17,7 @@ namespace crash_reporter {
bool IsCrashReporterEnabled();
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
const std::map<std::string, std::string>& GetGlobalCrashKeys();
std::string GetClientId();
#endif

View file

@ -24,11 +24,11 @@
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
#include "third_party/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h"
#include "third_party/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h"
#include "ui/display/win/display_info.h"
#endif // defined(OS_WIN)
#endif // BUILDFLAG(IS_WIN)
namespace gin {
@ -74,7 +74,7 @@ void DesktopCapturer::StartHandling(bool capture_window,
const gfx::Size& thumbnail_size,
bool fetch_window_icons) {
fetch_window_icons_ = fetch_window_icons;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
if (content::desktop_capture::CreateDesktopCaptureOptions()
.allow_directx_capturer()) {
// DxgiDuplicatorController should be alive in this scope according to
@ -82,7 +82,7 @@ void DesktopCapturer::StartHandling(bool capture_window,
auto duplicator = webrtc::DxgiDuplicatorController::Instance();
using_directx_capturer_ = webrtc::ScreenCapturerWinDirectx::IsSupported();
}
#endif // defined(OS_WIN)
#endif // BUILDFLAG(IS_WIN)
// clear any existing captured sources.
captured_sources_.clear();
@ -143,7 +143,7 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
screen_sources.emplace_back(
DesktopCapturer::Source{list->GetSource(i), std::string()});
}
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
// Gather the same unique screen IDs used by the electron.screen API in
// order to provide an association between it and
// desktopCapturer/getUserMedia. This is only required when using the
@ -176,12 +176,12 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
source.display_id = base::NumberToString(device_id);
}
}
#elif defined(OS_MAC)
#elif BUILDFLAG(IS_MAC)
// On Mac, the IDs across the APIs match.
for (auto& source : screen_sources) {
source.display_id = base::NumberToString(source.media_list_source.id.id);
}
#endif // defined(OS_WIN)
#endif // BUILDFLAG(IS_WIN)
// TODO(ajmacd): Add Linux support. The IDs across APIs differ but Chrome
// only supports capturing the entire desktop on Linux. Revisit this if
// individual screen support is added.

View file

@ -70,9 +70,9 @@ class DesktopCapturer : public gin::Wrappable<DesktopCapturer>,
bool capture_window_ = false;
bool capture_screen_ = false;
bool fetch_window_icons_ = false;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
bool using_directx_capturer_ = false;
#endif // defined(OS_WIN)
#endif // BUILDFLAG(IS_WIN)
base::WeakPtrFactory<DesktopCapturer> weak_ptr_factory_{this};
};

View file

@ -97,7 +97,7 @@ void Initialize(v8::Local<v8::Object> exports,
dict.SetMethod("showOpenDialog", &ShowOpenDialog);
dict.SetMethod("showSaveDialogSync", &ShowSaveDialogSync);
dict.SetMethod("showSaveDialog", &ShowSaveDialog);
#if defined(OS_MAC) || defined(OS_WIN)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
dict.SetMethod("showCertificateTrustDialog",
&certificate_trust::ShowCertificateTrust);
#endif

View file

@ -18,7 +18,7 @@
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/node_includes.h"
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
#endif
@ -27,7 +27,7 @@ using extensions::GlobalShortcutListener;
namespace {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
bool RegisteringMediaKeyForUntrustedClient(const ui::Accelerator& accelerator) {
if (base::mac::IsAtLeastOS10_14()) {
if (Command::IsMediaKey(accelerator)) {
@ -103,7 +103,7 @@ bool GlobalShortcut::Register(const ui::Accelerator& accelerator,
.ThrowError("globalShortcut cannot be used before the app is ready");
return false;
}
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
if (Command::IsMediaKey(accelerator)) {
if (RegisteringMediaKeyForUntrustedClient(accelerator))
return false;
@ -130,7 +130,7 @@ void GlobalShortcut::Unregister(const ui::Accelerator& accelerator) {
if (accelerator_callback_map_.erase(accelerator) == 0)
return;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
if (Command::IsMediaKey(accelerator) &&
!MapHasMediaKeys(accelerator_callback_map_)) {
GlobalShortcutListener::SetShouldUseInternalMediaKeyHandling(true);

View file

@ -141,7 +141,7 @@ namespace api {
gin::WrapperInfo InAppPurchase::kWrapperInfo = {gin::kEmbedderNativeGin};
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
// static
gin::Handle<InAppPurchase> InAppPurchase::Create(v8::Isolate* isolate) {
return gin::CreateHandle(isolate, new InAppPurchase());
@ -223,7 +223,7 @@ void Initialize(v8::Local<v8::Object> exports,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context,
void* priv) {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
v8::Isolate* isolate = context->GetIsolate();
gin_helper::Dictionary dict(isolate, exports);
dict.Set("inAppPurchase", InAppPurchase::Create(isolate));

View file

@ -19,7 +19,7 @@
#include "shell/common/node_includes.h"
#include "ui/base/models/image_model.h"
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
namespace gin {
@ -54,7 +54,7 @@ Menu::Menu(gin::Arguments* args)
: model_(std::make_unique<ElectronMenuModel>(this)) {
model_->AddObserver(this);
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
gin_helper::Dictionary options;
if (args->GetNext(&options)) {
ElectronMenuModel::SharingItem item;
@ -117,7 +117,7 @@ bool Menu::ShouldRegisterAcceleratorForCommandId(int command_id) const {
command_id);
}
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
bool Menu::GetSharingItemForCommandId(
int command_id,
ElectronMenuModel::SharingItem* item) const {
@ -296,7 +296,7 @@ v8::Local<v8::ObjectTemplate> Menu::FillObjectTemplate(
.SetMethod("popupAt", &Menu::PopupAt)
.SetMethod("closePopupAt", &Menu::ClosePopupAt)
.SetMethod("_getAcceleratorTextAt", &Menu::GetAcceleratorTextAtForTesting)
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
.SetMethod("_getUserAcceleratorAt", &Menu::GetUserAcceleratorAt)
#endif
.Build();
@ -318,7 +318,7 @@ void Initialize(v8::Local<v8::Object> exports,
gin_helper::Dictionary dict(isolate, exports);
dict.Set("Menu", Menu::GetConstructor(context));
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
dict.SetMethod("setApplicationMenu", &Menu::SetApplicationMenu);
dict.SetMethod("sendActionToFirstResponder",
&Menu::SendActionToFirstResponder);

View file

@ -36,7 +36,7 @@ class Menu : public gin::Wrappable<Menu>,
// gin::Wrappable
static gin::WrapperInfo kWrapperInfo;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
// Set the global menubar.
static void SetApplicationMenu(Menu* menu);
@ -68,7 +68,7 @@ class Menu : public gin::Wrappable<Menu>,
bool use_default_accelerator,
ui::Accelerator* accelerator) const override;
bool ShouldRegisterAcceleratorForCommandId(int command_id) const override;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
bool GetSharingItemForCommandId(
int command_id,
ElectronMenuModel::SharingItem* item) const override;

View file

@ -47,7 +47,7 @@ void NativeTheme::OnNativeThemeUpdated(ui::NativeTheme* theme) {
void NativeTheme::SetThemeSource(ui::NativeTheme::ThemeSource override) {
ui_theme_->set_theme_source(override);
web_theme_->set_theme_source(override);
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
// Update the macOS appearance setting for this new override value
UpdateMacOSAppearanceForOverrideValue(override);
#endif
@ -67,14 +67,14 @@ bool NativeTheme::ShouldUseHighContrastColors() {
return ui_theme_->UserHasContrastPreference();
}
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
const CFStringRef WhiteOnBlack = CFSTR("whiteOnBlack");
const CFStringRef UniversalAccessDomain = CFSTR("com.apple.universalaccess");
#endif
// TODO(MarshallOfSound): Implement for Linux
bool NativeTheme::ShouldUseInvertedColorScheme() {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
CFPreferencesAppSynchronize(UniversalAccessDomain);
Boolean keyExistsAndHasValidFormat = false;
Boolean is_inverted = CFPreferencesGetAppBooleanValue(

View file

@ -38,7 +38,7 @@ class NativeTheme : public gin::Wrappable<NativeTheme>,
~NativeTheme() override;
void SetThemeSource(ui::NativeTheme::ThemeSource override);
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
void UpdateMacOSAppearanceForOverrideValue(
ui::NativeTheme::ThemeSource override);
#endif

View file

@ -42,7 +42,7 @@ namespace api {
gin::WrapperInfo PowerMonitor::kWrapperInfo = {gin::kEmbedderNativeGin};
PowerMonitor::PowerMonitor(v8::Isolate* isolate) {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
Browser::Get()->SetShutdownHandler(base::BindRepeating(
&PowerMonitor::ShouldShutdown, base::Unretained(this)));
#endif
@ -50,7 +50,7 @@ PowerMonitor::PowerMonitor(v8::Isolate* isolate) {
base::PowerMonitor::AddPowerStateObserver(this);
base::PowerMonitor::AddPowerSuspendObserver(this);
#if defined(OS_MAC) || defined(OS_WIN)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
InitPlatformSpecificMonitors();
#endif
}
@ -79,7 +79,7 @@ void PowerMonitor::OnResume() {
Emit("resume");
}
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
void PowerMonitor::SetListeningForShutdown(bool is_listening) {
if (is_listening) {
// unretained is OK because we own power_observer_linux_
@ -105,7 +105,7 @@ gin::ObjectTemplateBuilder PowerMonitor::GetObjectTemplateBuilder(
auto builder =
gin_helper::EventEmitterMixin<PowerMonitor>::GetObjectTemplateBuilder(
isolate);
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
builder.SetMethod("setListeningForShutdown",
&PowerMonitor::SetListeningForShutdown);
#endif

View file

@ -11,7 +11,7 @@
#include "shell/common/gin_helper/pinnable.h"
#include "ui/base/idle/idle.h"
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
#include "shell/browser/lib/power_observer_linux.h"
#endif
@ -41,14 +41,14 @@ class PowerMonitor : public gin::Wrappable<PowerMonitor>,
explicit PowerMonitor(v8::Isolate* isolate);
~PowerMonitor() override;
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
void SetListeningForShutdown(bool);
#endif
// Called by native calles.
bool ShouldShutdown();
#if defined(OS_MAC) || defined(OS_WIN)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
void InitPlatformSpecificMonitors();
#endif
@ -59,7 +59,7 @@ class PowerMonitor : public gin::Wrappable<PowerMonitor>,
void OnSuspend() override;
void OnResume() override;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
// Static callback invoked when a message comes in to our messaging window.
static LRESULT CALLBACK WndProcStatic(HWND hwnd,
UINT message,
@ -81,7 +81,7 @@ class PowerMonitor : public gin::Wrappable<PowerMonitor>,
HWND window_;
#endif
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
PowerObserverLinux power_observer_linux_{this};
#endif
};

View file

@ -20,7 +20,7 @@
#include "ui/display/screen.h"
#include "ui/gfx/geometry/point.h"
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
#include "ui/display/win/screen_win.h"
#endif
@ -90,7 +90,7 @@ display::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) {
return screen_->GetDisplayMatching(match_rect);
}
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
static gfx::Rect ScreenToDIPRect(electron::NativeWindow* window,
const gfx::Rect& rect) {
@ -153,7 +153,7 @@ gin::ObjectTemplateBuilder Screen::GetObjectTemplateBuilder(
.SetMethod("getPrimaryDisplay", &Screen::GetPrimaryDisplay)
.SetMethod("getAllDisplays", &Screen::GetAllDisplays)
.SetMethod("getDisplayNearestPoint", &Screen::GetDisplayNearestPoint)
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
.SetMethod("screenToDipPoint", &display::win::ScreenWin::ScreenToDIPPoint)
.SetMethod("dipToScreenPoint", &display::win::ScreenWin::DIPToScreenPoint)
.SetMethod("screenToDipRect", &ScreenToDIPRect)

View file

@ -20,13 +20,13 @@ namespace api {
gin::WrapperInfo SystemPreferences::kWrapperInfo = {gin::kEmbedderNativeGin};
SystemPreferences::SystemPreferences() {
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
InitializeWindow();
#endif
}
SystemPreferences::~SystemPreferences() {
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
Browser::Get()->RemoveObserver(this);
#endif
}
@ -63,16 +63,16 @@ gin::ObjectTemplateBuilder SystemPreferences::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return gin_helper::EventEmitterMixin<
SystemPreferences>::GetObjectTemplateBuilder(isolate)
#if defined(OS_WIN) || defined(OS_MAC)
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
.SetMethod("getColor", &SystemPreferences::GetColor)
.SetMethod("getAccentColor", &SystemPreferences::GetAccentColor)
.SetMethod("getMediaAccessStatus",
&SystemPreferences::GetMediaAccessStatus)
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
.SetMethod("isAeroGlassEnabled", &SystemPreferences::IsAeroGlassEnabled)
#elif defined(OS_MAC)
#elif BUILDFLAG(IS_MAC)
.SetMethod("postNotification", &SystemPreferences::PostNotification)
.SetMethod("subscribeNotification",
&SystemPreferences::SubscribeNotification)

View file

@ -15,7 +15,7 @@
#include "shell/common/gin_helper/error_thrower.h"
#include "shell/common/gin_helper/promise.h"
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
#include "shell/browser/browser.h"
#include "shell/browser/browser_observer.h"
#include "ui/gfx/sys_color_change_listener.h"
@ -25,7 +25,7 @@ namespace electron {
namespace api {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
enum class NotificationCenterKind {
kNSDistributedNotificationCenter = 0,
kNSNotificationCenter,
@ -36,7 +36,7 @@ enum class NotificationCenterKind {
class SystemPreferences
: public gin::Wrappable<SystemPreferences>,
public gin_helper::EventEmitterMixin<SystemPreferences>
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
,
public BrowserObserver,
public gfx::SysColorChangeListener
@ -51,14 +51,14 @@ class SystemPreferences
v8::Isolate* isolate) override;
const char* GetTypeName() override;
#if defined(OS_WIN) || defined(OS_MAC)
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
std::string GetAccentColor();
std::string GetColor(gin_helper::ErrorThrower thrower,
const std::string& color);
std::string GetMediaAccessStatus(gin_helper::ErrorThrower thrower,
const std::string& media_type);
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
bool IsAeroGlassEnabled();
void InitializeWindow();
@ -69,7 +69,7 @@ class SystemPreferences
// BrowserObserver:
void OnFinishLaunching(const base::DictionaryValue& launch_info) override;
#elif defined(OS_MAC)
#elif BUILDFLAG(IS_MAC)
using NotificationCallback = base::RepeatingCallback<
void(const std::string&, base::DictionaryValue, const std::string&)>;
@ -129,7 +129,7 @@ class SystemPreferences
SystemPreferences();
~SystemPreferences() override;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
int DoSubscribeNotification(const std::string& name,
const NotificationCallback& callback,
NotificationCenterKind kind);
@ -137,7 +137,7 @@ class SystemPreferences
#endif
private:
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
// Static callback invoked when a message comes in to our messaging window.
static LRESULT CALLBACK WndProcStatic(HWND hwnd,
UINT message,

View file

@ -82,7 +82,7 @@ gin::Handle<Tray> Tray::New(gin_helper::ErrorThrower thrower,
return gin::Handle<Tray>();
}
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
if (!guid.has_value() && args->Length() > 1) {
thrower.ThrowError("Invalid GUID format");
return gin::Handle<Tray>();
@ -196,7 +196,7 @@ void Tray::SetImage(v8::Isolate* isolate, v8::Local<v8::Value> image) {
if (!NativeImage::TryConvertNativeImage(isolate, image, &native_image))
return;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
tray_icon_->SetImage(native_image->GetHICON(GetSystemMetrics(SM_CXSMICON)));
#else
tray_icon_->SetImage(native_image->image());
@ -211,7 +211,7 @@ void Tray::SetPressedImage(v8::Isolate* isolate, v8::Local<v8::Value> image) {
if (!NativeImage::TryConvertNativeImage(isolate, image, &native_image))
return;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
tray_icon_->SetPressedImage(
native_image->GetHICON(GetSystemMetrics(SM_CXSMICON)));
#else
@ -230,7 +230,7 @@ void Tray::SetTitle(const std::string& title,
gin::Arguments* args) {
if (!CheckAlive())
return;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
TrayIcon::TitleOptions title_options;
if (options) {
if (options->Get("fontType", &title_options.font_type)) {
@ -258,7 +258,7 @@ void Tray::SetTitle(const std::string& title,
std::string Tray::GetTitle() {
if (!CheckAlive())
return std::string();
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
return tray_icon_->GetTitle();
#else
return "";
@ -268,7 +268,7 @@ std::string Tray::GetTitle() {
void Tray::SetIgnoreDoubleClickEvents(bool ignore) {
if (!CheckAlive())
return;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
tray_icon_->SetIgnoreDoubleClickEvents(ignore);
#endif
}
@ -276,7 +276,7 @@ void Tray::SetIgnoreDoubleClickEvents(bool ignore) {
bool Tray::GetIgnoreDoubleClickEvents() {
if (!CheckAlive())
return false;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
return tray_icon_->GetIgnoreDoubleClickEvents();
#else
return false;
@ -309,7 +309,7 @@ void Tray::DisplayBalloon(gin_helper::ErrorThrower thrower,
options.Get("respectQuietTime", &balloon_options.respect_quiet_time);
if (icon) {
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
balloon_options.icon = icon->GetHICON(
GetSystemMetrics(balloon_options.large_icon ? SM_CXICON : SM_CXSMICON));
#else

View file

@ -361,10 +361,12 @@ void SimpleURLLoaderWrapper::OnSSLCertificateError(
std::move(response).Run(net_error);
}
void SimpleURLLoaderWrapper::OnClearSiteData(const GURL& url,
const std::string& header_value,
int32_t load_flags,
OnClearSiteDataCallback callback) {
void SimpleURLLoaderWrapper::OnClearSiteData(
const GURL& url,
const std::string& header_value,
int32_t load_flags,
const absl::optional<net::CookiePartitionKey>& cookie_partition_key,
OnClearSiteDataCallback callback) {
std::move(callback).Run();
}
void SimpleURLLoaderWrapper::OnLoadingStateUpdate(

View file

@ -86,10 +86,12 @@ class SimpleURLLoaderWrapper
const scoped_refptr<net::SSLCertRequestInfo>& cert_info,
mojo::PendingRemote<network::mojom::ClientCertificateResponder>
client_cert_responder) override {}
void OnClearSiteData(const GURL& url,
const std::string& header_value,
int32_t load_flags,
OnClearSiteDataCallback callback) override;
void OnClearSiteData(
const GURL& url,
const std::string& header_value,
int32_t load_flags,
const absl::optional<net::CookiePartitionKey>& cookie_partition_key,
OnClearSiteDataCallback callback) override;
void OnLoadingStateUpdate(network::mojom::LoadInfoPtr info,
OnLoadingStateUpdateCallback callback) override;
void OnDataUseUpdate(int32_t network_traffic_annotation_id_hash,

View file

@ -14,7 +14,6 @@
#include "base/containers/id_map.h"
#include "base/files/file_util.h"
#include "base/ignore_result.h"
#include "base/json/json_reader.h"
#include "base/no_destructor.h"
#include "base/strings/utf_string_conversions.h"
@ -144,17 +143,17 @@
#include "shell/browser/osr/osr_web_contents_view.h"
#endif
#if !defined(OS_MAC)
#if !BUILDFLAG(IS_MAC)
#include "ui/aura/window.h"
#else
#include "ui/base/cocoa/defaults_utils.h"
#endif
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
#include "ui/views/linux_ui/linux_ui.h"
#endif
#if defined(OS_LINUX) || defined(OS_WIN)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
#include "ui/gfx/font_render_params.h"
#endif
@ -172,7 +171,7 @@
#include "shell/browser/printing/print_preview_message_handler.h"
#include "shell/browser/printing/print_view_manager_electron.h"
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
#include "printing/backend/win_helper.h"
#endif
#endif
@ -390,14 +389,14 @@ void OnCapturePageDone(gin_helper::Promise<gfx::Image> promise,
}
absl::optional<base::TimeDelta> GetCursorBlinkInterval() {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
base::TimeDelta interval;
if (ui::TextInsertionCaretBlinkPeriod(&interval))
return interval;
#elif defined(OS_LINUX)
#elif BUILDFLAG(IS_LINUX)
if (auto* linux_ui = views::LinuxUI::instance())
return linux_ui->GetCursorBlinkInterval();
#elif defined(OS_WIN)
#elif BUILDFLAG(IS_WIN)
const auto system_msec = ::GetCaretBlinkTime();
if (system_msec != 0) {
return (system_msec == INFINITE) ? base::TimeDelta()
@ -412,14 +411,14 @@ absl::optional<base::TimeDelta> GetCursorBlinkInterval() {
// found on the network. We need to check this because Chromium does not do
// sanity checking of device_name validity and so will crash on invalid names.
bool IsDeviceNameValid(const std::u16string& device_name) {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
base::ScopedCFTypeRef<CFStringRef> new_printer_id(
base::SysUTF16ToCFStringRef(device_name));
PMPrinter new_printer = PMPrinterCreateFromPrinterID(new_printer_id.get());
bool printer_exists = new_printer != nullptr;
PMRelease(new_printer);
return printer_exists;
#elif defined(OS_WIN)
#elif BUILDFLAG(IS_WIN)
printing::ScopedPrinterHandle printer;
return printer.OpenPrinterWithName(base::as_wcstr(device_name));
#else
@ -428,7 +427,7 @@ bool IsDeviceNameValid(const std::u16string& device_name) {
}
std::pair<std::string, std::u16string> GetDefaultPrinterAsync() {
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
// Blocking is needed here because Windows printer drivers are oftentimes
// not thread-safe and have to be accessed on the UI thread.
base::ThreadRestrictions::ScopedAllowIO allow_io;
@ -463,7 +462,7 @@ std::pair<std::string, std::u16string> GetDefaultPrinterAsync() {
// chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc:L36-L54
scoped_refptr<base::TaskRunner> CreatePrinterHandlerTaskRunner() {
// USER_VISIBLE because the result is displayed in the print preview dialog.
#if !defined(OS_WIN)
#if !BUILDFLAG(IS_WIN)
static constexpr base::TaskTraits kTraits = {
base::MayBlock(), base::TaskPriority::USER_VISIBLE};
#endif
@ -471,7 +470,7 @@ scoped_refptr<base::TaskRunner> CreatePrinterHandlerTaskRunner() {
#if defined(USE_CUPS)
// CUPS is thread safe.
return base::ThreadPool::CreateTaskRunner(kTraits);
#elif defined(OS_WIN)
#elif BUILDFLAG(IS_WIN)
// Windows drivers are likely not thread-safe and need to be accessed on the
// UI thread.
return content::GetUIThreadTaskRunner(
@ -579,15 +578,17 @@ PrefService* GetPrefService(content::WebContents* web_contents) {
std::map<std::string, std::string> GetAddedFileSystemPaths(
content::WebContents* web_contents) {
auto* pref_service = GetPrefService(web_contents);
const base::DictionaryValue* file_system_paths_value =
const base::Value* file_system_paths_value =
pref_service->GetDictionary(prefs::kDevToolsFileSystemPaths);
std::map<std::string, std::string> result;
if (file_system_paths_value) {
base::DictionaryValue::Iterator it(*file_system_paths_value);
for (; !it.IsAtEnd(); it.Advance()) {
const base::DictionaryValue* file_system_paths_dict;
file_system_paths_value->GetAsDictionary(&file_system_paths_dict);
for (auto it : file_system_paths_dict->DictItems()) {
std::string type =
it.value().is_string() ? it.value().GetString() : std::string();
result[it.key()] = type;
it.second.is_string() ? it.second.GetString() : std::string();
result[it.first] = type;
}
}
return result;
@ -826,7 +827,7 @@ void WebContents::InitWithSessionAndOptions(
accept_languages.pop_back();
prefs->accept_languages = accept_languages;
#if defined(OS_LINUX) || defined(OS_WIN)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
// Update font settings.
static const gfx::FontRenderParams params(
gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr));
@ -1213,7 +1214,7 @@ bool WebContents::HandleKeyboardEvent(
}
}
#if !defined(OS_MAC)
#if !BUILDFLAG(IS_MAC)
// NOTE: The macOS version of this function is found in
// electron_api_web_contents_mac.mm, as it requires calling into objective-C
// code.
@ -1850,7 +1851,7 @@ void WebContents::ReadyToCommitNavigation(
// Don't focus content in an inactive window.
if (!owner_window())
return;
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
if (!owner_window()->IsActive())
return;
#else
@ -2347,7 +2348,7 @@ void WebContents::ForcefullyCrashRenderer() {
content::RenderProcessHost* rph = rwh->GetProcess();
if (rph) {
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
// A generic |CrashDumpHungChildProcess()| is not implemented for Linux.
// Instead we send an explicit IPC to crash on the renderer's IO thread.
rph->ForceCrash();
@ -2907,7 +2908,7 @@ void WebContents::StopFindInPage(content::StopFindAction action) {
}
void WebContents::ShowDefinitionForSelection() {
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
auto* const view = web_contents()->GetRenderWidgetHostView();
if (view)
view->ShowDefinitionForSelection();
@ -2923,14 +2924,14 @@ void WebContents::CopyImageAt(int x, int y) {
void WebContents::Focus() {
// Focusing on WebContents does not automatically focus the window on macOS
// and Linux, do it manually to match the behavior on Windows.
#if defined(OS_MAC) || defined(OS_LINUX)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
if (owner_window())
owner_window()->Focus(true);
#endif
web_contents()->Focus();
}
#if !defined(OS_MAC)
#if !BUILDFLAG(IS_MAC)
bool WebContents::IsFocused() const {
auto* view = web_contents()->GetRenderWidgetHostView();
if (!view)
@ -3077,7 +3078,7 @@ v8::Local<v8::Promise> WebContents::CapturePage(gin::Arguments* args) {
return handle;
}
#if !defined(OS_MAC)
#if !BUILDFLAG(IS_MAC)
// If the view's renderer is suspended this may fail on Windows/Linux -
// bail if so. See CopyFromSurface in
// content/public/browser/render_widget_host_view.h.
@ -3087,7 +3088,7 @@ v8::Local<v8::Promise> WebContents::CapturePage(gin::Arguments* args) {
promise.Resolve(gfx::Image());
return handle;
}
#endif // defined(OS_MAC)
#endif // BUILDFLAG(IS_MAC)
// Capture full page if user doesn't specify a |rect|.
const gfx::Size view_size =
@ -3121,8 +3122,8 @@ void WebContents::IncrementCapturerCount(gin::Arguments* args) {
// get stayAwake arguments if they exist
args->GetNext(&stay_awake);
ignore_result(
web_contents()->IncrementCapturerCount(size, stay_hidden, stay_awake));
std::ignore =
web_contents()->IncrementCapturerCount(size, stay_hidden, stay_awake);
}
void WebContents::DecrementCapturerCount(gin::Arguments* args) {
@ -3644,8 +3645,7 @@ void WebContents::DevToolsAddFileSystem(
auto* pref_service = GetPrefService(GetDevToolsWebContents());
DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
update.Get()->SetWithoutPathExpansion(path.AsUTF8Unsafe(),
std::make_unique<base::Value>(type));
update.Get()->SetKey(path.AsUTF8Unsafe(), base::Value(type));
inspectable_web_contents_->CallClientFunction(
"DevToolsAPI.fileSystemAdded", nullptr, file_system_value.get(), nullptr);
}
@ -3750,13 +3750,13 @@ void WebContents::ColorPickedInEyeDropper(int r, int g, int b, int a) {
"DevToolsAPI.eyeDropperPickedColor", &color, nullptr, nullptr);
}
#if defined(TOOLKIT_VIEWS) && !defined(OS_MAC)
#if defined(TOOLKIT_VIEWS) && !BUILDFLAG(IS_MAC)
ui::ImageModel WebContents::GetDevToolsWindowIcon() {
return owner_window() ? owner_window()->GetWindowAppIcon() : ui::ImageModel{};
}
#endif
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
void WebContents::GetDevToolsWindowWMClass(std::string* name,
std::string* class_name) {
*class_name = Browser::Get()->GetName();

View file

@ -715,10 +715,10 @@ class WebContents : public ExclusiveAccessContext,
void DevToolsSetEyeDropperActive(bool active) override;
// InspectableWebContentsViewDelegate:
#if defined(TOOLKIT_VIEWS) && !defined(OS_MAC)
#if defined(TOOLKIT_VIEWS) && !BUILDFLAG(IS_MAC)
ui::ImageModel GetDevToolsWindowIcon() override;
#endif
#if defined(OS_LINUX)
#if BUILDFLAG(IS_LINUX)
void GetDevToolsWindowWMClass(std::string* name,
std::string* class_name) override;
#endif

View file

@ -15,7 +15,7 @@
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
#include "shell/browser/ui/cocoa/delayed_native_view_host.h"
#endif
@ -25,7 +25,7 @@ namespace api {
WebContentsView::WebContentsView(v8::Isolate* isolate,
gin::Handle<WebContents> web_contents)
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
: View(new DelayedNativeViewHost(web_contents->inspectable_web_contents()
->GetView()
->GetNativeView())),
@ -34,7 +34,7 @@ WebContentsView::WebContentsView(v8::Isolate* isolate,
#endif
web_contents_(isolate, web_contents.ToV8()),
api_web_contents_(web_contents.get()) {
#if !defined(OS_MAC)
#if !BUILDFLAG(IS_MAC)
// On macOS the View is a newly-created |DelayedNativeViewHost| and it is our
// responsibility to delete it. On other platforms the View is created and
// managed by InspectableWebContents.

View file

@ -69,8 +69,8 @@ void GPUInfoEnumerator::BeginVideoDecodeAcceleratorSupportedProfile() {
void GPUInfoEnumerator::EndVideoDecodeAcceleratorSupportedProfile() {
auto& top_value = value_stack.top();
top_value->SetDictionary(kVideoDecodeAcceleratorSupportedProfileKey,
std::move(current));
top_value->SetKey(kVideoDecodeAcceleratorSupportedProfileKey,
base::Value::FromUniquePtrValue(std::move(current)));
current = std::move(top_value);
value_stack.pop();
}
@ -82,8 +82,8 @@ void GPUInfoEnumerator::BeginVideoEncodeAcceleratorSupportedProfile() {
void GPUInfoEnumerator::EndVideoEncodeAcceleratorSupportedProfile() {
auto& top_value = value_stack.top();
top_value->SetDictionary(kVideoEncodeAcceleratorSupportedProfileKey,
std::move(current));
top_value->SetKey(kVideoEncodeAcceleratorSupportedProfileKey,
base::Value::FromUniquePtrValue(std::move(current)));
current = std::move(top_value);
value_stack.pop();
}
@ -95,8 +95,8 @@ void GPUInfoEnumerator::BeginImageDecodeAcceleratorSupportedProfile() {
void GPUInfoEnumerator::EndImageDecodeAcceleratorSupportedProfile() {
auto& top_value = value_stack.top();
top_value->SetDictionary(kImageDecodeAcceleratorSupportedProfileKey,
std::move(current));
top_value->SetKey(kImageDecodeAcceleratorSupportedProfileKey,
base::Value::FromUniquePtrValue(std::move(current)));
current = std::move(top_value);
value_stack.pop();
}
@ -108,7 +108,8 @@ void GPUInfoEnumerator::BeginAuxAttributes() {
void GPUInfoEnumerator::EndAuxAttributes() {
auto& top_value = value_stack.top();
top_value->SetDictionary(kAuxAttributesKey, std::move(current));
top_value->SetKey(kAuxAttributesKey,
base::Value::FromUniquePtrValue(std::move(current)));
current = std::move(top_value);
value_stack.pop();
}
@ -120,7 +121,8 @@ void GPUInfoEnumerator::BeginOverlayInfo() {
void GPUInfoEnumerator::EndOverlayInfo() {
auto& top_value = value_stack.top();
top_value->SetDictionary(kOverlayInfo, std::move(current));
top_value->SetKey(kOverlayInfo,
base::Value::FromUniquePtrValue(std::move(current)));
current = std::move(top_value);
value_stack.pop();
}

View file

@ -31,7 +31,7 @@ GPUInfoManager::~GPUInfoManager() {
// Based on
// https://chromium.googlesource.com/chromium/src.git/+/69.0.3497.106/content/browser/gpu/gpu_data_manager_impl_private.cc#838
bool GPUInfoManager::NeedsCompleteGpuInfoCollection() const {
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
return gpu_data_manager_->DxdiagDx12VulkanRequested() &&
gpu_data_manager_->GetGPUInfo().dx_diagnostics.IsEmpty();
#else

View file

@ -9,14 +9,14 @@
#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include <psapi.h>
#include "base/win/win_util.h"
#endif
#if defined(OS_MAC)
#if BUILDFLAG(IS_MAC)
#include <mach/mach.h>
#include "base/process/port_provider_mac.h"
#include "content/public/browser/browser_child_process_host.h"
@ -46,7 +46,7 @@ absl::optional<mach_task_basic_info_data_t> GetTaskInfo(mach_port_t task) {
} // namespace
#endif // defined(OS_MAC)
#endif // BUILDFLAG(IS_MAC)
namespace electron {
@ -60,7 +60,7 @@ ProcessMetric::ProcessMetric(int type,
this->service_name = service_name;
this->name = name;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
HANDLE duplicate_handle = INVALID_HANDLE_VALUE;
::DuplicateHandle(::GetCurrentProcess(), handle, ::GetCurrentProcess(),
&duplicate_handle, 0, false, DUPLICATE_SAME_ACCESS);
@ -72,7 +72,7 @@ ProcessMetric::ProcessMetric(int type,
ProcessMetric::~ProcessMetric() = default;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
ProcessMemoryInfo ProcessMetric::GetMemoryInfo() const {
ProcessMemoryInfo result;
@ -146,7 +146,7 @@ bool ProcessMetric::IsSandboxed(ProcessIntegrityLevel integrity_level) {
integrity_level < ProcessIntegrityLevel::kMedium;
}
#elif defined(OS_MAC)
#elif BUILDFLAG(IS_MAC)
ProcessMemoryInfo ProcessMetric::GetMemoryInfo() const {
ProcessMemoryInfo result;
@ -167,6 +167,6 @@ bool ProcessMetric::IsSandboxed() const {
#endif
}
#endif // defined(OS_MAC)
#endif // BUILDFLAG(IS_MAC)
} // namespace electron

View file

@ -14,17 +14,17 @@
namespace electron {
#if !defined(OS_LINUX)
#if !BUILDFLAG(IS_LINUX)
struct ProcessMemoryInfo {
size_t working_set_size = 0;
size_t peak_working_set_size = 0;
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
size_t private_bytes = 0;
#endif
};
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
enum class ProcessIntegrityLevel {
kUnknown,
kUntrusted,
@ -48,14 +48,14 @@ struct ProcessMetric {
const std::string& name = std::string());
~ProcessMetric();
#if !defined(OS_LINUX)
#if !BUILDFLAG(IS_LINUX)
ProcessMemoryInfo GetMemoryInfo() const;
#endif
#if defined(OS_WIN)
#if BUILDFLAG(IS_WIN)
ProcessIntegrityLevel GetIntegrityLevel() const;
static bool IsSandboxed(ProcessIntegrityLevel integrity_level);
#elif defined(OS_MAC)
#elif BUILDFLAG(IS_MAC)
bool IsSandboxed() const;
#endif
};