chore: bump chromium to 98.0.4706.0 (main) (#31555)

* chore: bump chromium in DEPS to 97.0.4678.0

* chore: bump chromium in DEPS to 97.0.4679.0

* chore: bump chromium in DEPS to 97.0.4680.0

* chore: bump chromium in DEPS to 97.0.4681.0

* chore: bump chromium in DEPS to 97.0.4682.0

* chore: update patches

* 3234737: Disable -Wunused-but-set-variable

Ref: 3234737

* 3216953: Reland "Move task-related files from base/ to base/task/"

Ref: 3216953

* 3202710: TimeDelta factory function migration.

Ref: 3202710

* 3226841: Rename WCO::RenderProcessGone to PrimaryMainFrameRenderProcessGone

Ref: 3226841

* 3212165: blink/gin: changes blink to load snapshot based on runtime information

Ref: 3212165

* 3220292: Deprecate returning a GURL from GURL::GetOrigin()

Ref: 3220292

* 3231995: build: Enable -Wbitwise-instead-of-logical everywhere except iOS and Windows

Ref: 3231995

* 3205121: Remove base::DictionaryValue::GetDouble

Ref: 3205121

* 3208413: [flags] Make --js-flags settings have priority over V8 features

Ref: 3208413

* chore: bump chromium in DEPS to 97.0.4683.0

* chore: update patches

* 3188834: Combine RWHVBase GetCurrentDeviceScaleFactor/GetDeviceScaleFactor

Ref: 3188834

* chore: update process_singleton patches

* chore: bump chromium in DEPS to 97.0.4684.0

* chore: update patches

* chore: bump chromium in DEPS to 97.0.4685.0

* chore: update patches

* chore: bump chromium in DEPS to 97.0.4686.0

* chore: update patches

* chore: bump chromium in DEPS to 97.0.4687.0

* chore: update patches

* chore: bump chromium in DEPS to 97.0.4688.0

* chore: update patches

* 3247722: Use correct source_site_instance if navigating via context menu

Ref: 3247722

Update signature of HandleContextMenu()

* 3247722: Use correct source_site_instance if navigating via context menu

Ref: 3247722

Update signature of HandleContextMenu()

* 3223422: Remove PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE enum option

Ref: 3223422

sync pepper_plugin_support.patch with upstream

* chore: bump chromium in DEPS to 97.0.4689.0

* 3247791: ax_mac_merge: Merge AX Math attribute implementations

Xref: ax_mac_merge: Merge AX Math attribute implementations

chore: fix minor patch shear in #includes

* 3243425: Add VisibleTimeRequestTrigger helper class

Xref: 3243425

chore: fix minor patch shear in #includes

* chore: regen chromium patches

* fixup! 3247722: Use correct source_site_instance if navigating via context menu

* chore: bump chromium in DEPS to 97.0.4690.0

* 3188659: Window Placement: make GetScreenInfo(s) const

Xref: 3188659

simple sync GetScreenInfo with upstream refactor

* chore: update patches

* chore: bump chromium in DEPS to 97.0.4690.4

* chore: bump chromium in DEPS to 97.0.4692.0

* 3198073: ozone: //content: clean up from USE_X11

Xref: 3198073

Fixing patch shear. Nothing to see here.

* 3252338: Remove label images checkbox from chrome://accessibility page

Xref: 3252338

Part of our a11y patch is no longer needed due to upstream label removal

* 3258183: Remove DISALLOW_IMPLICIT_CONSTRUCTORS() definition

Xref: 3258183

Replace our use of the macro with explicitly-deleted class methods.
See 3256952
for upstream examples of this same replacement.

* chore: update patches

* 3247295: Unwind SecurityStyleExplanations

Xref: 3247295

update GetSecurityStyle() signature and impl to match upstream changes

* 3259578: media: grabs lock to ensure video output when occluded

Xref: 3259578

Add stub for new upstream virtual method OnCapturerCountChanged()

* fixup! 3247295: Unwind SecurityStyleExplanations

* 3238504: Fix up drag image is not shown from bookmark bar

Xref: 3238504

SetDragImage() no longer takes a widget argument

* 3217452: [devtools] Add getSyncInformation host binding

Xref: 3217452

Add stub for new upstream method GetSyncInformation(). Stub sends info back to caller saying that syncing is disabled.

* chore: bump chromium in DEPS to 98.0.4693.0

* chore: bump chromium in DEPS to 98.0.4694.0

* chore: bump chromium in DEPS to 98.0.4695.0

* chore: bump chromium in DEPS to 98.0.4696.0

* chore: bump chromium in DEPS to 98.0.4697.0

* chore: bump chromium in DEPS to 98.0.4699.0

* chore: bump chromium in DEPS to 98.0.4701.0

* chore: bump chromium in DEPS to 98.0.4703.0

* chore: bump chromium in DEPS to 98.0.4705.0

* chore: bump chromium in DEPS to 98.0.4706.0

* chore: update patches

* 3279210: Rename "base/macros.h" => "base/ignore_result.h"

3279210

* 3259964: Remove all DISALLOW_COPY_AND_ASSIGNs

3259964

* 3269029: blink/gin: sets histogram callbacks during isolate creation

3269029

* fixup after rebase

* [content] Make ContentMainParams and MainFunctionParams move-only

3244976

* 3255305: Stop sending the securityStateChanged event and unwind

3255305

* [Blink] Add promise support to WebLocalFrame::RequestExecuteScript()

3230010

* 3256162: Simplify RWHV Show and ShowWithVisibility handling

3256162

* 3263824: ozone: //ui/base: clean up from USE_X11 1/*

3263824

* Request or cancel RecordContentToPresentationTimeRequest during capture

3256802

* appcache: remove BrowsingData/quota references

3255725

* [Autofill] Don't show Autofill dropdown if overlaps with permissions

3236729

* Rename to_different_document to should_show_loading_ui in LoadingStateChanged() callbacks

3268574

* cleanup patch

* fixup [content] Make ContentMainParams and MainFunctionParams move-only

* 3279210: Rename "base/macros.h" => "base/ignore_result.h"

3279210

* ozone: //chrome/browser clean up from USE_X11

3186490
Refs: https://github.com/electron/electron/issues/31382

* chore: update support_mixed_sandbox_with_zygote.patch

* Enable -Wunused-but-set-variable.

Refs 3234737

* fixup! ozone: //ui/base: clean up from USE_X11 1/*

* fixup! ozone: //chrome/browser clean up from USE_X11

* chore: fix deprecation warning in libuv

* chore: fixup for lint

* 3251161: Reland "Make the Clang update.py script require Python 3"

3251161

* fixup: Enable -Wunused-but-set-variable.

* [base][win] Rename DIR_APP_DATA to DIR_ROAMING_APP_DATA

3262369

* Replace sandbox::policy::SandboxType with mojom Sandbox enum

3213677

* fixup: [content] Make ContentMainParams and MainFunctionParams move-only

* build: ensure angle has a full git checkout available to it

* fixup: [base][win] Rename DIR_APP_DATA to DIR_ROAMING_APP_DATA

* fixup lint

* [unseasoned-pdf] Dispatch 'afterprint' event in PDF plugin frame

3223434

* fixup: [Autofill] Don't show Autofill dropdown if overlaps with permissions

* 3217591: Move browser UI CSS color parsing to own file part 2/2

3217591

* Make kNoSandboxAndElevatedPrivileges only available to utilities

3276784

* 3211575: [modules] Change ScriptOrModule to custom Struct

3211575

* Address review feedback

* chore: update patches

* 3211575: [modules] Change ScriptOrModule to custom Struct

3211575

* fix: unused variable compat

* chore: remove redundant patch

* fixup for 3262517: Re-enable WindowCaptureMacV2

3262517

* chore: cleanup todo

The functions added in 3256802 are not used by offscreen rendering.

* fixup: update mas_no_private_api.patch

* 3216879: [PA] Make features::kPartitionAllocLazyCommit to be PartitionOptions::LazyCommit

Ref: 3216879 Fixes up commit b2f1aca95604ec61649808c846657454097e6935

* chore: cleanup support_mixed_sandbox_with_zygote.patch

* test: use window focus event instead of delay to wait for webContents focus

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
electron-roller[bot] 2021-11-24 09:45:59 +01:00 committed by GitHub
parent 065cad6d2c
commit bd10b19b0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
159 changed files with 1221 additions and 1047 deletions

View file

@ -2,6 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <utility>
#include "shell/app/electron_library_main.h"
#include "base/at_exit.h"
@ -21,7 +23,7 @@ int ElectronMain(int argc, char* argv[]) {
params.argc = argc;
params.argv = const_cast<const char**>(argv);
electron::ElectronCommandLine::Init(argc, argv);
return content::ContentMain(params);
return content::ContentMain(std::move(params));
}
#if BUILDFLAG(ENABLE_RUN_AS_NODE)

View file

@ -13,6 +13,7 @@
#if defined(OS_POSIX)
#include <sys/stat.h>
#include "base/ignore_result.h"
#endif
#if defined(OS_WIN)
@ -24,7 +25,6 @@
#include <tchar.h>
#include "base/environment.h"
#include "base/macros.h"
#include "base/process/launch.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
@ -289,7 +289,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
params.instance = instance;
params.sandbox_info = &sandbox_info;
electron::ElectronCommandLine::Init(arguments.argc, arguments.argv);
return content::ContentMain(params);
return content::ContentMain(std::move(params));
}
#elif defined(OS_LINUX) // defined(OS_WIN)
@ -315,7 +315,7 @@ int main(int argc, char* argv[]) {
// to Crashpad.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
::switches::kEnableCrashpad);
return content::ContentMain(params);
return content::ContentMain(std::move(params));
}
#else // defined(OS_LINUX)

