electron/shell/common/api/electron_api_command_line.cc
electron-roller[bot] e5d3fbf6dc
chore: bump chromium to 147.0.7699.0 (main) (#49831)
* chore: bump chromium in DEPS to 147.0.7693.0

* chore: bump chromium in DEPS to 147.0.7694.0

* chore: bump chromium in DEPS to 147.0.7695.0

* chore: bump chromium in DEPS to 147.0.7697.0

* chore: bump chromium in DEPS to 147.0.7698.0

* fix(patch): IsGuest moved to SecurityPrincipal

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7234613

Co-Authored-By: Claude (claude-opus-4-6)

* chore: update patches (trivial only)

* fix(patch): v8::External API now requires ExternalPointerTypeTag

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/7562476

Co-Authored-By: Claude (claude-opus-4-6)

* fix: update CreateCustomWebContents signature

Upstream added disposition and window_features parameters.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7585256

Co-Authored-By: Claude (claude-opus-4-6)

* fix: OriginatingProcess renamed to OriginatingProcessId

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7557820

Co-Authored-By: Claude (claude-opus-4-6)

* fix: kLogNetLog moved from network::switches to net::switches

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7559090

Co-Authored-By: Claude (claude-opus-4-6)

* fix(patch): patch out glic and save-to-drive Profile usage in PDF

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7589312

Co-Authored-By: Claude (claude-opus-4-6)

* chore: bump chromium in DEPS to 147.0.7699.0

* chore: remove upstreamed pseudonymization salt descriptor code

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7568382

Co-Authored-By: Claude (claude-opus-4-6)

* chore: update patches (trivial only)

* chore: update reclient patch format (copy-from to new-file)

Co-Authored-By: Claude (claude-opus-4-6)

* chore: remove upstreamed patch and update stale patches

Co-Authored-By: Claude (claude-opus-4-6)

* fix: expose GetLibGdk3 and guard glic function body

GetLibGdk3 needs to be public for Electron's gdk_display_beep usage.
ShouldShowGlicSummarizeButton body must be guarded, not just call site.

Co-Authored-By: Claude (claude-opus-4-6)

* fix(patch): v8::External API in nan requires ExternalPointerTypeTag

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/7562476

Co-Authored-By: Claude (claude-opus-4-6)

* fixup fix(patch): v8::External API in nan requires ExternalPointerTypeTag

* fixup: remove extraneous changes to patches

Caused by
https://github.com/electron/electron/pull/49831/changes/debb371681a0ac44ba16476e2e80f1d10a6004be
https://github.com/electron/electron/pull/49831/changes/6e51034728eab9145a7c2f6e7b84d4df7c54b4ae

* fixup: revert fix: expose GetLibGdk3 and guard glic function body

Reverts https://github.com/electron/electron/pull/49831/changes/6e51034728eab9145a7c2f6e7b84d4df7c54b4ae as this was an unneeded changed caused by the incorrect changes made in https://github.com/electron/electron/pull/49831/changes/debb371681a0ac44ba16476e2e80f1d10a6004be

* 7586673: Update logic for showing pdf summarize button

7586673: Update logic for showing pdf summarize button | https://chromium-review.googlesource.com/c/chromium/src/+/7586673

Also 7454131: set enable_glic=true | https://chromium-review.googlesource.com/c/chromium/src/+/7454131 (landed in previous roll)

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Alice Zhao <alicelovescake@anthropic.com>
Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>
2026-02-24 16:42:05 -05:00

78 lines
2.7 KiB
C++

// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/strings/string_util.h"
#include "net/base/switches.h"
#include "shell/common/gin_converters/base_converter.h"
#include "shell/common/gin_converters/file_path_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"
#include "third_party/abseil-cpp/absl/strings/ascii.h"
namespace {
bool HasSwitch(const std::string& switch_string) {
auto switch_str = base::ToLowerASCII(switch_string);
auto* command_line = base::CommandLine::ForCurrentProcess();
return command_line->HasSwitch(switch_str);
}
base::CommandLine::StringType GetSwitchValue(gin_helper::ErrorThrower thrower,
const std::string& switch_string) {
auto switch_str = base::ToLowerASCII(switch_string);
auto* command_line = base::CommandLine::ForCurrentProcess();
return command_line->GetSwitchValueNative(switch_str);
}
void AppendSwitch(const std::string& switch_string,
gin::Arguments* const args) {
auto switch_str = base::ToLowerASCII(switch_string);
auto* command_line = base::CommandLine::ForCurrentProcess();
if (base::EndsWith(switch_string, "-path",
base::CompareCase::INSENSITIVE_ASCII) ||
switch_string == net::switches::kLogNetLog) {
base::FilePath path;
args->GetNext(&path);
command_line->AppendSwitchPath(switch_str, path);
return;
}
base::CommandLine::StringType value;
if (args->GetNext(&value))
command_line->AppendSwitchNative(switch_str, value);
else
command_line->AppendSwitch(switch_str);
}
void RemoveSwitch(const std::string& switch_string) {
auto switch_str = base::ToLowerASCII(switch_string);
auto* command_line = base::CommandLine::ForCurrentProcess();
command_line->RemoveSwitch(switch_str);
}
void AppendArg(const std::string& arg) {
auto* command_line = base::CommandLine::ForCurrentProcess();
command_line->AppendArg(arg);
}
void Initialize(v8::Local<v8::Object> exports,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context,
void* priv) {
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
gin_helper::Dictionary dict{isolate, exports};
dict.SetMethod("hasSwitch", &HasSwitch);
dict.SetMethod("getSwitchValue", &GetSwitchValue);
dict.SetMethod("appendSwitch", &AppendSwitch);
dict.SetMethod("removeSwitch", &RemoveSwitch);
dict.SetMethod("appendArgument", &AppendArg);
}
} // namespace
NODE_LINKED_BINDING_CONTEXT_AWARE(electron_common_command_line, Initialize)