chore: bump chromium to 107.0.5274.0 (main) (#35375)

* chore: bump chromium in DEPS to 106.0.5247.1

* chore: update can_create_window.patch

Xref: 3805043

content/renderer/render_view_impl.cc was removed

* chore: update patches/chromium/printing.patch

Normal code shear.

* chore: update patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch

Xref: 3764862

fix minor code shear that caused the patch to not apply

* chore: update patches/chromium/picture-in-picture.patch

Xref: 3781646

Normal code shear.

* chore: update patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch

Xref: 3805043

content/renderer/render_view_impl.cc was removed

Xref: 3792324

Normal code shear.

* chore: update patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch

Normal code shear.

* chore: update patches/chromium/fix_patch_out_profile_refs_in_accessibility_ui.patch

Xref: 3798548

Normal code shear.

* chore: update patches/chromium/build_disable_print_content_analysis.patch

Xref: 3810473

Normal code shear.

* chore: short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch

Xref: 3807504

Normal code shear.

* chore: update patches

* chore: bump chromium in DEPS to 106.0.5249.0

* chore: bump chromium in DEPS to 107.0.5250.0

* chore: bump chromium in DEPS to 107.0.5252.0

* chore: bump chromium in DEPS to 107.0.5254.0

* chore: bump chromium in DEPS to 107.0.5256.1

* chore: update v8 patches

* chore: update chromium patches

* [CodeHealthRotation] base::Value::Dict (v2) migration for //c/b/ui/zoom

Refs 3778239

* Add support for snapped window states for lacros

3810538

* webui: Migrate /chrome/browser/ui/webui URLDataSources to GetMimeType(GURL)

Refs 3774560

* Provide explicit template arguments to blink::AssociatedInterfaceRegistry::AddInterface

Refs 3773459

* Make WebScriptExecutionCallback base::OnceCallback

Refs
3676532
3724623
3675752

* Add implementation of reduce accept language service

Refs 3687391

* Add PermissionResult in //content/public.

Refs 3807504

* [Extensions] Add new Webstore domain to extension URLs and clients

Refs 3793043

* chore: update node patches

* chore: fix lint

* chore: update filenames.libcxx.gni

* fixup! Make WebScriptExecutionCallback base::OnceCallback

* chore: bump chromium in DEPS to 107.0.5266.1

* chore: bump chromium in DEPS to 107.0.5268.0

* chore: bump chromium in DEPS to 107.0.5270.1

* chore: update patches

* 3848842: [DevTools] Added 'printing-in-progress' error code.

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

* 3855766: PA: Move the allocator shim files into partition_allocator/shim/ | 3855766

* Change gfx::Rect to blink::mojom::WindowFeatures in AddNewContents and some related functions.

3835666

* Use base::FunctionRef for the various ForEachRenderFrameHost helpers.

3767487

* [loader] Send cached metadata as part of OnReceiveResponse

3811219

* 3832927: [json-schema-compiler] Support abs::optional<int>

3832927

* Use unique_ptr for BrowserPluginGuestDelegate::CreateNewGuestWindow

3847070

* 3847044: [Android] Dismiss select popup upon entering fullscreen

3847044

* chore: update patches

* chore: add missing header

* Migration of chrome/ BrowserContextKeyedServiceFactory to ProfileKeyedServiceFactory Part 12

3804581

* 3786946: cast pwrite64 arg to long to avoid compilation error on arm

3786946

* chore: update patches after rebase

* 3846114: float: Implement for lacros p2.

3846114

* 3825237: Enable -Wunqualified-std-cast-call

3825237

* chore: bump chromium in DEPS to 107.0.5272.0

* chore: update patches

* 3835746: Rename PepperPluginInfo to ContentPluginInfo

3835746

* 3852542: Plumb drag-image rect from blink to browser to RenderWidgetHostImpl

3852542

* 3826169: [json-schema-compiler] Support abs::optional<bool>

3826169

Also 3840687: [json-schema-compiler] Support abs::optional<double>

3840687

* 3857319: Reland "Remove PrefService::Get"

3857319

* 3854614: Rework LinuxUi ownership and creation

3854614

* chore: bump chromium in DEPS to 107.0.5274.0

* 3866104: [DownloadBubble] Change download notifications in exclusive_access

3866104

* chore: update patches

* chore: disable optimization guide for preconnect feature

* 3860569: Enable -Wshadow on Linux.

3860569

* chore: update patches after rebase

* fixup: update to accomodate Wc++98-compat-extra-semi flag

* Revert "fixup! Make WebScriptExecutionCallback base::OnceCallback"

This reverts commit 0866fe8648671f04e4ea45ceed85db6e4a3b260b.

* fixup! Make WebScriptExecutionCallback base::OnceCallback

* fixup! Make WebScriptExecutionCallback base::OnceCallback

* 3840937: [sandbox] Merge V8_SANDBOXED_POINTERS into V8_ENABLE_SANDBOX

3840937

* fixup! chore: update can_create_window.patch

* chore: update patches

* 53946: Track SSL_ERROR_ZERO_RETURN explicitly.

https://boringssl-review.googlesource.com/c/boringssl/+/53946

* fixup: Migration of chrome/ BrowserContextKeyedServiceFactory to ProfileKeyedServiceFactory Part 12

3804581

* 3805932: [headless] Added print compositor support for OOPIF printing.

3805932

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
electron-roller[bot] 2022-09-07 09:46:37 +02:00 committed by GitHub
parent f53ca20d41
commit 08ccc81574
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
154 changed files with 1403 additions and 907 deletions

4
shell/browser/api/electron_api_debugger.cc Normal file → Executable file
View file

@ -69,8 +69,8 @@ void Debugger::DispatchProtocolMessage(DevToolsAgentHost* agent_host,
base::Value::Dict* error = dict.FindDict("error");
if (error) {
std::string* message = error->FindString("message");
promise.RejectWithErrorMessage(message ? *message : "");
std::string* error_message = error->FindString("message");
promise.RejectWithErrorMessage(error_message ? *error_message : "");
} else {
base::Value::Dict* result = dict.FindDict("result");
promise.Resolve(result ? std::move(*result) : base::Value::Dict());

View file

@ -1036,8 +1036,8 @@ v8::Local<v8::Promise> Session::ClearCodeCaches(
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
base::Value Session::GetSpellCheckerLanguages() {
return browser_context_->prefs()
->Get(spellcheck::prefs::kSpellCheckDictionaries)
->Clone();
->GetValue(spellcheck::prefs::kSpellCheckDictionaries)
.Clone();
}
void Session::SetSpellCheckerLanguages(

19
shell/browser/api/electron_api_web_contents.cc Normal file → Executable file
View file

@ -58,6 +58,7 @@
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/referrer_type_converters.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/webplugininfo.h"
#include "electron/buildflags/buildflags.h"
#include "electron/shell/common/api/api.mojom.h"
@ -1095,7 +1096,7 @@ void WebContents::AddNewContents(
std::unique_ptr<content::WebContents> new_contents,
const GURL& target_url,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) {
auto* tracker = ChildWebContentsTracker::FromWebContents(new_contents.get());
@ -1117,9 +1118,10 @@ void WebContents::AddNewContents(
}
if (Emit("-add-new-contents", api_web_contents, disposition, user_gesture,
initial_rect.x(), initial_rect.y(), initial_rect.width(),
initial_rect.height(), tracker->url, tracker->frame_name,
tracker->referrer, tracker->raw_features, tracker->body)) {
window_features.bounds.x(), window_features.bounds.y(),
window_features.bounds.width(), window_features.bounds.height(),
tracker->url, tracker->frame_name, tracker->referrer,
tracker->raw_features, tracker->body)) {
api_web_contents->Destroy();
}
}
@ -1283,6 +1285,7 @@ void WebContents::UpdateExclusiveAccessExitBubbleContent(
const GURL& url,
ExclusiveAccessBubbleType bubble_type,
ExclusiveAccessBubbleHideCallback bubble_first_hide_callback,
bool notify_download,
bool force_update) {}
void WebContents::OnExclusiveAccessUserInput() {}
@ -2756,11 +2759,11 @@ void WebContents::Print(gin::Arguments* args) {
for (auto& range : page_ranges) {
int from, to;
if (range.Get("from", &from) && range.Get("to", &to)) {
base::Value::Dict range;
base::Value::Dict range_dict;
// Chromium uses 1-based page ranges, so increment each by 1.
range.Set(printing::kSettingPageRangeFrom, from + 1);
range.Set(printing::kSettingPageRangeTo, to + 1);
page_range_list.Append(std::move(range));
range_dict.Set(printing::kSettingPageRangeFrom, from + 1);
range_dict.Set(printing::kSettingPageRangeTo, to + 1);
page_range_list.Append(std::move(range_dict));
} else {
continue;
}

View file

@ -497,7 +497,7 @@ class WebContents : public ExclusiveAccessContext,
std::unique_ptr<content::WebContents> new_contents,
const GURL& target_url,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) override;
content::WebContents* OpenURLFromTab(
@ -665,6 +665,7 @@ class WebContents : public ExclusiveAccessContext,
const GURL& url,
ExclusiveAccessBubbleType bubble_type,
ExclusiveAccessBubbleHideCallback bubble_first_hide_callback,
bool notify_download,
bool force_update) override;
void OnExclusiveAccessUserInput() override;
content::WebContents* GetActiveWebContents() override;

View file

@ -325,14 +325,11 @@ std::vector<content::RenderFrameHost*> WebFrameMain::Frames() const {
if (!CheckRenderFrame())
return frame_hosts;
render_frame_->ForEachRenderFrameHost(base::BindRepeating(
[](std::vector<content::RenderFrameHost*>* frame_hosts,
content::RenderFrameHost* current_frame,
content::RenderFrameHost* rfh) {
if (rfh->GetParent() == current_frame)
frame_hosts->push_back(rfh);
},
&frame_hosts, render_frame_));
render_frame_->ForEachRenderFrameHost(
[&frame_hosts, this](content::RenderFrameHost* rfh) {
if (rfh->GetParent() == render_frame_)
frame_hosts.push_back(rfh);
});
return frame_hosts;
}
@ -342,10 +339,10 @@ std::vector<content::RenderFrameHost*> WebFrameMain::FramesInSubtree() const {
if (!CheckRenderFrame())
return frame_hosts;
render_frame_->ForEachRenderFrameHost(base::BindRepeating(
[](std::vector<content::RenderFrameHost*>* frame_hosts,
content::RenderFrameHost* rfh) { frame_hosts->push_back(rfh); },
&frame_hosts));
render_frame_->ForEachRenderFrameHost(
[&frame_hosts](content::RenderFrameHost* rfh) {
frame_hosts.push_back(rfh);
});
return frame_hosts;
}

View file

@ -1572,56 +1572,61 @@ void ElectronBrowserClient::
if (render_frame_host.GetFrameTreeNodeId() ==
contents->GetPrimaryMainFrame()->GetFrameTreeNodeId() ||
(prefs && prefs->AllowsNodeIntegrationInSubFrames())) {
associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<electron::mojom::ElectronApiIPC>
receiver) {
ElectronApiIPCHandlerImpl::Create(render_frame_host,
std::move(receiver));
},
&render_frame_host));
associated_registry.AddInterface<mojom::ElectronApiIPC>(
base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<mojom::ElectronApiIPC>
receiver) {
ElectronApiIPCHandlerImpl::Create(render_frame_host,
std::move(receiver));
},
&render_frame_host));
}
}
associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<
electron::mojom::ElectronWebContentsUtility> receiver) {
ElectronWebContentsUtilityHandlerImpl::Create(render_frame_host,
std::move(receiver));
},
&render_frame_host));
associated_registry.AddInterface<mojom::ElectronWebContentsUtility>(
base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<mojom::ElectronWebContentsUtility>
receiver) {
ElectronWebContentsUtilityHandlerImpl::Create(render_frame_host,
std::move(receiver));
},
&render_frame_host));
associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<mojom::ElectronAutofillDriver>
receiver) {
AutofillDriverFactory::BindAutofillDriver(std::move(receiver),
render_frame_host);
},
&render_frame_host));
associated_registry.AddInterface<mojom::ElectronAutofillDriver>(
base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<mojom::ElectronAutofillDriver>
receiver) {
AutofillDriverFactory::BindAutofillDriver(std::move(receiver),
render_frame_host);
},
&render_frame_host));
#if BUILDFLAG(ENABLE_PRINTING)
associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>
receiver) {
PrintViewManagerElectron::BindPrintManagerHost(std::move(receiver),
render_frame_host);
},
&render_frame_host));
associated_registry.AddInterface<printing::mojom::PrintManagerHost>(
base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>
receiver) {
PrintViewManagerElectron::BindPrintManagerHost(std::move(receiver),
render_frame_host);
},
&render_frame_host));
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
associated_registry.AddInterface(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>
receiver) {
extensions::ExtensionWebContentsObserver::BindLocalFrameHost(
std::move(receiver), render_frame_host);
},
&render_frame_host));
associated_registry.AddInterface<extensions::mojom::LocalFrameHost>(
base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>
receiver) {
extensions::ExtensionWebContentsObserver::BindLocalFrameHost(
std::move(receiver), render_frame_host);
},
&render_frame_host));
#endif
#if BUILDFLAG(ENABLE_PDF_VIEWER)
associated_registry.AddInterface(base::BindRepeating(
associated_registry.AddInterface<pdf::mojom::PdfService>(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) {
pdf::PDFWebContentsHelper::BindPdfService(std::move(receiver),
@ -1697,9 +1702,10 @@ void ElectronBrowserClient::ExposeInterfacesToRenderer(
blink::AssociatedInterfaceRegistry* associated_registry,
content::RenderProcessHost* render_process_host) {
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
associated_registry->AddInterface(base::BindRepeating(
&extensions::EventRouter::BindForRenderer, render_process_host->GetID()));
associated_registry->AddInterface(
associated_registry->AddInterface<extensions::mojom::EventRouter>(
base::BindRepeating(&extensions::EventRouter::BindForRenderer,
render_process_host->GetID()));
associated_registry->AddInterface<extensions::mojom::GuestView>(
base::BindRepeating(&extensions::ExtensionsGuestView::CreateForExtensions,
render_process_host->GetID()));
#endif

View file

@ -220,10 +220,10 @@ void ElectronBrowserContext::InitPrefs() {
#endif
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
auto* current_dictionaries =
prefs()->Get(spellcheck::prefs::kSpellCheckDictionaries);
base::Value::List current_dictionaries =
prefs()->GetValueList(spellcheck::prefs::kSpellCheckDictionaries).Clone();
// No configured dictionaries, the default will be en-US
if (current_dictionaries->GetListDeprecated().empty()) {
if (current_dictionaries.empty()) {
std::string default_code = spellcheck::GetCorrespondingSpellCheckLanguage(
base::i18n::GetConfiguredLocale());
if (!default_code.empty()) {
@ -395,6 +395,13 @@ ElectronBrowserContext::GetStorageNotificationService() {
return nullptr;
}
content::ReduceAcceptLanguageControllerDelegate*
ElectronBrowserContext::GetReduceAcceptLanguageControllerDelegate() {
// Needs implementation
// Refs https://chromium-review.googlesource.com/c/chromium/src/+/3687391
return nullptr;
}
ResolveProxyHelper* ElectronBrowserContext::GetResolveProxyHelper() {
if (!resolve_proxy_helper_) {
resolve_proxy_helper_ = base::MakeRefCounted<ResolveProxyHelper>(this);

View file

@ -133,6 +133,8 @@ class ElectronBrowserContext : public content::BrowserContext {
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
override;
content::StorageNotificationService* GetStorageNotificationService() override;
content::ReduceAcceptLanguageControllerDelegate*
GetReduceAcceptLanguageControllerDelegate() override;
CookieChangeNotifier* cookie_change_notifier() const {
return cookie_change_notifier_.get();

View file

@ -374,7 +374,7 @@ void ElectronBrowserMainParts::PostDestroyThreads() {
void ElectronBrowserMainParts::ToolkitInitialized() {
#if BUILDFLAG(IS_LINUX)
auto linux_ui = ui::CreateLinuxUi();
auto* linux_ui = ui::GetDefaultLinuxUi();
// Try loading gtk symbols used by Electron.
electron::InitializeElectron_gtk(gtk::GetLibGtk());
@ -394,8 +394,8 @@ void ElectronBrowserMainParts::ToolkitInitialized() {
// Update the native theme when GTK theme changes. The GetNativeTheme
// here returns a NativeThemeGtk, which monitors GTK settings.
dark_theme_observer_ = std::make_unique<DarkThemeObserver>();
linux_ui->GetNativeTheme(nullptr)->AddObserver(dark_theme_observer_.get());
ui::LinuxUi::SetInstance(std::move(linux_ui));
linux_ui->GetNativeTheme()->AddObserver(dark_theme_observer_.get());
ui::LinuxUi::SetInstance(linux_ui);
// Cursor theme changes are tracked by LinuxUI (via a CursorThemeManager
// implementation). Start observing them once it's initialized.

View file

@ -253,6 +253,16 @@ blink::mojom::PermissionStatus ElectronPermissionManager::GetPermissionStatus(
: blink::mojom::PermissionStatus::DENIED;
}
content::PermissionResult
ElectronPermissionManager::GetPermissionResultForOriginWithoutContext(
blink::PermissionType permission,
const url::Origin& origin) {
blink::mojom::PermissionStatus status =
GetPermissionStatus(permission, origin.GetURL(), origin.GetURL());
return content::PermissionResult(
status, content::PermissionStatusSource::UNSPECIFIED);
}
ElectronPermissionManager::SubscriptionId
ElectronPermissionManager::SubscribePermissionStatusChange(
blink::PermissionType permission,

View file

@ -73,6 +73,7 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
const GURL& requesting_origin,
bool user_gesture,
StatusesCallback callback) override;
void RequestPermissionsWithDetails(
const std::vector<blink::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
@ -80,10 +81,6 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
base::Value::Dict details,
StatusesCallback callback);
blink::mojom::PermissionStatus GetPermissionStatusForCurrentDocument(
blink::PermissionType permission,
content::RenderFrameHost* render_frame_host) override;
bool CheckPermissionWithDetails(blink::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
@ -124,6 +121,12 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
base::OnceCallback<
void(const std::vector<blink::mojom::PermissionStatus>&)> callback)
override;
content::PermissionResult GetPermissionResultForOriginWithoutContext(
blink::PermissionType permission,
const url::Origin& origin) override;
blink::mojom::PermissionStatus GetPermissionStatusForCurrentDocument(
blink::PermissionType permission,
content::RenderFrameHost* render_frame_host) override;
blink::mojom::PermissionStatus GetPermissionStatusForWorker(
blink::PermissionType permission,
content::RenderProcessHost* render_process_host,

View file

@ -189,7 +189,7 @@ ExtensionFunction::ResponseAction TabsReloadFunction::Run() {
bool bypass_cache = false;
if (params->reload_properties.get() &&
params->reload_properties->bypass_cache.get()) {
params->reload_properties->bypass_cache) {
bypass_cache = *params->reload_properties->bypass_cache;
}
@ -217,7 +217,7 @@ ExtensionFunction::ResponseAction TabsGetFunction::Run() {
tabs::Tab tab;
tab.id = std::make_unique<int>(tab_id);
tab.id = tab_id;
// TODO(nornagon): in Chrome, the tab URL is only available to extensions
// that have the "tabs" (or "activeTab") permission. We should do the same
// permission check here.
@ -288,8 +288,8 @@ ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
contents->GetZoomController()->zoom_mode();
tabs::ZoomSettings zoom_settings;
ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
zoom_settings.default_zoom_factor = std::make_unique<double>(
blink::PageZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()));
zoom_settings.default_zoom_factor =
blink::PageZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel());
return RespondNow(
ArgumentList(tabs::GetZoomSettings::Results::Create(zoom_settings)));
@ -444,7 +444,7 @@ ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
return RespondNow(Error(std::move(error)));
}
if (params->update_properties.muted.get()) {
if (params->update_properties.muted) {
contents->SetAudioMuted(*params->update_properties.muted);
}
@ -502,8 +502,7 @@ ExtensionFunction::ResponseValue TabsUpdateFunction::GetResult() {
tabs::Tab tab;
auto* api_web_contents = electron::api::WebContents::From(web_contents_);
tab.id =
std::make_unique<int>(api_web_contents ? api_web_contents->ID() : -1);
tab.id = (api_web_contents ? api_web_contents->ID() : -1);
// TODO(nornagon): in Chrome, the tab URL is only available to extensions
// that have the "tabs" (or "activeTab") permission. We should do the same
// permission check here.

View file

@ -46,11 +46,11 @@ ElectronMessagingDelegate::MaybeGetTabInfo(content::WebContents* web_contents) {
auto* api_contents = electron::api::WebContents::From(web_contents);
if (api_contents) {
api::tabs::Tab tab;
tab.id = std::make_unique<int>(api_contents->ID());
tab.id = api_contents->ID();
tab.url = std::make_unique<std::string>(api_contents->GetURL().spec());
tab.title = std::make_unique<std::string>(
base::UTF16ToUTF8(api_contents->GetTitle()));
tab.audible = std::make_unique<bool>(api_contents->IsCurrentlyAudible());
tab.audible = api_contents->IsCurrentlyAudible();
return tab.ToValue();
}
}

View file

@ -7,8 +7,8 @@
#include <memory>
#include <string>
#include "base/allocator/allocator_shim.h"
#include "base/allocator/buildflags.h"
#include "base/allocator/partition_allocator/shim/allocator_shim.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_objc_class_swizzler.h"
#include "base/strings/sys_string_conversions.h"

2
shell/browser/microtasks_runner.cc Normal file → Executable file
View file

@ -29,7 +29,7 @@ void MicrotasksRunner::DidProcessTask(const base::PendingTask& pending_task) {
// up Node.js dealying its callbacks. To fix this, now we always lets Node.js
// handle the checkpoint in the browser process.
{
v8::HandleScope scope(isolate_);
v8::HandleScope handle_scope(isolate_);
node::CallbackScope microtasks_scope(isolate_, v8::Object::New(isolate_),
{0, 0});
}

6
shell/browser/native_window.cc Normal file → Executable file
View file

@ -98,11 +98,11 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options,
} else if (titlebar_overlay->IsObject()) {
titlebar_overlay_ = true;
gin_helper::Dictionary titlebar_overlay =
gin_helper::Dictionary titlebar_overlay_dict =
gin::Dictionary::CreateEmpty(options.isolate());
options.Get(options::ktitleBarOverlay, &titlebar_overlay);
options.Get(options::ktitleBarOverlay, &titlebar_overlay_dict);
int height;
if (titlebar_overlay.Get(options::kOverlayHeight, &height))
if (titlebar_overlay_dict.Get(options::kOverlayHeight, &height))
titlebar_overlay_height_ = height;
#if !(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC))

View file

@ -269,7 +269,8 @@ class AsarURLLoader : public network::mojom::URLLoader {
head->headers->AddHeader(net::HttpRequestHeaders::kContentType,
head->mime_type.c_str());
}
client_->OnReceiveResponse(std::move(head), std::move(consumer_handle));
client_->OnReceiveResponse(std::move(head), std::move(consumer_handle),
absl::nullopt);
if (total_bytes_to_send == 0) {
// There's definitely no more data, so we're already done.

12
shell/browser/net/electron_url_loader_factory.cc Normal file → Executable file
View file

@ -410,15 +410,15 @@ void ElectronURLLoaderFactory::StartLoading(
dict);
break;
case ProtocolType::kFree:
ProtocolType type;
if (!gin::ConvertFromV8(args->isolate(), response, &type)) {
ProtocolType protocol_type;
if (!gin::ConvertFromV8(args->isolate(), response, &protocol_type)) {
OnComplete(std::move(client), request_id,
network::URLLoaderCompletionStatus(net::ERR_FAILED));
return;
}
StartLoading(std::move(loader), request_id, options, request,
std::move(client), traffic_annotation,
std::move(target_factory), type, args);
std::move(target_factory), protocol_type, args);
break;
}
}
@ -566,7 +566,8 @@ void ElectronURLLoaderFactory::StartLoadingStream(
//
// Note that We must submit a empty body otherwise NetworkService would
// crash.
client_remote->OnReceiveResponse(std::move(head), std::move(consumer));
client_remote->OnReceiveResponse(std::move(head), std::move(consumer),
absl::nullopt);
producer.reset(); // The data pipe is empty.
client_remote->OnComplete(network::URLLoaderCompletionStatus(net::OK));
return;
@ -613,7 +614,8 @@ void ElectronURLLoaderFactory::SendContents(
return;
}
client_remote->OnReceiveResponse(std::move(head), std::move(consumer));
client_remote->OnReceiveResponse(std::move(head), std::move(consumer),
absl::nullopt);
auto write_data = std::make_unique<WriteData>();
write_data->client = std::move(client_remote);

View file

@ -58,7 +58,8 @@ void NodeStreamLoader::Start(network::mojom::URLResponseHeadPtr head) {
}
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
client_->OnReceiveResponse(std::move(head), std::move(consumer));
client_->OnReceiveResponse(std::move(head), std::move(consumer),
absl::nullopt);
auto weak = weak_factory_.GetWeakPtr();
On("end",

View file

@ -241,8 +241,10 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveEarlyHints(
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse(
network::mojom::URLResponseHeadPtr head,
mojo::ScopedDataPipeConsumerHandle body) {
mojo::ScopedDataPipeConsumerHandle body,
absl::optional<mojo_base::BigBuffer> cached_metadata) {
current_body_ = std::move(body);
current_cached_metadata_ = std::move(cached_metadata);
if (current_request_uses_header_client_) {
// Use the headers we got from OnHeadersReceived as that'll contain
// Set-Cookie if it existed.
@ -290,11 +292,6 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnUploadProgress(
std::move(callback));
}
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveCachedMetadata(
mojo_base::BigBuffer data) {
target_client_->OnReceiveCachedMetadata(std::move(data));
}
void ProxyingURLLoaderFactory::InProgressRequest::OnTransferSizeUpdated(
int32_t transfer_size_diff) {
target_client_->OnTransferSizeUpdated(transfer_size_diff);
@ -670,7 +667,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToResponseStarted(
factory_->web_request_api()->OnResponseStarted(&info_.value(), request_);
target_client_->OnReceiveResponse(current_response_.Clone(),
std::move(current_body_));
std::move(current_body_),
std::move(current_cached_metadata_));
}
void ProxyingURLLoaderFactory::InProgressRequest::ContinueToBeforeRedirect(

View file

@ -88,14 +88,15 @@ class ProxyingURLLoaderFactory
// network::mojom::URLLoaderClient:
void OnReceiveEarlyHints(
network::mojom::EarlyHintsPtr early_hints) override;
void OnReceiveResponse(network::mojom::URLResponseHeadPtr head,
mojo::ScopedDataPipeConsumerHandle body) override;
void OnReceiveResponse(
network::mojom::URLResponseHeadPtr head,
mojo::ScopedDataPipeConsumerHandle body,
absl::optional<mojo_base::BigBuffer> cached_metadata) override;
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
network::mojom::URLResponseHeadPtr head) override;
void OnUploadProgress(int64_t current_position,
int64_t total_size,
OnUploadProgressCallback callback) override;
void OnReceiveCachedMetadata(mojo_base::BigBuffer data) override;
void OnTransferSizeUpdated(int32_t transfer_size_diff) override;
void OnComplete(const network::URLLoaderCompletionStatus& status) override;
@ -183,6 +184,8 @@ class ProxyingURLLoaderFactory
};
std::unique_ptr<FollowRedirectParams> pending_follow_redirect_params_;
absl::optional<mojo_base::BigBuffer> current_cached_metadata_;
base::WeakPtrFactory<InProgressRequest> weak_factory_{this};
};

View file

@ -70,7 +70,8 @@ void URLPipeLoader::OnResponseStarted(
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
client_->OnReceiveResponse(response_head.Clone(), std::move(consumer));
client_->OnReceiveResponse(response_head.Clone(), std::move(consumer),
absl::nullopt);
}
void URLPipeLoader::OnWrite(base::OnceClosure resume, MojoResult result) {

View file

@ -246,7 +246,7 @@ void DesktopNotificationController::AnimateAll() {
break;
}
it = move(it2);
it = std::move(it2);
}
}
@ -280,12 +280,12 @@ DesktopNotificationController::AddNotification(std::u16string caption,
HBITMAP image) {
auto data = std::make_shared<NotificationData>();
data->controller = this;
data->caption = move(caption);
data->body_text = move(body_text);
data->caption = std::move(caption);
data->body_text = std::move(body_text);
data->image = CopyBitmap(image);
// Enqueue new notification
Notification ret{*queue_.insert(queue_.end(), move(data))};
Notification ret{*queue_.insert(queue_.end(), std::move(data))};
CheckQueue();
return ret;
}
@ -311,7 +311,7 @@ void DesktopNotificationController::CloseNotification(
void DesktopNotificationController::CheckQueue() {
while (instances_.size() < instances_.capacity() && !queue_.empty()) {
CreateToast(move(queue_.front()));
CreateToast(std::move(queue_.front()));
queue_.pop_front();
}
}
@ -409,8 +409,8 @@ void DesktopNotificationController::Notification::Set(std::u16string caption,
if (data_->image)
DeleteBitmap(data_->image);
data_->caption = move(caption);
data_->body_text = move(body_text);
data_->caption = std::move(caption);
data_->body_text = std::move(body_text);
data_->image = CopyBitmap(image);
auto* hwnd = data_->controller->GetToast(data_.get());

View file

@ -164,7 +164,8 @@ void OffScreenWebContentsView::StartDragging(
const content::DropData& drop_data,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const gfx::Vector2d& cursor_offset,
const gfx::Rect& drag_obj_rect,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) {
if (web_contents_)
@ -217,4 +218,6 @@ OffScreenRenderWidgetHostView* OffScreenWebContentsView::GetView() const {
return nullptr;
}
void OffScreenWebContentsView::FullscreenStateChanged(bool is_fullscreen) {}
} // namespace electron

View file

@ -63,6 +63,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
content::RenderViewHost* new_host) override;
void SetOverscrollControllerEnabled(bool enabled) override;
void OnCapturerCountChanged() override;
void FullscreenStateChanged(bool is_fullscreen) override;
#if BUILDFLAG(IS_MAC)
bool CloseTabAfterEventTrackingIfNeeded() override;
@ -72,7 +73,8 @@ class OffScreenWebContentsView : public content::WebContentsView,
void StartDragging(const content::DropData& drop_data,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const gfx::Vector2d& cursor_offset,
const gfx::Rect& drag_obj_rect,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) override;
void UpdateDragCursor(ui::mojom::DragOperation operation) override;

View file

@ -85,6 +85,8 @@ std::string PrintViewManagerElectron::PrintResultToString(PrintResult result) {
return "Page range is invalid (start > end)";
case kPageCountExceeded:
return "Page range exceeds page count";
case kPrintingInProgress:
return "Page is already being printed";
default:
NOTREACHED();
return "Unknown PrintResult";
@ -144,6 +146,9 @@ void PrintViewManagerElectron::OnDidPrintWithParams(
case printing::mojom::PrintFailureReason::kInvalidPageRange:
FailJob(kPageCountExceeded);
return;
case printing::mojom::PrintFailureReason::kPrintingInProgress:
FailJob(kPrintingInProgress);
return;
}
}

View file

@ -37,6 +37,7 @@ class PrintViewManagerElectron
kPageRangeSyntaxError,
kPageRangeInvalidRange,
kPageCountExceeded,
kPrintingInProgress
};
using PrintToPDFCallback =

View file

@ -31,8 +31,8 @@ std::string PathWithoutParams(const std::string& path) {
.substr(1);
}
std::string GetMimeTypeForPath(const std::string& path) {
std::string filename = PathWithoutParams(path);
std::string GetMimeTypeForUrl(const GURL& url) {
std::string filename = url.ExtractFileName();
if (base::EndsWith(filename, ".html", base::CompareCase::INSENSITIVE_ASCII)) {
return "text/html";
} else if (base::EndsWith(filename, ".css",
@ -95,8 +95,8 @@ class BundledDataSource : public content::URLDataSource {
std::move(callback).Run(nullptr);
}
std::string GetMimeType(const std::string& path) override {
return GetMimeTypeForPath(path);
std::string GetMimeType(const GURL& url) override {
return GetMimeTypeForUrl(url);
}
bool ShouldAddContentSecurityPolicy() override { return false; }

View file

@ -95,6 +95,9 @@ void ElectronDesktopWindowTreeHostLinux::UpdateWindowState(
break;
case ui::PlatformWindowState::kUnknown:
case ui::PlatformWindowState::kNormal:
case ui::PlatformWindowState::kSnappedPrimary:
case ui::PlatformWindowState::kSnappedSecondary:
case ui::PlatformWindowState::kFloated:
break;
}
switch (new_state) {
@ -109,6 +112,9 @@ void ElectronDesktopWindowTreeHostLinux::UpdateWindowState(
break;
case ui::PlatformWindowState::kUnknown:
case ui::PlatformWindowState::kNormal:
case ui::PlatformWindowState::kSnappedPrimary:
case ui::PlatformWindowState::kSnappedSecondary:
case ui::PlatformWindowState::kFloated:
break;
}
window_state_ = new_state;

View file

@ -349,7 +349,8 @@ InspectableWebContents::InspectableWebContents(
web_contents_(std::move(web_contents)),
is_guest_(is_guest),
view_(CreateInspectableContentsView(this)) {
const base::Value* bounds_dict = pref_service_->Get(kDevToolsBoundsPref);
const base::Value* bounds_dict =
&pref_service_->GetValue(kDevToolsBoundsPref);
if (bounds_dict->is_dict()) {
devtools_bounds_ = DictionaryToRect(bounds_dict);
// Sometimes the devtools window is out of screen or has too small size.

View file

@ -100,7 +100,8 @@ void WebViewGuestDelegate::ResetZoomController() {
}
}
content::WebContents* WebViewGuestDelegate::CreateNewGuestWindow(
std::unique_ptr<content::WebContents>
WebViewGuestDelegate::CreateNewGuestWindow(
const content::WebContents::CreateParams& create_params) {
// Code below mirrors what content::WebContentsImpl::CreateNewWindow
// does for non-guest sources
@ -117,9 +118,10 @@ content::WebContents* WebViewGuestDelegate::CreateNewGuestWindow(
guest_contents_impl->GetRenderViewHost()->GetWidget());
if (!create_params.initially_hidden)
widget_view->Show();
return guest_contents_impl;
return base::WrapUnique(
static_cast<content::WebContentsImpl*>(guest_contents_impl));
}
return guest_contents.release();
return guest_contents;
}
} // namespace electron

View file

@ -5,6 +5,8 @@
#ifndef ELECTRON_SHELL_BROWSER_WEB_VIEW_GUEST_DELEGATE_H_
#define ELECTRON_SHELL_BROWSER_WEB_VIEW_GUEST_DELEGATE_H_
#include <memory>
#include "content/public/browser/browser_plugin_guest_delegate.h"
#include "shell/browser/web_contents_zoom_controller.h"
@ -33,7 +35,7 @@ class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
protected:
// content::BrowserPluginGuestDelegate:
content::WebContents* GetOwnerWebContents() final;
content::WebContents* CreateNewGuestWindow(
std::unique_ptr<content::WebContents> CreateNewGuestWindow(
const content::WebContents::CreateParams& create_params) final;
// WebContentsZoomController::Observer:

View file

@ -6,12 +6,12 @@
#include <functional>
#include <memory>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "components/prefs/json_pref_store.h"
#include "components/prefs/pref_filter.h"
#include "components/prefs/pref_registry_simple.h"
@ -63,18 +63,11 @@ void ZoomLevelDelegate::SetDefaultZoomLevelPref(double level) {
}
double ZoomLevelDelegate::GetDefaultZoomLevelPref() const {
double default_zoom_level = 0.0;
const base::Value* default_zoom_level_dictionary =
pref_service_->GetDictionary(kPartitionDefaultZoomLevel);
const base::Value::Dict& default_zoom_level_dictionary =
pref_service_->GetValueDict(kPartitionDefaultZoomLevel);
// If no default has been previously set, the default returned is the
// value used to initialize default_zoom_level in this function.
absl::optional<double> maybe_default_zoom_level =
default_zoom_level_dictionary->FindDoubleKey(partition_key_);
if (maybe_default_zoom_level.has_value())
default_zoom_level = maybe_default_zoom_level.value();
return default_zoom_level;
return default_zoom_level_dictionary.FindDouble(partition_key_).value_or(0.0);
}
void ZoomLevelDelegate::OnZoomLevelChanged(
@ -84,35 +77,33 @@ void ZoomLevelDelegate::OnZoomLevelChanged(
double level = change.zoom_level;
DictionaryPrefUpdate update(pref_service_, kPartitionPerHostZoomLevels);
base::Value* host_zoom_dictionaries = update.Get();
DCHECK(host_zoom_dictionaries);
base::Value* host_zoom_update = update.Get();
DCHECK(host_zoom_update);
base::Value::Dict& host_zoom_dictionaries = host_zoom_update->GetDict();
bool modification_is_removal =
blink::PageZoomValuesEqual(level, host_zoom_map_->GetDefaultZoomLevel());
base::Value* host_zoom_dictionary =
host_zoom_dictionaries->FindDictKey(partition_key_);
base::Value::Dict* host_zoom_dictionary =
host_zoom_dictionaries.FindDict(partition_key_);
if (!host_zoom_dictionary) {
host_zoom_dictionaries->SetKey(partition_key_,
base::Value(base::Value::Type::DICTIONARY));
host_zoom_dictionary = host_zoom_dictionaries->FindDictKey(partition_key_);
base::Value::Dict dict;
host_zoom_dictionaries.Set(partition_key_, std::move(dict));
host_zoom_dictionary = host_zoom_dictionaries.FindDict(partition_key_);
}
if (modification_is_removal)
host_zoom_dictionary->RemoveKey(change.host);
host_zoom_dictionary->Remove(change.host);
else
host_zoom_dictionary->SetKey(change.host, base::Value(level));
host_zoom_dictionary->Set(change.host, base::Value(level));
}
void ZoomLevelDelegate::ExtractPerHostZoomLevels(
const base::DictionaryValue* host_zoom_dictionary) {
const base::Value::Dict& host_zoom_dictionary) {
std::vector<std::string> keys_to_remove;
std::unique_ptr<base::DictionaryValue> host_zoom_dictionary_copy =
host_zoom_dictionary->DeepCopyWithoutEmptyChildren();
for (base::DictionaryValue::Iterator i(*host_zoom_dictionary_copy);
!i.IsAtEnd(); i.Advance()) {
const std::string& host(i.key());
const absl::optional<double> zoom_level = i.value().GetIfDouble();
base::Value::Dict host_zoom_dictionary_copy = host_zoom_dictionary.Clone();
for (auto [host, value] : host_zoom_dictionary_copy) {
const absl::optional<double> zoom_level = value.GetIfDouble();
// Filter out A) the empty host, B) zoom levels equal to the default; and
// remember them, so that we can later erase them from Prefs.
@ -120,14 +111,14 @@ void ZoomLevelDelegate::ExtractPerHostZoomLevels(
// level was set to its current value. In either case, SetZoomLevelForHost
// will ignore type B values, thus, to have consistency with HostZoomMap's
// internal state, these values must also be removed from Prefs.
if (host.empty() || !zoom_level ||
blink::PageZoomValuesEqual(*zoom_level,
if (host.empty() || !zoom_level.has_value() ||
blink::PageZoomValuesEqual(zoom_level.value(),
host_zoom_map_->GetDefaultZoomLevel())) {
keys_to_remove.push_back(host);
continue;
}
host_zoom_map_->SetZoomLevelForHost(host, *zoom_level);
host_zoom_map_->SetZoomLevelForHost(host, zoom_level.value());
}
// Sanitize prefs to remove entries that match the default zoom level and/or
@ -155,16 +146,15 @@ void ZoomLevelDelegate::InitHostZoomMap(content::HostZoomMap* host_zoom_map) {
// Initialize the HostZoomMap with per-host zoom levels from the persisted
// zoom-level preference values.
const base::Value* host_zoom_dictionaries =
pref_service_->GetDictionary(kPartitionPerHostZoomLevels);
const base::Value* host_zoom_dictionary =
host_zoom_dictionaries->FindDictKey(partition_key_);
const base::Value::Dict& host_zoom_dictionaries =
pref_service_->GetValueDict(kPartitionPerHostZoomLevels);
const base::Value::Dict* host_zoom_dictionary =
host_zoom_dictionaries.FindDict(partition_key_);
if (host_zoom_dictionary) {
// Since we're calling this before setting up zoom_subscription_ below we
// don't need to worry that host_zoom_dictionary is indirectly affected
// by calls to HostZoomMap::SExtractPerHostZoomLevelsetZoomLevelForHost().
ExtractPerHostZoomLevels(
&base::Value::AsDictionaryValue(*host_zoom_dictionary));
ExtractPerHostZoomLevels(*host_zoom_dictionary);
}
zoom_subscription_ =
host_zoom_map_->AddZoomLevelChangedCallback(base::BindRepeating(

View file

@ -7,12 +7,12 @@
#include <string>
#include "base/values.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/zoom_level_delegate.h"
namespace base {
class DictionaryValue;
class FilePath;
} // namespace base
@ -45,8 +45,7 @@ class ZoomLevelDelegate : public content::ZoomLevelDelegate {
void InitHostZoomMap(content::HostZoomMap* host_zoom_map) override;
private:
void ExtractPerHostZoomLevels(
const base::DictionaryValue* host_zoom_dictionary);
void ExtractPerHostZoomLevels(const base::Value::Dict& host_zoom_dictionary);
// This is a callback function that receives notifications from HostZoomMap
// when per-host zoom levels change. It is used to update the per-host