View file

@ -7,6 +7,7 @@
#include <iostream>
#include <memory>
#include <string>
#include <utility>
#include "base/base_switches.h"
#include "base/command_line.h"
@ -143,7 +144,7 @@ bool ElectronPathProvider(int key, base::FilePath* result) {
#else
// On Windows, there's no OS-level centralized location for caches, so
// store the cache in the app data directory.
int parent_key = base::DIR_APP_DATA;
int parent_key = base::DIR_ROAMING_APP_DATA;
#endif
if (!base::PathService::Get(parent_key, &cur))
return false;
@ -443,13 +444,14 @@ ElectronMainDelegate::CreateContentUtilityClient() {
return utility_client_.get();
}
int ElectronMainDelegate::RunProcess(
absl::variant<int, content::MainFunctionParams>
ElectronMainDelegate::RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) {
content::MainFunctionParams main_function_params) {
if (process_type == kRelauncherProcess)
return relauncher::RelauncherMain(main_function_params);
else
return -1;
return std::move(main_function_params);
}
bool ElectronMainDelegate::ShouldCreateFeatureList() {

View file

@ -40,9 +40,9 @@ class ElectronMainDelegate : public content::ContentMainDelegate {
content::ContentGpuClient* CreateContentGpuClient() override;
content::ContentRendererClient* CreateContentRendererClient() override;
content::ContentUtilityClient* CreateContentUtilityClient() override;
int RunProcess(
absl::variant<int, content::MainFunctionParams> RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) override;
content::MainFunctionParams main_function_params) override;
bool ShouldCreateFeatureList() override;
bool ShouldLockSchemeRegistry() override;
#if defined(OS_LINUX)

View file

@ -186,7 +186,7 @@ int NodeMain(int argc, char* argv[]) {
exit(result.exit_code);
gin::V8Initializer::LoadV8Snapshot(
gin::V8Initializer::V8SnapshotFileType::kWithAdditionalContext);
gin::V8SnapshotFileType::kWithAdditionalContext);
// V8 requires a task scheduler.
base::ThreadPoolInstance::CreateAndStartWithDefaultParams("Electron");

View file

@ -8,7 +8,7 @@
#include <map>
#include "base/callback.h"
#include "base/single_thread_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "uv.h" // NOLINT(build/include_directory)
namespace base {

View file

@ -477,7 +477,7 @@ int GetPathConstant(const std::string& name) {
#if defined(OS_POSIX)
return base::DIR_CACHE;
#else
return base::DIR_APP_DATA;
return base::DIR_ROAMING_APP_DATA;
#endif
else if (name == "userCache")
return DIR_USER_CACHE;
@ -1146,7 +1146,7 @@ bool App::Relaunch(gin::Arguments* js_args) {
gin_helper::Dictionary options;
if (js_args->GetNext(&options)) {
if (options.Get("execPath", &exec_path) | options.Get("args", &args))
if (options.Get("execPath", &exec_path) || options.Get("args", &args))
override_argv = true;
}

View file

@ -471,7 +471,7 @@ void BrowserWindow::ScheduleUnresponsiveEvent(int ms) {
&BrowserWindow::NotifyWindowUnresponsive, GetWeakPtr()));
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, window_unresponsive_closure_.callback(),
base::TimeDelta::FromMilliseconds(ms));
base::Milliseconds(ms));
}
void BrowserWindow::NotifyWindowUnresponsive() {

View file

@ -10,8 +10,8 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/task/task_runner_util.h"
#include "base/task/thread_pool.h"
#include "base/task_runner_util.h"
#include "chrome/browser/browser_process.h"
#include "components/net_log/chrome_net_log.h"
#include "content/public/browser/storage_partition.h"

View file

@ -124,9 +124,7 @@ uint32_t GetStorageMask(const std::vector<std::string>& storage_types) {
uint32_t storage_mask = 0;
for (const auto& it : storage_types) {
auto type = base::ToLowerASCII(it);
if (type == "appcache")
storage_mask |= StoragePartition::REMOVE_DATA_MASK_APPCACHE;
else if (type == "cookies")
if (type == "cookies")
storage_mask |= StoragePartition::REMOVE_DATA_MASK_COOKIES;
else if (type == "filesystem")
storage_mask |= StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS;
@ -569,7 +567,7 @@ void Session::EnableNetworkEmulation(const gin_helper::Dictionary& options) {
options.Get("uploadThroughput", &conditions->upload_throughput);
double latency = 0.0;
if (options.Get("latency", &latency) && latency) {
conditions->latency = base::TimeDelta::FromMillisecondsD(latency);
conditions->latency = base::Milliseconds(latency);
}
auto* network_context =

View file

@ -16,9 +16,9 @@
#include "base/mac/scoped_cftyperef.h"
#include "base/mac/sdk_forward_declarations.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/values.h"
#include "chrome/browser/media/webrtc/system_media_capture_permissions_mac.h"

View file

@ -14,8 +14,8 @@
#include "base/containers/id_map.h"
#include "base/files/file_util.h"
#include "base/ignore_result.h"
#include "base/json/json_reader.h"
#include "base/macros.h"
#include "base/no_destructor.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/current_thread.h"
@ -54,8 +54,6 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/security_style_explanation.h"
#include "content/public/browser/security_style_explanations.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h"
@ -402,9 +400,8 @@ absl::optional<base::TimeDelta> GetCursorBlinkInterval() {
#elif defined(OS_WIN)
const auto system_msec = ::GetCaretBlinkTime();
if (system_msec != 0) {
return (system_msec == INFINITE)
? base::TimeDelta()
: base::TimeDelta::FromMilliseconds(system_msec);
return (system_msec == INFINITE) ? base::TimeDelta()
: base::Milliseconds(system_msec);
}
#endif
return absl::nullopt;
@ -540,7 +537,7 @@ FileSystem CreateFileSystemStruct(content::WebContents* web_contents,
const std::string& file_system_id,
const std::string& file_system_path,
const std::string& type) {
const GURL origin = web_contents->GetURL().GetOrigin();
const GURL origin = web_contents->GetURL().DeprecatedGetOriginAsURL();
std::string file_system_name =
storage::GetIsolatedFileSystemName(origin, file_system_id);
std::string root_url = storage::GetIsolatedFileSystemRootURIString(
@ -1356,9 +1353,9 @@ void WebContents::RendererResponsive(
Emit("responsive");
}
bool WebContents::HandleContextMenu(content::RenderFrameHost* render_frame_host,
bool WebContents::HandleContextMenu(content::RenderFrameHost& render_frame_host,
const content::ContextMenuParams& params) {
Emit("context-menu", std::make_pair(params, render_frame_host));
Emit("context-menu", std::make_pair(params, &render_frame_host));
return true;
}
@ -1565,7 +1562,8 @@ void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
}
}
void WebContents::RenderProcessGone(base::TerminationStatus status) {
void WebContents::PrimaryMainFrameRenderProcessGone(
base::TerminationStatus status) {
auto weak_this = GetWeakPtr();
Emit("crashed", status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED);
@ -2180,7 +2178,7 @@ bool WebContents::IsLoading() const {
}
bool WebContents::IsLoadingMainFrame() const {
return web_contents()->IsLoadingToDifferentDocument();
return web_contents()->ShouldShowLoadingUI();
}
bool WebContents::IsWaitingForResponse() const {
@ -2277,8 +2275,8 @@ std::string WebContents::GetMediaSourceID(
content::DesktopStreamsRegistry::GetInstance()->RegisterStream(
request_frame_host->GetProcess()->GetID(),
request_frame_host->GetRoutingID(),
url::Origin::Create(
request_frame_host->GetLastCommittedURL().GetOrigin()),
url::Origin::Create(request_frame_host->GetLastCommittedURL()
.DeprecatedGetOriginAsURL()),
media_id, "", content::kRegistryStreamTypeTab);
return id;
@ -3460,15 +3458,6 @@ bool WebContents::IsFullscreenForTabOrPending(
return html_fullscreen_;
}
blink::SecurityStyle WebContents::GetSecurityStyle(
content::WebContents* web_contents,
content::SecurityStyleExplanations* security_style_explanations) {
auto state = security_state::GetVisibleSecurityState(web_contents);
auto security_level = security_state::GetSecurityLevel(*state, false);
return security_state::GetSecurityStyle(security_level, *state,
security_style_explanations);
}
bool WebContents::TakeFocus(content::WebContents* source, bool reverse) {
if (source && source->GetOutermostWebContents() == source) {
// If this is the outermost web contents and the user has tabbed or

View file

@ -548,7 +548,7 @@ class WebContents : public ExclusiveAccessContext,
void RendererResponsive(
content::WebContents* source,
content::RenderWidgetHost* render_widget_host) override;
bool HandleContextMenu(content::RenderFrameHost* render_frame_host,
bool HandleContextMenu(content::RenderFrameHost& render_frame_host,
const content::ContextMenuParams& params) override;
bool OnGoToEntryOffset(int offset) override;
void FindReply(content::WebContents* web_contents,
@ -585,7 +585,8 @@ class WebContents : public ExclusiveAccessContext,
content::RenderFrameHost* new_host) override;
void FrameDeleted(int frame_tree_node_id) override;
void RenderViewDeleted(content::RenderViewHost*) override;
void RenderProcessGone(base::TerminationStatus status) override;
void PrimaryMainFrameRenderProcessGone(
base::TerminationStatus status) override;
void DOMContentLoaded(content::RenderFrameHost* render_frame_host) override;
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;
@ -677,9 +678,6 @@ class WebContents : public ExclusiveAccessContext,
bool IsExclusiveAccessBubbleDisplayed() const override;
bool IsFullscreenForTabOrPending(const content::WebContents* source) override;
blink::SecurityStyle GetSecurityStyle(
content::WebContents* web_contents,
content::SecurityStyleExplanations* explanations) override;
bool TakeFocus(content::WebContents* source, bool reverse) override;
content::PictureInPictureResult EnterPictureInPicture(
content::WebContents* web_contents,

View file

@ -51,8 +51,7 @@ void FrameSubscriber::AttachToHost(content::RenderWidgetHost* host) {
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB,
gfx::ColorSpace::CreateREC709());
video_capturer_->SetMinCapturePeriod(base::TimeDelta::FromSeconds(1) /
kMaxFrameRate);
video_capturer_->SetMinCapturePeriod(base::Seconds(1) / kMaxFrameRate);
video_capturer_->Start(this);
}

View file

@ -403,7 +403,7 @@ void Browser::DockHide() {
// immediately after DockShow. After some experiments, 1 second seems to be
// a proper interval.
if (!last_dock_show_.is_null() &&
base::Time::Now() - last_dock_show_ < base::TimeDelta::FromSeconds(1)) {
base::Time::Now() - last_dock_show_ < base::Seconds(1)) {
return;
}

View file

@ -918,8 +918,9 @@ ElectronBrowserClient::GetSystemNetworkContext() {
std::unique_ptr<content::BrowserMainParts>
ElectronBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& params) {
auto browser_main_parts = std::make_unique<ElectronBrowserMainParts>(params);
content::MainFunctionParams params) {
auto browser_main_parts =
std::make_unique<ElectronBrowserMainParts>(std::move(params));
#if defined(OS_MAC)
browser_main_parts_ = browser_main_parts.get();
@ -1437,10 +1438,9 @@ void ElectronBrowserClient::OverrideURLLoaderFactoryParams(
}
#if defined(OS_WIN)
bool ElectronBrowserClient::PreSpawnChild(
sandbox::TargetPolicy* policy,
sandbox::policy::SandboxType sandbox_type,
ChildSpawnFlags flags) {
bool ElectronBrowserClient::PreSpawnChild(sandbox::TargetPolicy* policy,
sandbox::mojom::Sandbox sandbox_type,
ChildSpawnFlags flags) {
// Allow crashpad to communicate via named pipe.
sandbox::ResultCode result = policy->AddRule(
sandbox::TargetPolicy::SUBSYS_FILES,

View file

@ -180,7 +180,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
std::unique_ptr<content::DevToolsManagerDelegate>
CreateDevToolsManagerDelegate() override;
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
const content::MainFunctionParams&) override;
content::MainFunctionParams params) override;
base::FilePath GetDefaultDownloadDirectory() override;
scoped_refptr<network::SharedURLLoaderFactory>
GetSystemSharedURLLoaderFactory() override;
@ -232,7 +232,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
network::mojom::URLLoaderFactoryParams* factory_params) override;
#if defined(OS_WIN)
bool PreSpawnChild(sandbox::TargetPolicy* policy,
sandbox::policy::SandboxType sandbox_type,
sandbox::mojom::Sandbox sandbox_type,
ChildSpawnFlags flags) override;
#endif
bool BindAssociatedReceiverFromFrame(

View file

@ -64,26 +64,15 @@
#if defined(OS_LINUX)
#include "base/environment.h"
#include "base/threading/thread_task_runner_handle.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/dbus/dbus_bluez_manager_wrapper_linux.h"
#include "ui/base/cursor/cursor_factory.h"
#include "ui/base/ime/linux/linux_input_method_context_factory.h"
#include "ui/gfx/color_utils.h"
#include "ui/gtk/gtk_ui_factory.h"
#include "ui/gtk/gtk_util.h"
#include "ui/views/linux_ui/linux_ui.h"
#if defined(USE_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif
#if defined(USE_X11)
#include "ui/base/x/x11_util.h"
#include "ui/events/devices/x11/touch_factory_x11.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/x/connection.h"
#include "ui/gfx/x/xproto_util.h"
#endif
#if defined(USE_OZONE) || defined(USE_X11)
#include "ui/base/ui_base_features.h"
#endif
#include "ui/views/linux_ui/linux_ui.h"
#endif
#if defined(OS_WIN)
@ -100,11 +89,6 @@
#include "shell/browser/ui/views/electron_views_delegate.h"
#endif
#if defined(OS_LINUX)
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/dbus/dbus_bluez_manager_wrapper_linux.h"
#endif
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/browser_context_keyed_service_factories.h"
@ -227,6 +211,9 @@ int ElectronBrowserMainParts::PreEarlyInitialization() {
#if defined(OS_POSIX)
HandleSIGCHLD();
#endif
#if defined(OS_LINUX)
ui::OzonePlatform::PreEarlyInitialization();
#endif
return GetExitCode();
}
@ -375,6 +362,7 @@ void ElectronBrowserMainParts::ToolkitInitialized() {
#if defined(OS_LINUX)
auto linux_ui = BuildGtkUi();
linux_ui->Initialize();
DCHECK(ui::LinuxInputMethodContextFactory::instance());
// Chromium does not respect GTK dark theme setting, but they may change
// in future and this code might be no longer needed. Check the Chromium
@ -386,6 +374,10 @@ void ElectronBrowserMainParts::ToolkitInitialized() {
dark_theme_observer_ = std::make_unique<DarkThemeObserver>();
linux_ui->GetNativeTheme(nullptr)->AddObserver(dark_theme_observer_.get());
views::LinuxUI::SetInstance(std::move(linux_ui));
// Cursor theme changes are tracked by LinuxUI (via a CursorThemeManager
// implementation). Start observing them once it's initialized.
ui::CursorFactory::GetInstance()->ObserveThemeChanges();
#endif
#if defined(USE_AURA)
@ -430,10 +422,6 @@ int ElectronBrowserMainParts::PreMainMessageLoopRun() {
SpellcheckServiceFactory::GetInstance();
#endif
#if defined(USE_X11)
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
#endif
content::WebUIControllerFactory::RegisterFactory(
ElectronWebUIControllerFactory::GetInstance());
@ -471,15 +459,11 @@ void ElectronBrowserMainParts::WillRunMainMessageLoop(
}
void ElectronBrowserMainParts::PostCreateMainMessageLoop() {
#if defined(USE_OZONE)
if (features::IsUsingOzonePlatform()) {
auto shutdown_cb =
base::BindOnce(base::RunLoop::QuitCurrentWhenIdleClosureDeprecated());
ui::OzonePlatform::GetInstance()->PostCreateMainMessageLoop(
std::move(shutdown_cb));
}
#endif
#if defined(OS_LINUX)
auto shutdown_cb =
base::BindOnce(base::RunLoop::QuitCurrentWhenIdleClosureDeprecated());
ui::OzonePlatform::GetInstance()->PostCreateMainMessageLoop(
std::move(shutdown_cb));
bluez::DBusBluezManagerWrapperLinux::Initialize();
#endif
#if defined(OS_POSIX)
@ -519,6 +503,10 @@ void ElectronBrowserMainParts::PostMainMessageLoopRun() {
fake_browser_process_->PostMainMessageLoopRun();
content::DevToolsAgentHost::StopRemoteDebuggingPipeHandler();
#if defined(OS_LINUX)
ui::OzonePlatform::GetInstance()->PostMainMessageLoopRun();
#endif
}
#if !defined(OS_MAC)

View file

@ -9,7 +9,7 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/macros.h"
#include "base/ignore_result.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/common/pref_names.h"

View file

@ -46,7 +46,7 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog(
if (origin_url.SchemeIsFile()) {
origin = origin_url.path();
} else {
origin = origin_url.GetOrigin().spec();
origin = origin_url.DeprecatedGetOriginAsURL().spec();
}
if (origin_counts_[origin] == kUserWantsNoMoreDialogs) {

View file

@ -11,10 +11,10 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_runner_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_runner_util.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "extensions/browser/extension_file_task_runner.h"

View file

@ -8,7 +8,7 @@
#include <string>
#include <vector>
#include "base/sequenced_task_runner_helpers.h"
#include "base/task/sequenced_task_runner_helpers.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/common/extension_l10n_util.h"

View file

@ -64,7 +64,7 @@ class ElectronMimeHandlerViewGuestDelegate
const ElectronMimeHandlerViewGuestDelegate&) = delete;
// MimeHandlerViewGuestDelegate.
bool HandleContextMenu(content::WebContents* web_contents,
bool HandleContextMenu(content::RenderFrameHost& render_frame_host,
const content::ContextMenuParams& params) override {
// TODO(nornagon): surface this event to JS
LOG(INFO) << "HCM";

View file

@ -9,18 +9,20 @@
#include <unordered_set>
#include <utility>
#include "base/allocator/partition_alloc_features.h"
#include "base/allocator/partition_allocator/partition_alloc.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/task/current_thread.h"
#include "base/task/thread_pool/initialization_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "content/public/common/content_switches.h"
#include "gin/array_buffer.h"
#include "gin/v8_initializer.h"
#include "shell/browser/microtasks_runner.h"
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
#include "shell/common/node_includes.h"
#include "third_party/blink/public/common/switches.h"
namespace {
v8::Isolate* g_isolate;
@ -74,6 +76,11 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
public:
enum InitializationPolicy { kZeroInitialize, kDontInitialize };
base::PartitionOptions::LazyCommit lazy_commit =
base::FeatureList::IsEnabled(base::features::kPartitionAllocLazyCommit)
? base::PartitionOptions::LazyCommit::kEnabled
: base::PartitionOptions::LazyCommit::kDisabled;
ArrayBufferAllocator() {
// Ref.
// https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/wtf/allocator/partitions.cc;l=94;drc=062c315a858a87f834e16a144c2c8e9591af2beb
@ -82,7 +89,8 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
base::PartitionOptions::Quarantine::kAllowed,
base::PartitionOptions::Cookie::kAllowed,
base::PartitionOptions::BackupRefPtr::kDisabled,
base::PartitionOptions::UseConfigurablePool::kNo});
base::PartitionOptions::UseConfigurablePool::kNo,
lazy_commit});
}
// Allocate() methods return null to signal allocation failure to V8, which
@ -152,6 +160,8 @@ JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop)
gin::IsolateHolder::kAllowAtomicsWait,
gin::IsolateHolder::IsolateType::kUtility,
gin::IsolateHolder::IsolateCreationMode::kNormal,
nullptr,
nullptr,
isolate_),
locker_(isolate_) {
isolate_->Enter();
@ -293,8 +303,7 @@ class TracingControllerImpl : public node::tracing::TracingController {
arg_convertables);
DCHECK_LE(num_args, 2);
base::TimeTicks timestamp =
base::TimeTicks() +
base::TimeDelta::FromMicroseconds(timestampMicroseconds);
base::TimeTicks() + base::Microseconds(timestampMicroseconds);
base::trace_event::TraceEventHandle handle =
TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(
phase, category_enabled_flag, name, scope, id, bind_id,
@ -323,7 +332,8 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
auto* cmd = base::CommandLine::ForCurrentProcess();
// --js-flags.
std::string js_flags = cmd->GetSwitchValueASCII(switches::kJavaScriptFlags);
std::string js_flags =
cmd->GetSwitchValueASCII(blink::switches::kJavaScriptFlags);
if (!js_flags.empty())
v8::V8::SetFlagsFromString(js_flags.c_str(), js_flags.size());
@ -337,9 +347,10 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
tracing_controller, gin::V8Platform::PageAllocator());
v8::V8::InitializePlatform(platform_);
gin::IsolateHolder::Initialize(
gin::IsolateHolder::kNonStrictMode, new ArrayBufferAllocator(),
nullptr /* external_reference_table */, false /* create_v8_platform */);
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
new ArrayBufferAllocator(),
nullptr /* external_reference_table */,
js_flags, false /* create_v8_platform */);
v8::Isolate* isolate = v8::Isolate::Allocate();
platform_->RegisterIsolate(isolate, event_loop);

View file

@ -136,12 +136,12 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
extensions::SizeConstraints size_constraints(
use_content_size ? GetContentSizeConstraints() : GetSizeConstraints());
int min_height = 0, min_width = 0;
if (options.Get(options::kMinHeight, &min_height) |
if (options.Get(options::kMinHeight, &min_height) ||
options.Get(options::kMinWidth, &min_width)) {
size_constraints.set_minimum_size(gfx::Size(min_width, min_height));
}
int max_height = INT_MAX, max_width = INT_MAX;
if (options.Get(options::kMaxHeight, &max_height) |
if (options.Get(options::kMaxHeight, &max_height) ||
options.Get(options::kMaxWidth, &max_width)) {
size_constraints.set_maximum_size(gfx::Size(max_width, max_height));
}

View file

@ -70,7 +70,7 @@
#elif defined(OS_WIN)
#include "base/win/win_util.h"
#include "extensions/common/image_util.h"
#include "content/public/common/color_parser.h"
#include "shell/browser/ui/views/win_frame_view.h"
#include "shell/browser/ui/win/electron_desktop_native_widget_aura.h"
#include "skia/ext/skia_utils_win.h"
@ -189,16 +189,16 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
std::string overlay_color_string;
if (titlebar_overlay_obj.Get(options::kOverlayButtonColor,
&overlay_color_string)) {
bool success = extensions::image_util::ParseCssColorString(
overlay_color_string, &overlay_button_color_);
bool success = content::ParseCssColorString(overlay_color_string,
&overlay_button_color_);
DCHECK(success);
}
std::string overlay_symbol_color_string;
if (titlebar_overlay_obj.Get(options::kOverlaySymbolColor,
&overlay_symbol_color_string)) {
bool success = extensions::image_util::ParseCssColorString(
overlay_symbol_color_string, &overlay_symbol_color_);
bool success = content::ParseCssColorString(overlay_symbol_color_string,
&overlay_symbol_color_);
DCHECK(success);
}
}

View file

@ -12,8 +12,8 @@
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "base/task/post_task.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
@ -297,7 +297,8 @@ bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() {
return GetDelegatedFrameHost()->CanCopyFromCompositingSurface();
}
void OffScreenRenderWidgetHostView::Show() {
void OffScreenRenderWidgetHostView::ShowWithVisibility(
content::PageVisibilityState /*page_visibility*/) {
if (is_showing_)
return;
@ -480,16 +481,17 @@ void OffScreenRenderWidgetHostView::CopyFromSurface(
std::move(callback));
}
void OffScreenRenderWidgetHostView::GetScreenInfo(
display::ScreenInfo* screen_info) {
screen_info->depth = 24;
screen_info->depth_per_component = 8;
screen_info->orientation_angle = 0;
screen_info->device_scale_factor = GetCurrentDeviceScaleFactor();
screen_info->orientation_type =
display::ScreenInfo OffScreenRenderWidgetHostView::GetScreenInfo() const {
display::ScreenInfo screen_info;
screen_info.depth = 24;
screen_info.depth_per_component = 8;
screen_info.orientation_angle = 0;
screen_info.device_scale_factor = GetDeviceScaleFactor();
screen_info.orientation_type =
display::mojom::ScreenOrientation::kLandscapePrimary;
screen_info->rect = gfx::Rect(size_);
screen_info->available_rect = gfx::Rect(size_);
screen_info.rect = gfx::Rect(size_);
screen_info.available_rect = gfx::Rect(size_);
return screen_info;
}
void OffScreenRenderWidgetHostView::TransformPointToRootSurface(
@ -525,7 +527,7 @@ void OffScreenRenderWidgetHostView::ImeCompositionRangeChanged(
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize() {
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
GetCurrentDeviceScaleFactor());
GetDeviceScaleFactor());
}
ui::Compositor* OffScreenRenderWidgetHostView::GetCompositor() {
@ -685,7 +687,7 @@ void OffScreenRenderWidgetHostView::OnPaint(const gfx::Rect& damage_rect,
}
gfx::Size OffScreenRenderWidgetHostView::SizeInPixels() {
float sf = GetCurrentDeviceScaleFactor();
float sf = GetDeviceScaleFactor();
if (IsPopupWidget()) {
return gfx::ToFlooredSize(
gfx::ConvertSizeToPixels(popup_position_.size(), sf));
@ -707,7 +709,7 @@ void OffScreenRenderWidgetHostView::CompositeFrame(
if (proxy_views_.empty() && !popup_host_view_) {
frame = GetBacking();
} else {
float sf = GetCurrentDeviceScaleFactor();
float sf = GetDeviceScaleFactor();
frame.allocN32Pixels(size_in_pixels.width(), size_in_pixels.height(),
false);
if (!GetBacking().drawsNothing()) {
@ -742,13 +744,13 @@ void OffScreenRenderWidgetHostView::CompositeFrame(
void OffScreenRenderWidgetHostView::OnPopupPaint(const gfx::Rect& damage_rect) {
InvalidateBounds(gfx::ToEnclosingRect(
gfx::ConvertRectToPixels(damage_rect, GetCurrentDeviceScaleFactor())));
gfx::ConvertRectToPixels(damage_rect, GetDeviceScaleFactor())));
}
void OffScreenRenderWidgetHostView::OnProxyViewPaint(
const gfx::Rect& damage_rect) {
InvalidateBounds(gfx::ToEnclosingRect(
gfx::ConvertRectToPixels(damage_rect, GetCurrentDeviceScaleFactor())));
gfx::ConvertRectToPixels(damage_rect, GetDeviceScaleFactor())));
}
void OffScreenRenderWidgetHostView::HoldResize() {
@ -974,8 +976,7 @@ void OffScreenRenderWidgetHostView::SetupFrameRate(bool force) {
if (compositor_) {
compositor_->SetDisplayVSyncParameters(
base::TimeTicks::Now(),
base::TimeDelta::FromMicroseconds(frame_rate_threshold_us_));
base::TimeTicks::Now(), base::Microseconds(frame_rate_threshold_us_));
}
}
@ -993,7 +994,7 @@ void OffScreenRenderWidgetHostView::ResizeRootLayer(bool force) {
display::Display display =
display::Screen::GetScreen()->GetDisplayNearestView(GetNativeView());
const float scaleFactor = display.device_scale_factor();
float sf = GetCurrentDeviceScaleFactor();
float sf = GetDeviceScaleFactor();
const bool scaleFactorDidChange = scaleFactor != sf;
// Initialize a screen_infos_ struct as needed, to cache the scale factor.
@ -1056,4 +1057,19 @@ void OffScreenRenderWidgetHostView::UpdateBackgroundColorFromRenderer(
GetRootLayer()->SetColor(color);
}
void OffScreenRenderWidgetHostView::NotifyHostAndDelegateOnWasShown(
blink::mojom::RecordContentToVisibleTimeRequestPtr) {
NOTREACHED();
}
void OffScreenRenderWidgetHostView::RequestPresentationTimeFromHostOrDelegate(
blink::mojom::RecordContentToVisibleTimeRequestPtr) {
NOTREACHED();
}
void OffScreenRenderWidgetHostView::
CancelPresentationTimeRequestForHostAndDelegate() {
NOTREACHED();
}
} // namespace electron

View file

@ -27,6 +27,7 @@
#include "shell/browser/osr/osr_host_display_client.h"
#include "shell/browser/osr/osr_video_consumer.h"
#include "shell/browser/osr/osr_view_proxy.h"
#include "third_party/blink/public/mojom/widget/record_content_to_visible_time_request.mojom-forward.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/ime/text_input_client.h"
@ -85,7 +86,6 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
bool HasFocus(void) override;
uint32_t GetCaptureSequenceNumber() const override;
bool IsSurfaceAvailableForCopy(void) override;
void Show(void) override;
void Hide(void) override;
bool IsShowing(void) override;
void EnsureSurfaceSynchronizedForWebTest() override;
@ -126,6 +126,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void TextInputStateChanged(const ui::mojom::TextInputState& params) override;
void ImeCancelComposition(void) override;
void RenderProcessGone() override;
void ShowWithVisibility(content::PageVisibilityState page_visibility) final;
void Destroy(void) override;
void UpdateTooltipUnderCursor(const std::u16string&) override;
content::CursorManager* GetCursorManager() override;
@ -133,12 +134,17 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
const gfx::Rect& src_rect,
const gfx::Size& output_size,
base::OnceCallback<void(const SkBitmap&)> callback) override;
void GetScreenInfo(display::ScreenInfo* screen_info) override;
display::ScreenInfo GetScreenInfo() const override;
void TransformPointToRootSurface(gfx::PointF* point) override;
gfx::Rect GetBoundsInRootWindow(void) override;
absl::optional<content::DisplayFeature> GetDisplayFeature() override;
void SetDisplayFeatureForTesting(
const content::DisplayFeature* display_feature) override;
void NotifyHostAndDelegateOnWasShown(
blink::mojom::RecordContentToVisibleTimeRequestPtr) final;
void RequestPresentationTimeFromHostOrDelegate(
blink::mojom::RecordContentToVisibleTimeRequestPtr) final;
void CancelPresentationTimeRequestForHostAndDelegate() final;
viz::SurfaceId GetCurrentSurfaceId() const override;
std::unique_ptr<content::SyntheticGestureTarget>
CreateSyntheticGestureTarget() override;

View file

@ -40,8 +40,7 @@ void OffScreenVideoConsumer::SetActive(bool active) {
}
void OffScreenVideoConsumer::SetFrameRate(int frame_rate) {
video_capturer_->SetMinCapturePeriod(base::TimeDelta::FromSeconds(1) /
frame_rate);
video_capturer_->SetMinCapturePeriod(base::Seconds(1) / frame_rate);
}
void OffScreenVideoConsumer::SizeChanged() {

View file

@ -152,6 +152,8 @@ void OffScreenWebContentsView::RenderViewHostChanged(
void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled) {}
void OffScreenWebContentsView::OnCapturerCountChanged() {}
#if defined(OS_MAC)
bool OffScreenWebContentsView::CloseTabAfterEventTrackingIfNeeded() {
return false;

View file

@ -62,6 +62,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
void RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) override;
void SetOverscrollControllerEnabled(bool enabled) override;
void OnCapturerCountChanged() override;
#if defined(OS_MAC)
bool CloseTabAfterEventTrackingIfNeeded() override;

View file

@ -16,6 +16,7 @@ class BrowserContext;
class PluginUtils {
public:
// disable copy
PluginUtils() = delete;
PluginUtils(const PluginUtils&) = delete;
PluginUtils& operator=(const PluginUtils&) = delete;

View file

@ -8,7 +8,6 @@
#include "base/feature_list.h"
#include "base/i18n/rtl.h"
#include "chrome/browser/ui/views/autofill/autofill_popup_view_utils.h"
#include "components/autofill/core/common/autofill_features.h"
#include "electron/buildflags/buildflags.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
@ -31,6 +30,134 @@
namespace electron {
void CalculatePopupXAndWidthHorizontallyCentered(
int popup_preferred_width,
const gfx::Rect& content_area_bounds,
const gfx::Rect& element_bounds,
bool is_rtl,
gfx::Rect* bubble_bounds) {
// The preferred horizontal starting point for the pop-up is at the horizontal
// center of the field.
int preferred_starting_point =
base::clamp(element_bounds.x() + (element_bounds.size().width() / 2),
content_area_bounds.x(), content_area_bounds.right());
// The space available to the left and to the right.
int space_to_right = content_area_bounds.right() - preferred_starting_point;
int space_to_left = preferred_starting_point - content_area_bounds.x();
// Calculate the pop-up width. This is either the preferred pop-up width, or
// alternatively the maximum space available if there is not sufficient space
// for the preferred width.
int popup_width =
std::min(popup_preferred_width, space_to_left + space_to_right);
// Calculates the space that is available to grow into the preferred
// direction. In RTL, this is the space to the right side of the content
// area, in LTR this is the space to the left side of the content area.
int space_to_grow_in_preferred_direction =
is_rtl ? space_to_left : space_to_right;
// Calculate how much the pop-up needs to grow into the non-preferred
// direction.
int amount_to_grow_in_unpreffered_direction =
std::max(0, popup_width - space_to_grow_in_preferred_direction);
bubble_bounds->set_width(popup_width);
if (is_rtl) {
// Note, in RTL the |pop_up_width| must be subtracted to achieve
// right-alignment of the pop-up with the element.
bubble_bounds->set_x(preferred_starting_point - popup_width +
amount_to_grow_in_unpreffered_direction);
} else {
bubble_bounds->set_x(preferred_starting_point -
amount_to_grow_in_unpreffered_direction);
}
}
void CalculatePopupXAndWidth(int popup_preferred_width,
const gfx::Rect& content_area_bounds,
const gfx::Rect& element_bounds,
bool is_rtl,
gfx::Rect* bubble_bounds) {
int right_growth_start = base::clamp(
element_bounds.x(), content_area_bounds.x(), content_area_bounds.right());
int left_growth_end =
base::clamp(element_bounds.right(), content_area_bounds.x(),
content_area_bounds.right());
int right_available = content_area_bounds.right() - right_growth_start;
int left_available = left_growth_end - content_area_bounds.x();
int popup_width = std::min(popup_preferred_width,
std::max(left_available, right_available));
// Prefer to grow towards the end (right for LTR, left for RTL). But if there
// is not enough space available in the desired direction and more space in
// the other direction, reverse it.
bool grow_left = false;
if (is_rtl) {
grow_left =
left_available >= popup_width || left_available >= right_available;
} else {
grow_left =
right_available < popup_width && right_available < left_available;
}
bubble_bounds->set_width(popup_width);
bubble_bounds->set_x(grow_left ? left_growth_end - popup_width
: right_growth_start);
}
void CalculatePopupYAndHeight(int popup_preferred_height,
const gfx::Rect& content_area_bounds,
const gfx::Rect& element_bounds,
gfx::Rect* bubble_bounds) {
int top_growth_end = base::clamp(element_bounds.y(), content_area_bounds.y(),
content_area_bounds.bottom());
int bottom_growth_start =
base::clamp(element_bounds.bottom(), content_area_bounds.y(),
content_area_bounds.bottom());
int top_available = top_growth_end - content_area_bounds.y();
int bottom_available = content_area_bounds.bottom() - bottom_growth_start;
bubble_bounds->set_height(popup_preferred_height);
bubble_bounds->set_y(top_growth_end);
if (bottom_available >= popup_preferred_height ||
bottom_available >= top_available) {
bubble_bounds->AdjustToFit(
gfx::Rect(bubble_bounds->x(), element_bounds.bottom(),
bubble_bounds->width(), bottom_available));
} else {
bubble_bounds->AdjustToFit(
gfx::Rect(bubble_bounds->x(), content_area_bounds.y(),
bubble_bounds->width(), top_available));
}
}
gfx::Rect CalculatePopupBounds(const gfx::Size& desired_size,
const gfx::Rect& content_area_bounds,
const gfx::Rect& element_bounds,
bool is_rtl,
bool horizontally_centered) {
gfx::Rect bubble_bounds;
if (horizontally_centered) {
CalculatePopupXAndWidthHorizontallyCentered(
desired_size.width(), content_area_bounds, element_bounds, is_rtl,
&bubble_bounds);
} else {
CalculatePopupXAndWidth(desired_size.width(), content_area_bounds,
element_bounds, is_rtl, &bubble_bounds);
}
CalculatePopupYAndHeight(desired_size.height(), content_area_bounds,
element_bounds, &bubble_bounds);
return bubble_bounds;
}
AutofillPopup::AutofillPopup() {
bold_font_list_ = gfx::FontList().DeriveWithWeight(gfx::Font::Weight::BOLD);
smaller_font_list_ =

View file

@ -84,7 +84,7 @@ bool ElectronBundleMover::Move(gin_helper::ErrorThrower thrower,
// Check if we can write to the applications directory
// and then make sure that if the app already exists we can overwrite it
bool needAuthorization =
![fileManager isWritableFileAtPath:applicationsDirectory] |
![fileManager isWritableFileAtPath:applicationsDirectory] ||
([fileManager fileExistsAtPath:destinationPath] &&
![fileManager isWritableFileAtPath:destinationPath]);

View file

@ -24,9 +24,8 @@ void DragFileItems(const std::vector<base::FilePath>& files,
// Set up our OLE machinery
auto data = std::make_unique<ui::OSExchangeData>();
button_drag_utils::SetDragImage(
GURL(), files[0].LossyDisplayName(), icon.AsImageSkia(), nullptr,
*views::Widget::GetTopLevelWidgetForNativeView(view), data.get());
button_drag_utils::SetDragImage(GURL(), files[0].LossyDisplayName(),
icon.AsImageSkia(), nullptr, data.get());
std::vector<ui::FileInfo> file_infos;
file_infos.reserve(files.size());

View file

@ -175,9 +175,8 @@ GURL GetDevToolsURL(bool can_dock) {
return GURL(url_string);
}
constexpr base::TimeDelta kInitialBackoffDelay =
base::TimeDelta::FromMilliseconds(250);
constexpr base::TimeDelta kMaxBackoffDelay = base::TimeDelta::FromSeconds(10);
constexpr base::TimeDelta kInitialBackoffDelay = base::Milliseconds(250);
constexpr base::TimeDelta kMaxBackoffDelay = base::Seconds(10);
} // namespace
@ -954,6 +953,13 @@ void InspectableWebContents::ClearPreferences() {
sync_disabled_update.Get()->Clear();
}
void InspectableWebContents::GetSyncInformation(DispatchCallback callback) {
// TODO(anyone): do we want devtool syncing in Electron?
base::Value result(base::Value::Type::DICTIONARY);
result.SetBoolKey("isSyncActive", false);
std::move(callback).Run(&result);
}
void InspectableWebContents::ConnectionReady() {}
void InspectableWebContents::RegisterExtensionsAPI(const std::string& origin,
@ -1111,7 +1117,7 @@ void InspectableWebContents::DidFinishNavigation(
!navigation_handle->HasCommitted())
return;
content::RenderFrameHost* frame = navigation_handle->GetRenderFrameHost();
auto origin = navigation_handle->GetURL().GetOrigin().spec();
auto origin = navigation_handle->GetURL().DeprecatedGetOriginAsURL().spec();
auto it = extensions_api_.find(origin);
if (it == extensions_api_.end())
return;

View file

@ -146,6 +146,7 @@ class InspectableWebContents
const std::string& value) override;
void RemovePreference(const std::string& name) override;
void ClearPreferences() override;
void GetSyncInformation(DispatchCallback callback) override;
void ConnectionReady() override;
void RegisterExtensionsAPI(const std::string& origin,
const std::string& script) override;

View file

@ -306,7 +306,7 @@ void AutofillPopupView::OnMouseMoved(const ui::MouseEvent& event) {
// A synthesized mouse move will be sent when the popup is first shown.
// Don't preview a suggestion if the mouse happens to be hovering there.
#if defined(OS_WIN)
if (base::Time::Now() - show_time_ <= base::TimeDelta::FromMilliseconds(50))
if (base::Time::Now() - show_time_ <= base::Milliseconds(50))
return;
#else
if (event.flags() & ui::EF_IS_SYNTHESIZED)

View file

@ -69,7 +69,11 @@ double ZoomLevelDelegate::GetDefaultZoomLevelPref() const {
pref_service_->GetDictionary(kPartitionDefaultZoomLevel);
// If no default has been previously set, the default returned is the
// value used to initialize default_zoom_level in this function.
default_zoom_level_dictionary->GetDouble(partition_key_, &default_zoom_level);
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;
}

View file

@ -131,7 +131,7 @@ void ElectronBindings::Crash() {
// static
void ElectronBindings::Hang() {
for (;;)
base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
base::PlatformThread::Sleep(base::Seconds(1));
}
// static

View file

@ -14,6 +14,7 @@ namespace electron {
class ElectronCommandLine {
public:
// disable copy
ElectronCommandLine() = delete;
ElectronCommandLine(const ElectronCommandLine&) = delete;
ElectronCommandLine& operator=(const ElectronCommandLine&) = delete;

View file

@ -37,7 +37,9 @@ enum {
PATH_END, // End of new paths. Those that follow redirect to base::DIR_*
#if !defined(OS_LINUX)
#if defined(OS_WIN)
DIR_APP_DATA = base::DIR_ROAMING_APP_DATA,
#elif defined(OS_MAC)
DIR_APP_DATA = base::DIR_APP_DATA,
#endif
};

View file

@ -334,9 +334,12 @@ bool Converter<scoped_refptr<network::ResourceRequestBody>>::FromV8(
}
int offset = 0, length = -1;
double modification_time = 0.0;
absl::optional<double> maybe_modification_time =
dict->FindDoubleKey("modificationTime");
if (maybe_modification_time.has_value())
modification_time = maybe_modification_time.value();
dict->GetInteger("offset", &offset);
dict->GetInteger("file", &length);
dict->GetDouble("modificationTime", &modification_time);
(*out)->AppendFileRange(base::FilePath::FromUTF8Unsafe(*file),
static_cast<uint64_t>(offset),
static_cast<uint64_t>(length),

View file

@ -17,9 +17,9 @@
#include "base/environment.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "content/public/browser/browser_thread.h"

View file

@ -11,7 +11,7 @@
#include <vector>
#include "base/feature_list.h"
#include "base/macros.h"
#include "base/ignore_result.h"
#include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"

View file

@ -680,7 +680,8 @@ class WebFrameRenderer : public gin::Wrappable<WebFrameRenderer>,
has_user_gesture, blink::WebLocalFrame::kSynchronous,
new ScriptExecutionCallback(std::move(promise),
std::move(completion_callback)),
blink::BackForwardCacheAware::kAllow);
blink::BackForwardCacheAware::kAllow,
blink::WebLocalFrame::PromiseBehavior::kDontWait);
return handle;
}
@ -745,7 +746,8 @@ class WebFrameRenderer : public gin::Wrappable<WebFrameRenderer>,
scriptExecutionType,
new ScriptExecutionCallback(std::move(promise),
std::move(completion_callback)),
blink::BackForwardCacheAware::kPossiblyDisallow);
blink::BackForwardCacheAware::kPossiblyDisallow,
blink::WebLocalFrame::PromiseBehavior::kDontWait);
return handle;
}

View file

@ -9,7 +9,7 @@
#include <vector>
#include "base/environment.h"
#include "base/macros.h"
#include "base/ignore_result.h"
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h"
#include "gin/data_object_builder.h"

View file

@ -9,7 +9,7 @@
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/ignore_result.h"
#include "base/path_service.h"
#include "base/process/process_handle.h"
#include "base/process/process_metrics.h"

View file

@ -11,7 +11,8 @@
#include "base/threading/sequenced_task_runner_handle.h"
#include "content/public/utility/utility_thread.h"
#include "mojo/public/cpp/bindings/service_factory.h"
#include "sandbox/policy/switches.h"
#include "sandbox/policy/mojom/sandbox.mojom.h"
#include "sandbox/policy/sandbox_type.h"
#include "services/proxy_resolver/proxy_resolver_factory_impl.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/cpp/service.h"
@ -91,9 +92,10 @@ ElectronContentUtilityClient::~ElectronContentUtilityClient() = default;
void ElectronContentUtilityClient::ExposeInterfacesToBrowser(
mojo::BinderMap* binders) {
#if defined(OS_WIN)
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
utility_process_running_elevated_ = command_line->HasSwitch(
sandbox::policy::switches::kNoSandboxAndElevatedPrivileges);
auto& cmd_line = *base::CommandLine::ForCurrentProcess();
auto sandbox_type = sandbox::policy::SandboxTypeFromCommandLine(cmd_line);
utility_process_running_elevated_ =
sandbox_type == sandbox::mojom::Sandbox::kNoSandboxAndElevatedPrivileges;
#endif
// If our process runs with elevated privileges, only add elevated Mojo