chore: bump chromium to 121.0.6147.0 (main) (#40523)

* chore: bump chromium in DEPS to 121.0.6128.0

* build: update patches

* refactor: remove instrumentation from extensions code

Ref: 5002404

* refactor: modernization of tabs_api

Ref: 4997031

* fix: add RecordHover and RecordDrag handlers

* build: add missing pdf files

* chore: bump chromium in DEPS to 121.0.6129.0

* chore: bump chromium in DEPS to 121.0.6131.0

* chore: update patches

* refactor: remove will_cause_resize from ExitFullscreen

Ref: 5031312

* chore: add missing std converter include

Before these were being inferred as std::string implicitly, not anymore
Ref: 5029573

* chore: Unwrap UserScriptList from unique_ptrs

Ref: 5005198

* refactor: add PDF internal id into PDF stream info

Ref: 4876972

* refactor: add metadata to view classes

Ref: 4994885

* chore: run lint --fix

* chore: update libc++ filenames

* chore: clean up menubar

* chore: update patches after main merge

* 5010979: Replace base::WStringPiece usage with std::wstring_view | 5010979

* chore: bump chromium in DEPS to 121.0.6142.0

* chore: update patches

* 4969574: Refactor NativeDesktopMediaList | 4969574

* 5031192: [blink] Create new blink test suite that doesn't create blink Isolate | 5031192

* chore: update v8/devtools patches

* 5040722: [base] Replace MakeFixedFlatTreeSorted with tag type overloads | 5040722

* 5026474: Add --generate-pdf-document-outline | 5026474

* 5024297: Change parameter of CheckMediaAccessPermission from GURL to URL::Origin | 5024297

* 5034217: [RWS] Remove CanonicalCookie::IsSameParty method | 5034217

* 5037192: Rewrite usage of RenderFrame::GetRoutingID | 5037192

* 5041802: Reland "Incorporate policy override for OOPPD feature" | 5041802

* chore: bump chromium in DEPS to 121.0.6143.0

* chore: bump chromium in DEPS to 121.0.6145.0

* chore: update chromium patches

* 5049986: Use std::unique_ptr for MenuItemView::submenu_ member. | 5049986

* 5041595: picture-in-picture: Add PictureInPictureOcclusionTracker | 5041595

* chore: update all patches

* chore: bump chromium in DEPS to 121.0.6147.0

* chore: update patches

* 5051069: Use base::FunctionRef for BrowserPluginGuestManager. | 5051069

* 5057330: [base] Remove base::Erase()/base::EraseIf() overloads for std::set | 5057330

* fixup! 5041802: Reland "Incorporate policy override for OOPPD feature" | 5041802

* 5017518: Remove PPAPI if NaCl is disabled | 5017518

* 5002232: [DevTools] Console Insights: move from build flag to Feature API | 5002232

* 4970322: [X11] Move utils into x11::Connection | 4970322

* 5048950: Let MenuModelAdapter::CreateMenu return a std::unique_ptr<>. | 5048950

* chore: update libcxx filenames

* use Context::Scope in RunScriptsAtDocument{Start,End}

* 4775128: content: Reuse CC instance for main frame navigations

4775128

* also wrap WebWorkerObserver::ContextWillDestroy with Context::Scope

* set LIBCPP_HARDENING_MODE

5014271

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
This commit is contained in:
electron-roller[bot] 2023-11-28 13:40:12 -08:00 committed by GitHub
parent f0f027c06d
commit 5c7579ab1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
132 changed files with 701 additions and 660 deletions

View file

@ -54,14 +54,13 @@ namespace {
// See https://nodejs.org/api/cli.html#cli_options
void ExitIfContainsDisallowedFlags(const std::vector<std::string>& argv) {
// Options that are unilaterally disallowed.
static constexpr auto disallowed =
base::MakeFixedFlatSetSorted<base::StringPiece>({
"--enable-fips",
"--force-fips",
"--openssl-config",
"--use-bundled-ca",
"--use-openssl-ca",
});
static constexpr auto disallowed = base::MakeFixedFlatSet<base::StringPiece>({
"--enable-fips",
"--force-fips",
"--openssl-config",
"--use-bundled-ca",
"--use-openssl-ca",
});
for (const auto& arg : argv) {
const auto key = base::StringPiece(arg).substr(0, arg.find('='));

View file

@ -157,7 +157,7 @@ struct Converter<JumpListItem::Type> {
private:
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, JumpListItem::Type>({
base::MakeFixedFlatMap<base::StringPiece, JumpListItem::Type>({
{"file", JumpListItem::Type::kFile},
{"separator", JumpListItem::Type::kSeparator},
{"task", JumpListItem::Type::kTask},
@ -248,7 +248,7 @@ struct Converter<JumpListCategory::Type> {
private:
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, JumpListCategory::Type>({
base::MakeFixedFlatMap<base::StringPiece, JumpListCategory::Type>({
{"custom", JumpListCategory::Type::kCustom},
{"frequent", JumpListCategory::Type::kFrequent},
{"recent", JumpListCategory::Type::kRecent},
@ -414,7 +414,7 @@ struct Converter<net::SecureDnsMode> {
v8::Local<v8::Value> val,
net::SecureDnsMode* out) {
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, net::SecureDnsMode>({
base::MakeFixedFlatMap<base::StringPiece, net::SecureDnsMode>({
{"automatic", net::SecureDnsMode::kAutomatic},
{"off", net::SecureDnsMode::kOff},
{"secure", net::SecureDnsMode::kSecure},
@ -442,7 +442,7 @@ IconLoader::IconSize GetIconSizeByString(const std::string& size) {
// Return the path constant from string.
int GetPathConstant(base::StringPiece name) {
// clang-format off
constexpr auto Lookup = base::MakeFixedFlatMapSorted<base::StringPiece, int>({
constexpr auto Lookup = base::MakeFixedFlatMap<base::StringPiece, int>({
{"appData", DIR_APP_DATA},
#if BUILDFLAG(IS_POSIX)
{"cache", base::DIR_CACHE},

View file

@ -246,7 +246,7 @@ void BrowserWindow::OnWindowIsKeyChanged(bool is_key) {
void BrowserWindow::OnWindowLeaveFullScreen() {
#if BUILDFLAG(IS_MAC)
if (web_contents()->IsFullscreen())
web_contents()->ExitFullscreen(true);
web_contents()->ExitFullscreen();
#endif
BaseWindow::OnWindowLeaveFullScreen();
}

View file

@ -306,9 +306,6 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
}
bool secure = details.FindBool("secure").value_or(
same_site == net::CookieSameSite::NO_RESTRICTION);
bool same_party =
details.FindBool("sameParty")
.value_or(secure && same_site != net::CookieSameSite::STRICT_MODE);
GURL url(url_string ? *url_string : "");
if (!url.is_valid()) {
@ -324,8 +321,8 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
path ? *path : "", ParseTimeProperty(details.FindDouble("creationDate")),
ParseTimeProperty(details.FindDouble("expirationDate")),
ParseTimeProperty(details.FindDouble("lastAccessDate")), secure,
http_only, same_site, net::COOKIE_PRIORITY_DEFAULT, same_party,
absl::nullopt, &status);
http_only, same_site, net::COOKIE_PRIORITY_DEFAULT, absl::nullopt,
&status);
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
promise.RejectWithErrorMessage(InclusionStatusToString(

View file

@ -50,11 +50,12 @@
#if BUILDFLAG(IS_LINUX)
// Private function in ui/base/x/x11_display_util.cc
std::map<x11::RandR::Output, int> GetMonitors(int version,
x11::RandR* randr,
x11::Window window) {
std::map<x11::RandR::Output, int> GetMonitors(
std::pair<uint32_t, uint32_t> version,
x11::RandR* randr,
x11::Window window) {
std::map<x11::RandR::Output, int> output_to_monitor;
if (version >= 105) {
if (version >= std::pair<uint32_t, uint32_t>{1, 5}) {
if (auto reply = randr->GetMonitors({window}).Sync()) {
for (size_t monitor = 0; monitor < reply->monitors.size(); monitor++) {
for (x11::RandR::Output output : reply->monitors[monitor].outputs)
@ -87,7 +88,6 @@ std::map<int32_t, uint32_t> MonitorAtomIdToDisplayId() {
auto* connection = x11::Connection::Get();
auto& randr = connection->randr();
auto x_root_window = ui::GetX11RootWindow();
int version = ui::GetXrandrVersion();
std::map<int32_t, uint32_t> monitor_atom_to_display;
@ -98,7 +98,7 @@ std::map<int32_t, uint32_t> MonitorAtomIdToDisplayId() {
}
std::map<x11::RandR::Output, int> output_to_monitor =
GetMonitors(version, &randr, x_root_window);
GetMonitors(connection->randr_version(), &randr, x_root_window);
auto monitors_reply = randr.GetMonitors({x_root_window}).Sync();
for (size_t i = 0; i < resources->outputs.size(); i++) {

View file

@ -99,7 +99,7 @@ std::string SystemPreferences::GetAccentColor() {
std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower,
const std::string& color) {
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, int>({
base::MakeFixedFlatMap<base::StringPiece, int>({
{"3d-dark-shadow", COLOR_3DDKSHADOW},
{"3d-face", COLOR_3DFACE},
{"3d-highlight", COLOR_3DHIGHLIGHT},

View file

@ -32,7 +32,7 @@ struct Converter<electron::TrayIcon::IconType> {
electron::TrayIcon::IconType* out) {
using Val = electron::TrayIcon::IconType;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"custom", Val::kCustom},
{"error", Val::kError},
{"info", Val::kInfo},

View file

@ -64,7 +64,7 @@ struct Converter<network::mojom::CredentialsMode> {
network::mojom::CredentialsMode* out) {
using Val = network::mojom::CredentialsMode;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"include", Val::kInclude},
{"omit", Val::kOmit},
// Note: This only makes sense if the request
@ -82,7 +82,7 @@ struct Converter<blink::mojom::FetchCacheMode> {
blink::mojom::FetchCacheMode* out) {
using Val = blink::mojom::FetchCacheMode;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"default", Val::kDefault},
{"force-cache", Val::kForceCache},
{"no-cache", Val::kValidateCache},
@ -102,7 +102,7 @@ struct Converter<net::ReferrerPolicy> {
using Val = net::ReferrerPolicy;
// clang-format off
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"", Val::REDUCE_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN},
{"no-referrer", Val::NO_REFERRER},
{"no-referrer-when-downgrade", Val::CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE},
@ -535,7 +535,7 @@ gin::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create(
if (std::string mode; opts.Get("mode", &mode)) {
using Val = network::mojom::RequestMode;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"cors", Val::kCors},
{"navigate", Val::kNavigate},
{"no-cors", Val::kNoCors},
@ -548,7 +548,7 @@ gin::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create(
if (std::string destination; opts.Get("destination", &destination)) {
using Val = network::mojom::RequestDestination;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"audio", Val::kAudio},
{"audioworklet", Val::kAudioWorklet},
{"document", Val::kDocument},

View file

@ -206,7 +206,7 @@ struct Converter<printing::mojom::MarginType> {
printing::mojom::MarginType* out) {
using Val = printing::mojom::MarginType;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"custom", Val::kCustomMargins},
{"default", Val::kDefaultMargins},
{"none", Val::kNoMargins},
@ -223,7 +223,7 @@ struct Converter<printing::mojom::DuplexMode> {
printing::mojom::DuplexMode* out) {
using Val = printing::mojom::DuplexMode;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"longEdge", Val::kLongEdge},
{"shortEdge", Val::kShortEdge},
{"simplex", Val::kSimplex},
@ -270,7 +270,7 @@ struct Converter<content::SavePageType> {
content::SavePageType* out) {
using Val = content::SavePageType;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"htmlcomplete", Val::SAVE_PAGE_TYPE_AS_COMPLETE_HTML},
{"htmlonly", Val::SAVE_PAGE_TYPE_AS_ONLY_HTML},
{"mhtml", Val::SAVE_PAGE_TYPE_AS_MHTML},
@ -315,7 +315,7 @@ struct Converter<electron::api::WebContents::Type> {
electron::api::WebContents::Type* out) {
using Val = electron::api::WebContents::Type;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"backgroundPage", Val::kBackgroundPage},
{"browserView", Val::kBrowserView},
{"offscreen", Val::kOffScreen},
@ -1567,7 +1567,7 @@ void WebContents::CancelKeyboardLockRequest(
bool WebContents::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
const url::Origin& security_origin,
blink::mojom::MediaStreamType type) {
auto* web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);
@ -3124,6 +3124,8 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) {
auto footer_template = *settings.GetDict().FindString("footerTemplate");
auto prefer_css_page_size = settings.GetDict().FindBool("preferCSSPageSize");
auto generate_tagged_pdf = settings.GetDict().FindBool("generateTaggedPDF");
auto generate_document_outline =
settings.GetDict().FindBool("generateDocumentOutline");
absl::variant<printing::mojom::PrintPagesParamsPtr, std::string>
print_pages_params = print_to_pdf::GetPrintPagesParams(
@ -3132,7 +3134,7 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) {
paper_width, paper_height, margin_top, margin_bottom, margin_left,
margin_right, absl::make_optional(header_template),
absl::make_optional(footer_template), prefer_css_page_size,
generate_tagged_pdf);
generate_tagged_pdf, generate_document_outline);
if (absl::holds_alternative<std::string>(print_pages_params)) {
auto error = absl::get<std::string>(print_pages_params);
@ -4209,12 +4211,11 @@ void WebContents::UpdateHtmlApiFullscreen(bool fullscreen) {
// Make sure all child webviews quit html fullscreen.
if (!fullscreen && !IsGuest()) {
auto* manager = WebViewManager::GetWebViewManager(web_contents());
manager->ForEachGuest(
web_contents(), base::BindRepeating([](content::WebContents* guest) {
WebContents* api_web_contents = WebContents::From(guest);
api_web_contents->SetHtmlApiFullscreen(false);
return false;
}));
manager->ForEachGuest(web_contents(), [&](content::WebContents* guest) {
WebContents* api_web_contents = WebContents::From(guest);
api_web_contents->SetHtmlApiFullscreen(false);
return false;
});
}
}

View file

@ -583,7 +583,7 @@ class WebContents : public ExclusiveAccessContext,
bool esc_key_locked) override;
void CancelKeyboardLockRequest(content::WebContents* web_contents) override;
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
const url::Origin& security_origin,
blink::mojom::MediaStreamType type) override;
void RequestMediaAccessPermission(
content::WebContents* web_contents,

View file

@ -33,8 +33,8 @@
#include "shell/common/gin_helper/dictionary.h"
static constexpr auto ResourceTypes =
base::MakeFixedFlatMapSorted<base::StringPiece,
extensions::WebRequestResourceType>({
base::MakeFixedFlatMap<base::StringPiece,
extensions::WebRequestResourceType>({
{"cspReport", extensions::WebRequestResourceType::CSP_REPORT},
{"font", extensions::WebRequestResourceType::FONT},
{"image", extensions::WebRequestResourceType::IMAGE},

View file

@ -1037,7 +1037,6 @@ blink::UserAgentMetadata ElectronBrowserClient::GetUserAgentMetadata() {
void ElectronBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id,
ukm::SourceIdObj ukm_source_id,
NonNetworkURLLoaderFactoryMap* factories) {
content::WebContents* web_contents =
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
@ -1046,8 +1045,7 @@ void ElectronBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
factories->emplace(
extensions::kExtensionScheme,
extensions::CreateExtensionNavigationURLLoaderFactory(
context, ukm_source_id,
false /* we don't support extensions::WebViewGuest */));
context, false /* we don't support extensions::WebViewGuest */));
#endif
// Always allow navigating to file:// URLs.
auto* protocol_registry = ProtocolRegistry::FromBrowserContext(context);

View file

@ -194,7 +194,6 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
std::string GetProduct() override;
void RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id,
ukm::SourceIdObj ukm_source_id,
NonNetworkURLLoaderFactoryMap* factories) override;
void RegisterNonNetworkWorkerMainResourceURLLoaderFactories(
content::BrowserContext* browser_context,

View file

@ -975,12 +975,12 @@ ExtensionFunction::ResponseAction ScriptingUpdateContentScriptsFunction::Run() {
}
std::u16string parse_error;
auto parsed_scripts = std::make_unique<UserScriptList>();
UserScriptList parsed_scripts;
std::set<std::string> updated_script_ids_to_persist;
std::set<std::string> persistent_script_ids =
loader->GetPersistentDynamicScriptIDs();
parsed_scripts->reserve(scripts.size());
parsed_scripts.reserve(scripts.size());
for (size_t i = 0; i < scripts.size(); ++i) {
api::scripting::RegisteredContentScript& update_delta = scripts[i];
DCHECK(base::Contains(loaded_scripts_metadata, update_delta.id));
@ -1028,7 +1028,7 @@ ExtensionFunction::ResponseAction ScriptingUpdateContentScriptsFunction::Run() {
updated_script_ids_to_persist.insert(update_delta.id);
}
parsed_scripts->push_back(std::move(user_script));
parsed_scripts.push_back(std::move(user_script));
}
// Add new script IDs now in case another call with the same script IDs is
@ -1069,7 +1069,7 @@ void ScriptingRegisterContentScriptsFunction::OnContentScriptFilesValidated(
if (error.has_value()) {
std::set<std::string> ids_to_remove;
for (const auto& script : *scripts) {
for (const auto& script : scripts) {
ids_to_remove.insert(script->id());
}
@ -1246,10 +1246,10 @@ ScriptingRegisterContentScriptsFunction::Run() {
// Parse content scripts.
std::u16string parse_error;
auto parsed_scripts = std::make_unique<UserScriptList>();
UserScriptList parsed_scripts;
std::set<std::string> persistent_script_ids;
parsed_scripts->reserve(scripts.size());
parsed_scripts.reserve(scripts.size());
for (auto& script : scripts) {
if (!script.matches) {
std::string error_script_id =
@ -1271,7 +1271,7 @@ ScriptingRegisterContentScriptsFunction::Run() {
if (persist_across_sessions) {
persistent_script_ids.insert(user_script->id());
}
parsed_scripts->push_back(std::move(user_script));
parsed_scripts.push_back(std::move(user_script));
}
// The contents of `scripts` have all been std::move()'d.
scripts.clear();
@ -1313,7 +1313,7 @@ void ScriptingUpdateContentScriptsFunction::OnContentScriptFilesValidated(
->GetUserScriptLoaderForExtension(extension()->id());
std::set<std::string> script_ids;
for (const auto& script : *scripts)
for (const auto& script : scripts)
script_ids.insert(script->id());
if (error.has_value()) {

View file

@ -24,7 +24,8 @@ void StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent(
bool embedded,
int frame_tree_node_id,
blink::mojom::TransferrableURLLoaderPtr transferrable_loader,
const GURL& original_url) {
const GURL& original_url,
const std::string& internal_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::WebContents* web_contents =

View file

@ -26,7 +26,8 @@ class StreamsPrivateAPI {
bool embedded,
int frame_tree_node_id,
blink::mojom::TransferrableURLLoaderPtr transferrable_loader,
const GURL& original_url);
const GURL& original_url,
const std::string& internal_id);
};
} // namespace extensions

View file

@ -50,20 +50,20 @@ void ZoomModeToZoomSettings(WebContentsZoomController::ZoomMode zoom_mode,
DCHECK(zoom_settings);
switch (zoom_mode) {
case WebContentsZoomController::ZOOM_MODE_DEFAULT:
zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC;
zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN;
zoom_settings->mode = api::tabs::ZoomSettingsMode::kAutomatic;
zoom_settings->scope = api::tabs::ZoomSettingsScope::kPerOrigin;
break;
case WebContentsZoomController::ZOOM_MODE_ISOLATED:
zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_AUTOMATIC;
zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_TAB;
zoom_settings->mode = api::tabs::ZoomSettingsMode::kAutomatic;
zoom_settings->scope = api::tabs::ZoomSettingsScope::kPerTab;
break;
case WebContentsZoomController::ZOOM_MODE_MANUAL:
zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_MANUAL;
zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_TAB;
zoom_settings->mode = api::tabs::ZoomSettingsMode::kManual;
zoom_settings->scope = api::tabs::ZoomSettingsScope::kPerTab;
break;
case WebContentsZoomController::ZOOM_MODE_DISABLED:
zoom_settings->mode = api::tabs::ZOOM_SETTINGS_MODE_DISABLED;
zoom_settings->scope = api::tabs::ZOOM_SETTINGS_SCOPE_PER_TAB;
zoom_settings->mode = api::tabs::ZoomSettingsMode::kDisabled;
zoom_settings->scope = api::tabs::ZoomSettingsScope::kPerTab;
break;
}
}
@ -79,7 +79,7 @@ api::tabs::MutedInfo CreateMutedInfo(content::WebContents* contents) {
DCHECK(contents);
api::tabs::MutedInfo info;
info.muted = contents->IsAudioMuted();
info.reason = api::tabs::MUTED_INFO_REASON_USER;
info.reason = api::tabs::MutedInfoReason::kUser;
return info;
}
@ -111,8 +111,8 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
const base::Value& details_value = args()[1];
if (!details_value.is_dict())
return set_init_result(VALIDATION_FAILURE);
std::unique_ptr<InjectDetails> details(new InjectDetails());
if (!InjectDetails::Populate(details_value.GetDict(), *details)) {
auto details = InjectDetails::FromValue(details_value.GetDict());
if (!details) {
return set_init_result(VALIDATION_FAILURE);
}
@ -432,9 +432,9 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
return RespondNow(Error(error));
// "per-origin" scope is only available in "automatic" mode.
if (params->zoom_settings.scope == tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN &&
params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_AUTOMATIC &&
params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_NONE) {
if (params->zoom_settings.scope == tabs::ZoomSettingsScope::kPerOrigin &&
params->zoom_settings.mode != tabs::ZoomSettingsMode::kAutomatic &&
params->zoom_settings.mode != tabs::ZoomSettingsMode::kNone) {
return RespondNow(Error(kPerOriginOnlyInAutomaticError));
}
@ -443,21 +443,21 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
WebContentsZoomController::ZoomMode zoom_mode =
WebContentsZoomController::ZOOM_MODE_DEFAULT;
switch (params->zoom_settings.mode) {
case tabs::ZOOM_SETTINGS_MODE_NONE:
case tabs::ZOOM_SETTINGS_MODE_AUTOMATIC:
case tabs::ZoomSettingsMode::kNone:
case tabs::ZoomSettingsMode::kAutomatic:
switch (params->zoom_settings.scope) {
case tabs::ZOOM_SETTINGS_SCOPE_NONE:
case tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN:
case tabs::ZoomSettingsScope::kNone:
case tabs::ZoomSettingsScope::kPerOrigin:
zoom_mode = WebContentsZoomController::ZOOM_MODE_DEFAULT;
break;
case tabs::ZOOM_SETTINGS_SCOPE_PER_TAB:
case tabs::ZoomSettingsScope::kPerTab:
zoom_mode = WebContentsZoomController::ZOOM_MODE_ISOLATED;
}
break;
case tabs::ZOOM_SETTINGS_MODE_MANUAL:
case tabs::ZoomSettingsMode::kManual:
zoom_mode = WebContentsZoomController::ZOOM_MODE_MANUAL;
break;
case tabs::ZOOM_SETTINGS_MODE_DISABLED:
case tabs::ZoomSettingsMode::kDisabled:
zoom_mode = WebContentsZoomController::ZOOM_MODE_DISABLED;
}

View file

@ -62,7 +62,7 @@ void ElectronExtensionHostDelegate::ProcessMediaAccessRequest(
bool ElectronExtensionHostDelegate::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
const url::Origin& security_origin,
blink::mojom::MediaStreamType type,
const Extension* extension) {
media_capture_util::VerifyMediaAccessPermission(type, extension);

View file

@ -37,7 +37,7 @@ class ElectronExtensionHostDelegate : public ExtensionHostDelegate {
content::MediaResponseCallback callback,
const Extension* extension) override;
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
const url::Origin& security_origin,
blink::mojom::MediaStreamType type,
const Extension* extension) override;
content::PictureInPictureResult EnterPictureInPicture(

View file

@ -48,7 +48,7 @@ struct Converter<electron::ProtocolType> {
electron::ProtocolType* out) {
using Val = electron::ProtocolType;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
// note "free" is internal type, not allowed to be passed from user
{"buffer", Val::kBuffer},
{"file", Val::kFile},

View file

@ -120,8 +120,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::UpdateRequestInfo() {
: nullptr,
request_for_info, false,
!(options_ & network::mojom::kURLLoadOptionSynchronous),
factory_->IsForServiceWorkerScript(), factory_->navigation_id_,
ukm::kInvalidSourceIdObj));
factory_->IsForServiceWorkerScript(), factory_->navigation_id_));
current_request_uses_header_client_ =
factory_->url_loader_header_client_receiver_.is_bound() &&

View file

@ -44,8 +44,7 @@ ProxyingWebSocket::ProxyingWebSocket(
/*is_download=*/false,
/*is_async=*/true,
/*is_service_worker_script=*/false,
/*navigation_id=*/absl::nullopt,
/*ukm_source_id=*/ukm::kInvalidSourceIdObj)) {}
/*navigation_id=*/absl::nullopt)) {}
ProxyingWebSocket::~ProxyingWebSocket() {
if (on_before_send_headers_callback_) {

View file

@ -396,6 +396,11 @@ void OffScreenRenderWidgetHostView::
compositor_allocator_.Invalidate(/*also_invalidate_allocation_group=*/true);
}
void OffScreenRenderWidgetHostView::UpdateFrameSinkIdRegistration() {
RenderWidgetHostViewBase::UpdateFrameSinkIdRegistration();
GetDelegatedFrameHost()->SetIsFrameSinkIdOwner(is_frame_sink_id_owner());
}
void OffScreenRenderWidgetHostView::ResetFallbackToFirstNavigationSurface() {
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
}

View file

@ -119,6 +119,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
// content::RenderWidgetHostViewBase:
void UpdateFrameSinkIdRegistration() override;
void InvalidateLocalSurfaceIdAndAllocationGroup() override;
void ResetFallbackToFirstNavigationSurface() override;
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,

View file

@ -167,6 +167,8 @@ class InspectableWebContents
void RecordUserMetricsAction(const std::string& name) override {}
void RecordImpression(const ImpressionEvent& event) override {}
void RecordClick(const ClickEvent& event) override {}
void RecordHover(const HoverEvent& event) override {}
void RecordDrag(const DragEvent& event) override {}
void RecordChange(const ChangeEvent& event) override {}
void RecordKeyDown(const KeyDownEvent& event) override {}
void ShowSurvey(DispatchCallback callback,

View file

@ -30,6 +30,9 @@ void AutofillPopupChildView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->SetName(suggestion_);
}
BEGIN_METADATA(AutofillPopupChildView)
END_METADATA
AutofillPopupView::AutofillPopupView(AutofillPopup* popup,
views::Widget* parent_widget)
: popup_(popup), parent_widget_(parent_widget) {

View file

@ -16,6 +16,8 @@
#include "shell/browser/osr/osr_view_proxy.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/views/drag_controller.h"
#include "ui/views/focus/widget_focus_manager.h"
#include "ui/views/widget/widget_delegate.h"
@ -34,6 +36,8 @@ class AutofillPopup;
// Child view only for triggering accessibility events. Rendering is handled
// by |AutofillPopupViewViews|.
class AutofillPopupChildView : public views::View {
METADATA_HEADER(AutofillPopupChildView, views::View)
public:
explicit AutofillPopupChildView(const std::u16string& suggestion)
: suggestion_(suggestion) {

View file

@ -30,8 +30,6 @@ const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233);
} // namespace
const char MenuBar::kViewClassName[] = "ElectronMenuBar";
MenuBar::MenuBar(NativeWindow* window, RootView* root_view)
: background_color_(kDefaultColor), window_(window), root_view_(root_view) {
const ui::NativeTheme* theme = root_view_->GetNativeTheme();
@ -270,4 +268,7 @@ void MenuBar::UpdateViewColors() {
#endif
}
BEGIN_METADATA(MenuBar)
END_METADATA
} // namespace electron

View file

@ -10,6 +10,8 @@
#include "shell/browser/ui/electron_menu_model.h"
#include "shell/browser/ui/views/menu_delegate.h"
#include "shell/browser/ui/views/root_view.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/views/accessible_pane_view.h"
namespace views {
@ -21,9 +23,9 @@ namespace electron {
class MenuBar : public views::AccessiblePaneView,
public MenuDelegate::Observer,
public NativeWindowObserver {
public:
static const char kViewClassName[];
METADATA_HEADER(MenuBar, views::AccessiblePaneView)
public:
MenuBar(NativeWindow* window, RootView* root_view);
~MenuBar() override;

View file

@ -37,11 +37,12 @@ void MenuDelegate::RunMenu(ElectronMenuModel* model,
id_ = button->GetID();
adapter_ = std::make_unique<MenuModelAdapter>(model);
auto* item = new views::MenuItemView(this);
static_cast<MenuModelAdapter*>(adapter_.get())->BuildMenu(item);
auto item = std::make_unique<views::MenuItemView>(this);
static_cast<MenuModelAdapter*>(adapter_.get())->BuildMenu(item.get());
menu_runner_ = std::make_unique<views::MenuRunner>(
item, views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS);
std::move(item),
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS);
menu_runner_->RunMenuAt(
button->GetWidget()->GetTopLevelWidget(),
static_cast<views::MenuButton*>(button)->button_controller(), bounds,

View file

@ -96,4 +96,7 @@ void SubmenuButton::GetCharacterPosition(const std::u16string& text,
&height, 0, 0);
}
BEGIN_METADATA(SubmenuButton)
END_METADATA
} // namespace electron

View file

@ -8,6 +8,8 @@
#include <string>
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/controls/button/menu_button.h"
@ -15,6 +17,8 @@ namespace electron {
// Special button that used by menu bar to show submenus.
class SubmenuButton : public views::MenuButton {
METADATA_HEADER(SubmenuButton, views::MenuButton)
public:
SubmenuButton(PressedCallback callback,
const std::u16string& title,

View file

@ -211,4 +211,8 @@ void WinCaptionButton::PaintSymbol(gfx::Canvas* canvas) {
return;
}
}
BEGIN_METADATA(WinCaptionButton)
END_METADATA
} // namespace electron

View file

@ -14,6 +14,7 @@
#include "chrome/browser/ui/view_ids.h"
#include "shell/browser/ui/views/win_icon_painter.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/canvas.h"
#include "ui/views/controls/button/button.h"
@ -22,6 +23,8 @@ namespace electron {
class WinFrameView;
class WinCaptionButton : public views::Button {
METADATA_HEADER(WinCaptionButton, views::Button)
public:
WinCaptionButton(PressedCallback callback,
WinFrameView* frame_view,

View file

@ -188,4 +188,8 @@ void WinCaptionButtonContainer::UpdateButtons() {
InvalidateLayout();
}
BEGIN_METADATA(WinCaptionButtonContainer)
END_METADATA
} // namespace electron

View file

@ -11,6 +11,7 @@
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/pointer/touch_ui_controller.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/view.h"
@ -27,6 +28,8 @@ class WinCaptionButton;
// grab bar for moving the window.
class WinCaptionButtonContainer : public views::View,
public views::WidgetObserver {
METADATA_HEADER(WinCaptionButtonContainer, views::View)
public:
explicit WinCaptionButtonContainer(WinFrameView* frame_view);
~WinCaptionButtonContainer() override;

View file

@ -253,8 +253,8 @@ JumpListResult JumpList::AppendCategory(const JumpListCategory& category) {
if (AppendSeparator(collection))
++appended_count;
} else {
LOG(ERROR) << "Can't append separator to Jump List category "
<< "'" << category.name << "'. "
LOG(ERROR) << "Can't append separator to Jump List category " << "'"
<< category.name << "'. "
<< "Separators are only allowed in the standard 'Tasks' "
"Jump List category.";
result = JumpListResult::kCustomCategorySeparatorError;
@ -292,18 +292,18 @@ JumpListResult JumpList::AppendCategory(const JumpListCategory& category) {
HRESULT hr = destinations_->AppendCategory(category.name.c_str(), items);
if (FAILED(hr)) {
if (hr == static_cast<HRESULT>(0x80040F03)) {
LOG(ERROR) << "Failed to append custom category "
<< "'" << category.name << "' "
LOG(ERROR) << "Failed to append custom category " << "'"
<< category.name << "' "
<< "to Jump List due to missing file type registration.";
result = JumpListResult::kMissingFileTypeRegistrationError;
} else if (hr == E_ACCESSDENIED) {
LOG(ERROR) << "Failed to append custom category "
<< "'" << category.name << "' "
LOG(ERROR) << "Failed to append custom category " << "'"
<< category.name << "' "
<< "to Jump List due to system privacy settings.";
result = JumpListResult::kCustomCategoryAccessDeniedError;
} else {
LOG(ERROR) << "Failed to append custom category "
<< "'" << category.name << "' to Jump List.";
LOG(ERROR) << "Failed to append custom category " << "'"
<< category.name << "' to Jump List.";
if (result == JumpListResult::kSuccess)
result = JumpListResult::kGenericError;
}

View file

@ -45,7 +45,7 @@ electron::UsbChooserContext* GetChooserContext(
// These extensions can claim the smart card USB class and automatically gain
// permissions for devices that have an interface with this class.
constexpr auto kSmartCardPrivilegedExtensionIds =
base::MakeFixedFlatSetSorted<base::StringPiece>({
base::MakeFixedFlatSet<base::StringPiece>({
// Smart Card Connector Extension and its Beta version, see
// crbug.com/1233881.
"khpfeaanjngmcnplbdlpegiifgpfgdco",

View file

@ -276,10 +276,10 @@ void WebContentsPermissionHelper::RequestOpenExternalPermission(
}
bool WebContentsPermissionHelper::CheckMediaAccessPermission(
const GURL& security_origin,
const url::Origin& security_origin,
blink::mojom::MediaStreamType type) const {
base::Value::Dict details;
details.Set("securityOrigin", security_origin.spec());
details.Set("securityOrigin", security_origin.GetURL().spec());
details.Set("mediaType", MediaStreamTypeToString(type));
// The permission type doesn't matter here, AUDIO_CAPTURE/VIDEO_CAPTURE
// are presented as same type in content_converter.h.

View file

@ -57,7 +57,7 @@ class WebContentsPermissionHelper
const GURL& url);
// Synchronous Checks
bool CheckMediaAccessPermission(const GURL& security_origin,
bool CheckMediaAccessPermission(const url::Origin& security_origin,
blink::mojom::MediaStreamType type) const;
bool CheckSerialAccessPermission(const url::Origin& embedding_origin) const;

View file

@ -46,7 +46,7 @@ struct Converter<blink::mojom::AutoplayPolicy> {
blink::mojom::AutoplayPolicy* out) {
using Val = blink::mojom::AutoplayPolicy;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"document-user-activation-required",
Val::kDocumentUserActivationRequired},
{"no-user-gesture-required", Val::kNoUserGestureRequired},
@ -63,7 +63,7 @@ struct Converter<blink::mojom::V8CacheOptions> {
blink::mojom::V8CacheOptions* out) {
using Val = blink::mojom::V8CacheOptions;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"bypassHeatCheck", Val::kCodeWithoutHeatCheck},
{"bypassHeatCheckAndEagerCompile", Val::kFullCodeWithoutHeatCheck},
{"code", Val::kCode},

View file

@ -23,14 +23,15 @@ void WebViewManager::RemoveGuest(int guest_instance_id) {
web_contents_embedder_map_.erase(guest_instance_id);
}
bool WebViewManager::ForEachGuest(content::WebContents* embedder_web_contents,
const GuestCallback& callback) {
bool WebViewManager::ForEachGuest(
content::WebContents* embedder_web_contents,
base::FunctionRef<bool(content::WebContents*)> fn) {
for (auto& item : web_contents_embedder_map_) {
if (item.second.embedder != embedder_web_contents)
continue;
content::WebContents* guest_web_contents = item.second.web_contents;
if (guest_web_contents && callback.Run(guest_web_contents))
if (guest_web_contents && fn(guest_web_contents))
return true;
}
return false;

View file

@ -30,7 +30,7 @@ class WebViewManager : public content::BrowserPluginGuestManager {
// content::BrowserPluginGuestManager:
bool ForEachGuest(content::WebContents* embedder,
const GuestCallback& callback) override;
base::FunctionRef<bool(content::WebContents*)> fn) override;
private:
struct WebContentsWithEmbedder {

View file

@ -7,6 +7,7 @@
#include "base/process/kill.h"
#include "gin/converter.h"
#include "shell/common/gin_converters/std_converter.h"
namespace gin {

View file

@ -135,7 +135,7 @@ struct Converter<blink::WebMouseEvent::Button> {
blink::WebMouseEvent::Button* out) {
using Val = blink::WebMouseEvent::Button;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"left", Val::kLeft},
{"middle", Val::kMiddle},
{"right", Val::kRight},
@ -148,7 +148,7 @@ struct Converter<blink::WebMouseEvent::Button> {
// these are the modifier names we both accept and return
static constexpr auto Modifiers =
base::MakeFixedFlatMapSorted<base::StringPiece, blink::WebInputEvent::Modifiers>({
base::MakeFixedFlatMap<base::StringPiece, blink::WebInputEvent::Modifiers>({
{"alt", blink::WebInputEvent::Modifiers::kAltKey},
{"capslock", blink::WebInputEvent::Modifiers::kCapsLockOn},
{"control", blink::WebInputEvent::Modifiers::kControlKey},
@ -167,14 +167,14 @@ static constexpr auto Modifiers =
// these are the modifier names we accept but do not return
static constexpr auto ModifierAliases =
base::MakeFixedFlatMapSorted<base::StringPiece, blink::WebInputEvent::Modifiers>({
base::MakeFixedFlatMap<base::StringPiece, blink::WebInputEvent::Modifiers>({
{"cmd", blink::WebInputEvent::Modifiers::kMetaKey},
{"command", blink::WebInputEvent::Modifiers::kMetaKey},
{"ctrl", blink::WebInputEvent::Modifiers::kControlKey},
});
static constexpr auto ReferrerPolicies =
base::MakeFixedFlatMapSorted<base::StringPiece, network::mojom::ReferrerPolicy>({
base::MakeFixedFlatMap<base::StringPiece, network::mojom::ReferrerPolicy>({
{"default", network::mojom::ReferrerPolicy::kDefault},
{"no-referrer", network::mojom::ReferrerPolicy::kNever},
{"no-referrer-when-downgrade", network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade},

View file

@ -323,7 +323,7 @@ bool Converter<content::StopFindAction>::FromV8(v8::Isolate* isolate,
content::StopFindAction* out) {
using Val = content::StopFindAction;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"activateSelection", Val::STOP_FIND_ACTION_ACTIVATE_SELECTION},
{"clearSelection", Val::STOP_FIND_ACTION_CLEAR_SELECTION},
{"keepSelection", Val::STOP_FIND_ACTION_KEEP_SELECTION},

View file

@ -9,6 +9,7 @@
#include "services/device/public/mojom/hid.mojom.h"
#include "shell/browser/hid/hid_chooser_context.h"
#include "shell/browser/hid/hid_chooser_controller.h"
#include "shell/common/gin_converters/value_converter.h"
namespace gin {
@ -18,11 +19,11 @@ struct Converter<device::mojom::HidDeviceInfoPtr> {
v8::Isolate* isolate,
const device::mojom::HidDeviceInfoPtr& device) {
base::Value value = electron::HidChooserContext::DeviceInfoToValue(*device);
value.GetDict().Set(
"deviceId",
electron::HidChooserController::PhysicalDeviceIdFromDeviceInfo(
*device));
return gin::ConvertToV8(isolate, value);
base::Value::Dict& dict = value.GetDict();
dict.Set("deviceId",
electron::HidChooserController::PhysicalDeviceIdFromDeviceInfo(
*device));
return gin::Converter<base::Value::Dict>::ToV8(isolate, dict);
}
};

View file

@ -691,7 +691,7 @@ bool Converter<net::DnsQueryType>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
net::DnsQueryType* out) {
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, net::DnsQueryType>({
base::MakeFixedFlatMap<base::StringPiece, net::DnsQueryType>({
{"A", net::DnsQueryType::A},
{"AAAA", net::DnsQueryType::AAAA},
});
@ -704,7 +704,7 @@ bool Converter<net::HostResolverSource>::FromV8(v8::Isolate* isolate,
net::HostResolverSource* out) {
using Val = net::HostResolverSource;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"any", Val::ANY},
{"dns", Val::DNS},
{"localOnly", Val::LOCAL_ONLY},
@ -721,7 +721,7 @@ bool Converter<network::mojom::ResolveHostParameters::CacheUsage>::FromV8(
network::mojom::ResolveHostParameters::CacheUsage* out) {
using Val = network::mojom::ResolveHostParameters::CacheUsage;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"allowed", Val::ALLOWED},
{"disallowed", Val::DISALLOWED},
{"staleAllowed", Val::STALE_ALLOWED},
@ -736,7 +736,7 @@ bool Converter<network::mojom::SecureDnsPolicy>::FromV8(
network::mojom::SecureDnsPolicy* out) {
using Val = network::mojom::SecureDnsPolicy;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
base::MakeFixedFlatMap<base::StringPiece, Val>({
{"allow", Val::ALLOW},
{"disable", Val::DISABLE},
});

View file

@ -27,7 +27,7 @@ constexpr CodeAndShiftedChar KeyboardCodeFromKeyIdentifier(
#endif
constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, CodeAndShiftedChar>({
base::MakeFixedFlatMap<base::StringPiece, CodeAndShiftedChar>({
{"alt", {ui::VKEY_MENU, {}}},
{"altgr", {ui::VKEY_ALTGR, {}}},
{"backspace", {ui::VKEY_BACK, {}}},

View file

@ -43,7 +43,7 @@ bool GetPreferredLanguagesUsingGlobalization(
HSTRING hstr;
hr = langs->GetAt(i, &hstr);
if (SUCCEEDED(hr)) {
base::WStringPiece str = base::win::ScopedHString(hstr).Get();
std::wstring_view str = base::win::ScopedHString(hstr).Get();
languages->emplace_back(str.data(), str.size());
}
}

View file

@ -297,7 +297,7 @@ void ErrorMessageListener(v8::Local<v8::Message> message,
// If node CLI inspect support is disabled, allow no debug options.
bool IsAllowedOption(base::StringPiece option) {
static constexpr auto debug_options =
base::MakeFixedFlatSetSorted<base::StringPiece>({
base::MakeFixedFlatSet<base::StringPiece>({
"--debug",
"--debug-brk",
"--debug-port",
@ -309,14 +309,13 @@ bool IsAllowedOption(base::StringPiece option) {
});
// This should be aligned with what's possible to set via the process object.
static constexpr auto options =
base::MakeFixedFlatSetSorted<base::StringPiece>({
"--dns-result-order",
"--no-deprecation",
"--throw-deprecation",
"--trace-deprecation",
"--trace-warnings",
});
static constexpr auto options = base::MakeFixedFlatSet<base::StringPiece>({
"--dns-result-order",
"--no-deprecation",
"--throw-deprecation",
"--trace-deprecation",
"--trace-warnings",
});
if (debug_options.contains(option))
return electron::fuses::IsNodeCliInspectEnabled();
@ -328,21 +327,19 @@ bool IsAllowedOption(base::StringPiece option) {
// See https://nodejs.org/api/cli.html#cli_node_options_options
void SetNodeOptions(base::Environment* env) {
// Options that are unilaterally disallowed
static constexpr auto disallowed =
base::MakeFixedFlatSetSorted<base::StringPiece>({
"--enable-fips",
"--experimental-policy",
"--force-fips",
"--openssl-config",
"--use-bundled-ca",
"--use-openssl-ca",
});
static constexpr auto disallowed = base::MakeFixedFlatSet<base::StringPiece>({
"--enable-fips",
"--experimental-policy",
"--force-fips",
"--openssl-config",
"--use-bundled-ca",
"--use-openssl-ca",
});
static constexpr auto pkg_opts =
base::MakeFixedFlatSetSorted<base::StringPiece>({
"--http-parser",
"--max-http-header-size",
});
static constexpr auto pkg_opts = base::MakeFixedFlatSet<base::StringPiece>({
"--http-parser",
"--max-http-header-size",
});
if (env->HasVar("NODE_OPTIONS")) {
if (electron::fuses::IsNodeOptionsEnabled()) {

View file

@ -46,9 +46,11 @@ void ElectronRendererClient::RunScriptsAtDocumentStart(
// Inform the document start phase.
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
node::Environment* env = GetEnvironment(render_frame);
if (env)
if (env) {
v8::Context::Scope context_scope(env->context());
gin_helper::EmitEvent(env->isolate(), env->process_object(),
"document-start");
}
}
void ElectronRendererClient::RunScriptsAtDocumentEnd(
@ -57,9 +59,11 @@ void ElectronRendererClient::RunScriptsAtDocumentEnd(
// Inform the document end phase.
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
node::Environment* env = GetEnvironment(render_frame);
if (env)
if (env) {
v8::Context::Scope context_scope(env->context());
gin_helper::EmitEvent(env->isolate(), env->process_object(),
"document-end");
}
}
void ElectronRendererClient::UndeferLoad(content::RenderFrame* render_frame) {

View file

@ -331,7 +331,7 @@ void RendererClientBase::RenderFrameCreated(
->AddInterface<extensions::mojom::MimeHandlerViewContainerManager>(
base::BindRepeating(
&extensions::MimeHandlerViewContainerManager::BindReceiver,
render_frame->GetRoutingID()));
base::Unretained(render_frame)));
#endif
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)

View file

@ -4,9 +4,9 @@
#include "shell/renderer/web_worker_observer.h"
#include <set>
#include <utility>
#include "base/containers/cxx20_erase_set.h"
#include "base/no_destructor.h"
#include "base/ranges/algorithm.h"
#include "base/threading/thread_local.h"
@ -84,8 +84,10 @@ void WebWorkerObserver::WorkerScriptReadyForEvaluation(
void WebWorkerObserver::ContextWillDestroy(v8::Local<v8::Context> context) {
node::Environment* env = node::Environment::GetCurrent(context);
if (env)
if (env) {
v8::Context::Scope context_scope(env->context());
gin_helper::EmitEvent(env->isolate(), env->process_object(), "exit");
}
// Destroying the node environment will also run the uv loop,
// Node.js expects `kExplicit` microtasks policy and will run microtasks
@ -96,7 +98,7 @@ void WebWorkerObserver::ContextWillDestroy(v8::Local<v8::Context> context) {
DCHECK_EQ(microtask_queue->GetMicrotasksScopeDepth(), 0);
microtask_queue->set_microtasks_policy(v8::MicrotasksPolicy::kExplicit);
base::EraseIf(environments_,
std::erase_if(environments_,
[env](auto const& item) { return item.get() == env; });
microtask_queue->set_microtasks_policy(old_policy);