chore: bump chromium to 89.0.4388.2 (12-x-y) (#27280)

* chore: bump chromium in DEPS to 89.0.4386.0

* update patches

* 2596667: Reland "[printing] Mojofy PrintHostMsg_CheckForCancel"

https://chromium-review.googlesource.com/c/chromium/src/+/2596667
(cherry picked from commit 70fb0fe694)

* fixup for 2596667: Reland "[printing] Mojofy PrintHostMsg_CheckForCancel

* 2596880: Refactor frame detach helpers to return a bool indicating success.

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

* 2596880: Refactor frame detach helpers to return a bool indicating success.

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

* 2615203: [Code health] Convert DispatchCallback to OnceCallback

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

* 2587618: Refactor contrast tracking in NativeTheme

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

* 2596289: Use ContextMenuDataMediaType Mojo enum instead of the native one

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

* 2587049: Move blink.mojom.DragOperation to //ui/base/dragdrop

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

* 2585255: Move web_isolated_world_ids.h from public/platform to renderer/platform/bindings in blink

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

* 2602887: Convert CheckForUpdates callback to OnceCallback

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

* 2601061: Convert ChromeManagementAPIDelegate to OnceCallback

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

* 2600391: Convert MessagingDelegate to OnceCallback

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

* 2583590: webui: Remove UseWebUIBindingsForURL

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

* 2562002: Deprecate ResourceType in ExtensionsBrowserClient

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

* chore: handle AXPropertyFilter::SCRIPT in accessibility_ui

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

* chore: add DISPLAY_CAPTURE permission to converter

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

* fix: add utility class for linting

* 2614784: Remove SchemeRegistry APIs for handling local and secure schemes

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

* chore: bump chromium in DEPS to 89.0.4387.0

* 2618392: Rename PAGE to ENTRY in NAVIGATION_TYPE values.

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

* 2616421: Factor out DnsConfigService::Watcher logic

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

* chore: update Chromium patch indices

* 2617866: Componentize OptimizationHintsComponentInstaller for reuse on iOS

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

* refactor: refactor x11 event handling, xeventobserver is now x11:eventobserver

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

* 2595524: [XProto] Use x11 namespace instead of gfx for //ui/gfx/x

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

* build: change ui namespace to x11

Ref: c38f8571a8:ui/gfx/x/xproto_util.h;dlc=ba9145d0c7f2b10e869e2ba482ca05b75ca35812

* 2600437: [XProto] Remove old property setters/getters from x11_util

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

* chore: remove deleted headers

* 2402398: Adding ViewsAXTreeManager output to chrome://accessibility

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

* chore: revert to old version of circleci for mac builds

Ref: https://gn.googlesource.com/gn/+/0d67e272bdb8145f87d238bc0b2cb8bf80ccec90

* fix: remove outdated --experimental-wasm-bigint flag

* chore: bump chromium in DEPS to 89.0.4389.0

* update patches

* 2592803: [Extensions] Use policy-enforced update URL in ManagementApi

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

* 2599731: Make network::DataElement a union with absl::variant

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

* 2614784: Remove SchemeRegistry APIs for handling local and secure schemes

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

* 2624711: Inline and remove peekLast()

https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2624711

* chore: add patch to fix blink prefs fetching during frame swap

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>

* update patches

* fix: do not make invalid SKImageRep in FrameSubscriber

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

* Revert "2616421: Factor out DnsConfigService::Watcher logic"

This reverts commit 7214406ecb.

* 2616421: Factor out DnsConfigService::Watcher logic

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

* chore: bump chromium in DEPS to 89.0.4388.2

* chore: update patches

* 2581958: [api] Dehandlify FunctionTemplate initialization

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

* Revert "2592803: [Extensions] Use policy-enforced update URL in ManagementApi"

This reverts commit 00f4041cc9.

* 2572896: Prevent making invalid SkImageReps

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

* fix: sandbox exit event to preload test

* fix: restore clipboard_win patch

* ci: force delete user app data directories

* chore: clean up typing on webview-spec

* docs: undocument display-capture ses.permission option

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
This commit is contained in:
Electron Bot
2021-02-01 13:42:43 -08:00
committed by GitHub
parent 9faf23509d
commit 0c5b6bfd30
119 changed files with 858 additions and 794 deletions

View File

@@ -146,7 +146,8 @@ gin::WrapperInfo DataPipeHolder::kWrapperInfo = {gin::kEmbedderNativeGin};
DataPipeHolder::DataPipeHolder(const network::DataElement& element)
: id_(base::NumberToString(++g_next_id)) {
data_pipe_.Bind(element.CloneDataPipeGetter());
data_pipe_.Bind(
element.As<network::DataElementDataPipe>().CloneDataPipeGetter());
}
DataPipeHolder::~DataPipeHolder() = default;

View File

@@ -64,7 +64,7 @@ bool NativeTheme::ShouldUseDarkColors() {
}
bool NativeTheme::ShouldUseHighContrastColors() {
return ui_theme_->UsesHighContrastColors();
return ui_theme_->UserHasContrastPreference();
}
#if defined(OS_MAC)

View File

@@ -44,7 +44,7 @@ bool SystemPreferences::IsInvertedColorScheme() {
}
bool SystemPreferences::IsHighContrastColorScheme() {
return ui::NativeTheme::GetInstanceForNativeUi()->UsesHighContrastColors();
return ui::NativeTheme::GetInstanceForNativeUi()->UserHasContrastPreference();
}
v8::Local<v8::Value> SystemPreferences::GetAnimationSettings(

View File

@@ -492,8 +492,11 @@ gin::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create(
args->isolate(), body_func,
data_pipe_getter.InitWithNewPipeAndPassReceiver())
.ToV8();
request->request_body = new network::ResourceRequestBody();
request->request_body->SetToChunkedDataPipe(std::move(data_pipe_getter));
request->request_body =
base::MakeRefCounted<network::ResourceRequestBody>();
request->request_body->SetToChunkedDataPipe(
std::move(data_pipe_getter),
network::ResourceRequestBody::ReadOnlyOnce(false));
}
}

View File

@@ -161,8 +161,7 @@ void FrameSubscriber::Done(const gfx::Rect& damage, const SkBitmap& frame) {
// frame is modified.
SkBitmap copy;
copy.allocPixels(SkImageInfo::Make(bitmap.width(), bitmap.height(),
kRGBA_8888_SkColorType,
kPremul_SkAlphaType));
kN32_SkColorType, kPremul_SkAlphaType));
SkPixmap pixmap;
bool success = bitmap.peekPixels(&pixmap) && copy.writePixels(pixmap, 0, 0);
CHECK(success);

View File

@@ -243,11 +243,6 @@ BrowserProcessImpl::floc_sorting_lsh_clusters_service() {
return nullptr;
}
optimization_guide::OptimizationGuideService*
BrowserProcessImpl::optimization_guide_service() {
return nullptr;
}
component_updater::ComponentUpdateService*
BrowserProcessImpl::component_updater() {
return nullptr;

View File

@@ -81,8 +81,6 @@ class BrowserProcessImpl : public BrowserProcess {
override;
federated_learning::FlocSortingLshClustersService*
floc_sorting_lsh_clusters_service() override;
optimization_guide::OptimizationGuideService* optimization_guide_service()
override;
component_updater::ComponentUpdateService* component_updater() override;
MediaFileSystemRegistry* media_file_system_registry() override;
WebRtcLogUploader* webrtc_log_uploader() override;

View File

@@ -45,7 +45,6 @@
#include "content/public/common/content_descriptors.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/service_names.mojom.h"
#include "content/public/common/url_constants.h"
#include "electron/buildflags/buildflags.h"
#include "electron/grit/electron_resources.h"
@@ -129,10 +128,6 @@
#include "shell/browser/fake_location_provider.h"
#endif // BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/browser/printing/printing_message_filter.h"
#endif // BUILDFLAG(ENABLE_PRINTING)
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "chrome/common/webui_url_constants.h"
#include "content/public/browser/child_process_security_policy.h"
@@ -536,11 +531,6 @@ void ElectronBrowserClient::RenderProcessWillLaunch(
auto* browser_context = host->GetBrowserContext();
ALLOW_UNUSED_LOCAL(browser_context);
#if BUILDFLAG(ENABLE_PRINTING)
host->AddFilter(
new printing::PrintingMessageFilter(process_id, browser_context));
#endif
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
host->AddFilter(
new extensions::ExtensionMessageFilter(process_id, browser_context));

View File

@@ -40,12 +40,6 @@ bool ElectronWebUIControllerFactory::UseWebUIForURL(
return GetWebUIType(browser_context, url) != content::WebUI::kNoWebUI;
}
bool ElectronWebUIControllerFactory::UseWebUIBindingsForURL(
content::BrowserContext* browser_context,
const GURL& url) {
return UseWebUIForURL(browser_context, url);
}
std::unique_ptr<content::WebUIController>
ElectronWebUIControllerFactory::CreateWebUIControllerForURL(
content::WebUI* web_ui,

View File

@@ -26,8 +26,6 @@ class ElectronWebUIControllerFactory : public content::WebUIControllerFactory {
const GURL& url) override;
bool UseWebUIForURL(content::BrowserContext* browser_context,
const GURL& url) override;
bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
const GURL& url) override;
std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
content::WebUI* web_ui,
const GURL& url) override;

View File

@@ -38,7 +38,7 @@ class ManagementSetEnabledFunctionInstallPromptDelegate
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback) {
base::OnceCallback<void(bool)> callback) {
// TODO(sentialx): emit event
}
~ManagementSetEnabledFunctionInstallPromptDelegate() override {}
@@ -109,10 +109,10 @@ ElectronManagementAPIDelegate::SetEnabledFunctionDelegate(
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback) const {
base::OnceCallback<void(bool)> callback) const {
return std::unique_ptr<ManagementSetEnabledFunctionInstallPromptDelegate>(
new ManagementSetEnabledFunctionInstallPromptDelegate(
web_contents, browser_context, extension, callback));
web_contents, browser_context, extension, std::move(callback)));
}
std::unique_ptr<extensions::UninstallDialogDelegate>

View File

@@ -31,7 +31,7 @@ class ElectronManagementAPIDelegate : public extensions::ManagementAPIDelegate {
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback) const override;
base::OnceCallback<void(bool)> callback) const override;
std::unique_ptr<extensions::UninstallDialogDelegate>
UninstallFunctionDelegate(
extensions::ManagementUninstallFunctionBase* function,

View File

@@ -36,7 +36,7 @@ void ElectronRuntimeAPIDelegate::ReloadExtension(
bool ElectronRuntimeAPIDelegate::CheckForUpdates(
const std::string& extension_id,
const UpdateCheckCallback& callback) {
UpdateCheckCallback callback) {
return false;
}

View File

@@ -26,7 +26,7 @@ class ElectronRuntimeAPIDelegate : public RuntimeAPIDelegate {
void RemoveUpdateObserver(UpdateObserver* observer) override;
void ReloadExtension(const std::string& extension_id) override;
bool CheckForUpdates(const std::string& extension_id,
const UpdateCheckCallback& callback) override;
UpdateCheckCallback callback) override;
void OpenURL(const GURL& uninstall_url) override;
bool GetPlatformInfo(api::runtime::PlatformInfo* info) override;
bool RestartDevice(std::string* error_message) override;

View File

@@ -179,17 +179,18 @@ void ElectronExtensionsBrowserClient::LoadResourceFromResourceBundle(
}
namespace {
bool AllowCrossRendererResourceLoad(const network::ResourceRequest& request,
blink::mojom::ResourceType resource_type,
ui::PageTransition page_transition,
int child_id,
bool is_incognito,
const extensions::Extension* extension,
const extensions::ExtensionSet& extensions,
const extensions::ProcessMap& process_map,
bool* allowed) {
bool AllowCrossRendererResourceLoad(
const network::ResourceRequest& request,
network::mojom::RequestDestination destination,
ui::PageTransition page_transition,
int child_id,
bool is_incognito,
const extensions::Extension* extension,
const extensions::ExtensionSet& extensions,
const extensions::ProcessMap& process_map,
bool* allowed) {
if (extensions::url_request_util::AllowCrossRendererResourceLoad(
request, resource_type, page_transition, child_id, is_incognito,
request, destination, page_transition, child_id, is_incognito,
extension, extensions, process_map, allowed)) {
return true;
}
@@ -210,7 +211,7 @@ bool AllowCrossRendererResourceLoad(const network::ResourceRequest& request,
bool ElectronExtensionsBrowserClient::AllowCrossRendererResourceLoad(
const network::ResourceRequest& request,
blink::mojom::ResourceType resource_type,
network::mojom::RequestDestination destination,
ui::PageTransition page_transition,
int child_id,
bool is_incognito,
@@ -219,7 +220,7 @@ bool ElectronExtensionsBrowserClient::AllowCrossRendererResourceLoad(
const extensions::ProcessMap& process_map) {
bool allowed = false;
if (::electron::AllowCrossRendererResourceLoad(
request, resource_type, page_transition, child_id, is_incognito,
request, destination, page_transition, child_id, is_incognito,
extension, extensions, process_map, &allowed)) {
return allowed;
}

View File

@@ -15,7 +15,7 @@
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/kiosk/kiosk_delegate.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
class PrefService;
@@ -71,7 +71,7 @@ class ElectronExtensionsBrowserClient
bool send_cors_header) override;
bool AllowCrossRendererResourceLoad(
const network::ResourceRequest& request,
blink::mojom::ResourceType resource_type,
network::mojom::RequestDestination destination,
ui::PageTransition page_transition,
int child_id,
bool is_incognito,

View File

@@ -5,6 +5,7 @@
#include "shell/browser/extensions/electron_messaging_delegate.h"
#include <memory>
#include <utility>
#include "base/callback.h"
#include "base/logging.h"
@@ -107,9 +108,9 @@ void ElectronMessagingDelegate::QueryIncognitoConnectability(
const Extension* target_extension,
content::WebContents* source_contents,
const GURL& source_url,
const base::Callback<void(bool)>& callback) {
base::OnceCallback<void(bool)> callback) {
DCHECK(context->IsOffTheRecord());
callback.Run(false);
std::move(callback).Run(false);
}
} // namespace extensions

View File

@@ -47,7 +47,7 @@ class ElectronMessagingDelegate : public MessagingDelegate {
const Extension* extension,
content::WebContents* web_contents,
const GURL& url,
const base::Callback<void(bool)>& callback) override;
base::OnceCallback<void(bool)> callback) override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronMessagingDelegate);

View File

@@ -62,6 +62,7 @@
#include "ui/gfx/x/shape.h"
#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/xproto.h"
#include "ui/gfx/x/xproto_util.h"
#endif
#if defined(USE_OZONE) || defined(USE_X11)
@@ -244,12 +245,12 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
std::vector<x11::Atom> state_atom_list;
bool skip_taskbar = false;
if (options.Get(options::kSkipTaskbar, &skip_taskbar) && skip_taskbar) {
state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
}
// Before the window is mapped, there is no SHOW_FULLSCREEN_STATE.
if (fullscreen) {
state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"));
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_FULLSCREEN"));
}
if (parent) {
@@ -258,12 +259,13 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
// Modal window needs the _NET_WM_STATE_MODAL hint.
if (is_modal())
state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_MODAL"));
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_MODAL"));
}
if (!state_atom_list.empty())
ui::SetAtomArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
"_NET_WM_STATE", "ATOM", state_atom_list);
SetArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_NET_WM_STATE"), x11::Atom::ATOM,
state_atom_list);
// Set the _NET_WM_WINDOW_TYPE.
if (!window_type.empty())
@@ -353,9 +355,9 @@ void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) {
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
const std::string color = use_dark_theme ? "dark" : "light";
ui::SetStringProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
gfx::GetAtom("_GTK_THEME_VARIANT"),
gfx::GetAtom("UTF8_STRING"), color);
x11::SetStringProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_GTK_THEME_VARIANT"),
x11::GetAtom("UTF8_STRING"), color);
}
#endif
}
@@ -924,7 +926,7 @@ void NativeWindowViews::SetSkipTaskbar(bool skip) {
#elif defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
SetWMSpecState(static_cast<x11::Window>(GetAcceleratedWidget()), skip,
gfx::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
x11::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
}
#endif
}
@@ -1154,7 +1156,7 @@ void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
ui::SetProperty(
x11::SetProperty(
static_cast<x11::Window>(GetAcceleratedWidget()),
x11::Atom::WM_TRANSIENT_FOR, x11::Atom::WINDOW,
parent ? static_cast<x11::Window>(parent->GetAcceleratedWidget())
@@ -1239,10 +1241,10 @@ bool NativeWindowViews::IsVisibleOnAllWorkspaces() {
if (!features::IsUsingOzonePlatform()) {
// Use the presence/absence of _NET_WM_STATE_STICKY in _NET_WM_STATE to
// determine whether the current window is visible on all workspaces.
x11::Atom sticky_atom = gfx::GetAtom("_NET_WM_STATE_STICKY");
x11::Atom sticky_atom = x11::GetAtom("_NET_WM_STATE_STICKY");
std::vector<x11::Atom> wm_states;
ui::GetAtomArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
"_NET_WM_STATE", &wm_states);
GetArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_NET_WM_STATE"), &wm_states);
return std::find(wm_states.begin(), wm_states.end(), sticky_atom) !=
wm_states.end();
}

View File

@@ -13,7 +13,6 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/common/content_features.h"
#include "content/public/common/service_names.mojom.h"
#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "net/net_buildflags.h"

View File

@@ -171,7 +171,7 @@ void OffScreenWebContentsView::StartDragging(
}
void OffScreenWebContentsView::UpdateDragCursor(
blink::DragOperation operation) {}
ui::mojom::DragOperation operation) {}
void OffScreenWebContentsView::SetPainting(bool painting) {
auto* view = GetView();

View File

@@ -74,7 +74,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
const gfx::Vector2d& image_offset,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) override;
void UpdateDragCursor(blink::DragOperation operation) override;
void UpdateDragCursor(ui::mojom::DragOperation operation) override;
void SetPainting(bool painting);
bool IsPainting() const;
void SetFrameRate(int frame_rate);

View File

@@ -217,6 +217,12 @@ void PrintPreviewMessageHandler::PrintPreviewCancelled(int32_t document_cookie,
RejectPromise(request_id);
}
void PrintPreviewMessageHandler::CheckForCancel(
int32_t request_id,
CheckForCancelCallback callback) {
std::move(callback).Run(false);
}
void PrintPreviewMessageHandler::PrintToPDF(
base::DictionaryValue options,
gin_helper::Promise<v8::Local<v8::Value>> promise) {

View File

@@ -80,6 +80,8 @@ class PrintPreviewMessageHandler
int32_t request_id) override;
void PrinterSettingsInvalid(int32_t document_cookie,
int32_t request_id) override {}
void CheckForCancel(int32_t request_id,
CheckForCancelCallback callback) override;
gin_helper::Promise<v8::Local<v8::Value>> GetPromise(int request_id);

View File

@@ -194,12 +194,12 @@ class InspectableWebContents::NetworkResourceLoader
const network::ResourceRequest& resource_request,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
URLLoaderFactoryHolder url_loader_factory,
const DispatchCallback& callback,
DispatchCallback callback,
base::TimeDelta retry_delay = base::TimeDelta()) {
auto resource_loader =
std::make_unique<InspectableWebContents::NetworkResourceLoader>(
stream_id, bindings, resource_request, traffic_annotation,
std::move(url_loader_factory), callback, retry_delay);
std::move(url_loader_factory), std::move(callback), retry_delay);
bindings->loaders_.insert(std::move(resource_loader));
}
@@ -209,7 +209,7 @@ class InspectableWebContents::NetworkResourceLoader
const network::ResourceRequest& resource_request,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
URLLoaderFactoryHolder url_loader_factory,
const DispatchCallback& callback,
DispatchCallback callback,
base::TimeDelta delay)
: stream_id_(stream_id),
bindings_(bindings),
@@ -219,7 +219,7 @@ class InspectableWebContents::NetworkResourceLoader
std::make_unique<network::ResourceRequest>(resource_request),
traffic_annotation)),
url_loader_factory_(std::move(url_loader_factory)),
callback_(callback),
callback_(std::move(callback)),
retry_delay_(delay) {
loader_->SetOnResponseStartedCallback(base::BindOnce(
&NetworkResourceLoader::OnResponseStarted, base::Unretained(this)));
@@ -280,7 +280,7 @@ class InspectableWebContents::NetworkResourceLoader
<< delay << "." << std::endl;
NetworkResourceLoader::Create(
stream_id_, bindings_, resource_request_, traffic_annotation_,
std::move(url_loader_factory_), callback_, delay);
std::move(url_loader_factory_), std::move(callback_), delay);
} else {
base::DictionaryValue response;
response.SetInteger("statusCode", response_headers_
@@ -296,7 +296,7 @@ class InspectableWebContents::NetworkResourceLoader
headers->SetString(name, value);
response.Set("headers", std::move(headers));
callback_.Run(&response);
std::move(callback_).Run(&response);
}
bindings_->loaders_.erase(bindings_->loaders_.find(this));
@@ -497,12 +497,12 @@ void InspectableWebContents::Detach() {
agent_host_ = nullptr;
}
void InspectableWebContents::Reattach(const DispatchCallback& callback) {
void InspectableWebContents::Reattach(DispatchCallback callback) {
if (agent_host_) {
agent_host_->DetachClient(this);
agent_host_->AttachClient(this);
}
callback.Run(nullptr);
std::move(callback).Run(nullptr);
}
void InspectableWebContents::CallClientFunction(
@@ -643,16 +643,15 @@ void InspectableWebContents::InspectedURLChanged(const std::string& url) {
base::UTF8ToUTF16(base::StringPrintf(kTitleFormat, url.c_str())));
}
void InspectableWebContents::LoadNetworkResource(
const DispatchCallback& callback,
const std::string& url,
const std::string& headers,
int stream_id) {
void InspectableWebContents::LoadNetworkResource(DispatchCallback callback,
const std::string& url,
const std::string& headers,
int stream_id) {
GURL gurl(url);
if (!gurl.is_valid()) {
base::DictionaryValue response;
response.SetInteger("statusCode", 404);
callback.Run(&response);
std::move(callback).Run(&response);
return;
}
@@ -696,17 +695,17 @@ void InspectableWebContents::LoadNetworkResource(
url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
}
NetworkResourceLoader::Create(stream_id, this, resource_request,
traffic_annotation,
std::move(url_loader_factory), callback);
NetworkResourceLoader::Create(
stream_id, this, resource_request, traffic_annotation,
std::move(url_loader_factory), std::move(callback));
}
void InspectableWebContents::SetIsDocked(const DispatchCallback& callback,
void InspectableWebContents::SetIsDocked(DispatchCallback callback,
bool docked) {
if (managed_devtools_web_contents_)
view_->SetIsDocked(docked, activate_);
if (!callback.is_null())
callback.Run(nullptr);
std::move(callback).Run(nullptr);
}
void InspectableWebContents::OpenInNewTab(const std::string& url) {}
@@ -835,16 +834,16 @@ void InspectableWebContents::DispatchProtocolMessageFromDevToolsFrontend(
this, base::as_bytes(base::make_span(message)));
}
void InspectableWebContents::SendJsonRequest(const DispatchCallback& callback,
void InspectableWebContents::SendJsonRequest(DispatchCallback callback,
const std::string& browser_id,
const std::string& url) {
callback.Run(nullptr);
std::move(callback).Run(nullptr);
}
void InspectableWebContents::GetPreferences(const DispatchCallback& callback) {
void InspectableWebContents::GetPreferences(DispatchCallback callback) {
const base::DictionaryValue* prefs =
pref_service_->GetDictionary(kDevToolsPreferences);
callback.Run(prefs);
std::move(callback).Run(prefs);
}
void InspectableWebContents::SetPreference(const std::string& name,

View File

@@ -86,11 +86,11 @@ class InspectableWebContents
void SetInspectedPageBounds(const gfx::Rect& rect) override;
void InspectElementCompleted() override;
void InspectedURLChanged(const std::string& url) override;
void LoadNetworkResource(const DispatchCallback& callback,
void LoadNetworkResource(DispatchCallback callback,
const std::string& url,
const std::string& headers,
int stream_id) override;
void SetIsDocked(const DispatchCallback& callback, bool is_docked) override;
void SetIsDocked(DispatchCallback callback, bool is_docked) override;
void OpenInNewTab(const std::string& url) override;
void ShowItemInFolder(const std::string& file_system_path) override;
void SaveToFile(const std::string& url,
@@ -130,10 +130,10 @@ class InspectableWebContents
void OpenNodeFrontend() override;
void DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) override;
void SendJsonRequest(const DispatchCallback& callback,
void SendJsonRequest(DispatchCallback callback,
const std::string& browser_id,
const std::string& url) override;
void GetPreferences(const DispatchCallback& callback) override;
void GetPreferences(DispatchCallback callback) override;
void SetPreference(const std::string& name,
const std::string& value) override;
void RemovePreference(const std::string& name) override;
@@ -141,7 +141,7 @@ class InspectableWebContents
void ConnectionReady() override;
void RegisterExtensionsAPI(const std::string& origin,
const std::string& script) override;
void Reattach(const DispatchCallback& callback) override;
void Reattach(DispatchCallback callback) override;
void RecordEnumeratedHistogram(const std::string& name,
int sample,
int boundary_value) override {}
@@ -150,9 +150,9 @@ class InspectableWebContents
void RecordPerformanceHistogram(const std::string& name,
double duration) override {}
void RecordUserMetricsAction(const std::string& name) override {}
void ShowSurvey(const DispatchCallback& callback,
void ShowSurvey(DispatchCallback callback,
const std::string& trigger) override {}
void CanShowSurvey(const DispatchCallback& callback,
void CanShowSurvey(DispatchCallback callback,
const std::string& trigger) override {}
// content::DevToolsFrontendHostDelegate:

View File

@@ -164,6 +164,7 @@ bool MatchesPropertyFilters(
if (base::MatchPattern(text, filter.match_str)) {
switch (filter.type) {
case ui::AXPropertyFilter::ALLOW_EMPTY:
case ui::AXPropertyFilter::SCRIPT:
allow = true;
break;
case ui::AXPropertyFilter::ALLOW:

View File

@@ -3,59 +3,75 @@
// found in the LICENSE file.
#include "shell/browser/ui/x/window_state_watcher.h"
#include <vector>
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/xproto_util.h"
namespace electron {
WindowStateWatcher::WindowStateWatcher(NativeWindowViews* window)
: window_(window),
widget_(window->GetAcceleratedWidget()),
window_state_atom_(gfx::GetAtom("_NET_WM_STATE")) {
ui::X11EventSource::GetInstance()->AddXEventObserver(this);
window_state_atom_(x11::GetAtom("_NET_WM_STATE")) {
ui::X11EventSource::GetInstance()->connection()->AddEventObserver(this);
}
WindowStateWatcher::~WindowStateWatcher() {
ui::X11EventSource::GetInstance()->RemoveXEventObserver(this);
ui::X11EventSource::GetInstance()->connection()->RemoveEventObserver(this);
}
void WindowStateWatcher::WillProcessXEvent(x11::Event* x11_event) {
void WindowStateWatcher::OnEvent(const x11::Event& x11_event) {
if (IsWindowStateEvent(x11_event)) {
was_minimized_ = window_->IsMinimized();
was_maximized_ = window_->IsMaximized();
}
}
bool was_minimized_ = window_->IsMinimized();
bool was_maximized_ = window_->IsMaximized();
void WindowStateWatcher::DidProcessXEvent(x11::Event* x11_event) {
if (IsWindowStateEvent(x11_event)) {
bool is_minimized = window_->IsMinimized();
bool is_maximized = window_->IsMaximized();
bool is_fullscreen = window_->IsFullscreen();
if (is_minimized != was_minimized_) {
if (is_minimized)
window_->NotifyWindowMinimize();
else
window_->NotifyWindowRestore();
} else if (is_maximized != was_maximized_) {
if (is_maximized)
window_->NotifyWindowMaximize();
else
window_->NotifyWindowUnmaximize();
} else {
// If this is neither a "maximize" or "minimize" event, then we think it
// is a "fullscreen" event.
// The "IsFullscreen()" becomes true immediately before "WillProcessEvent"
// is called, so we can not handle this like "maximize" and "minimize" by
// watching whether they have changed.
if (is_fullscreen)
window_->NotifyWindowEnterFullScreen();
else
window_->NotifyWindowLeaveFullScreen();
std::vector<x11::Atom> wm_states;
if (GetArrayProperty(
static_cast<x11::Window>(window_->GetAcceleratedWidget()),
x11::GetAtom("_NET_WM_STATE"), &wm_states)) {
auto props =
base::flat_set<x11::Atom>(std::begin(wm_states), std::end(wm_states));
bool is_minimized =
props.find(x11::GetAtom("_NET_WM_STATE_HIDDEN")) != props.end();
bool is_maximized =
props.find(x11::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT")) !=
props.end() &&
props.find(x11::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")) !=
props.end();
bool is_fullscreen =
props.find(x11::GetAtom("_NET_WM_STATE_FULLSCREEN")) != props.end();
if (is_minimized != was_minimized_) {
if (is_minimized)
window_->NotifyWindowMinimize();
else
window_->NotifyWindowRestore();
} else if (is_maximized != was_maximized_) {
if (is_maximized)
window_->NotifyWindowMaximize();
else
window_->NotifyWindowUnmaximize();
} else {
// If this is neither a "maximize" or "minimize" event, then we think it
// is a "fullscreen" event.
// The "IsFullscreen()" becomes true immediately before "OnEvent"
// is called, so we can not handle this like "maximize" and "minimize"
// by watching whether they have changed.
if (is_fullscreen)
window_->NotifyWindowEnterFullScreen();
else
window_->NotifyWindowLeaveFullScreen();
}
}
}
}
bool WindowStateWatcher::IsWindowStateEvent(x11::Event* x11_event) const {
auto* property = x11_event->As<x11::PropertyNotifyEvent>();
bool WindowStateWatcher::IsWindowStateEvent(const x11::Event& x11_event) const {
auto* property = x11_event.As<x11::PropertyNotifyEvent>();
return (property && property->atom == window_state_atom_ &&
static_cast<uint32_t>(property->window) == widget_);
}

View File

@@ -12,26 +12,22 @@
namespace electron {
class WindowStateWatcher : public ui::XEventObserver {
class WindowStateWatcher : public x11::EventObserver {
public:
explicit WindowStateWatcher(NativeWindowViews* window);
~WindowStateWatcher() override;
protected:
// ui::XEventObserver:
void WillProcessXEvent(x11::Event* x11_event) override;
void DidProcessXEvent(x11::Event* x11_event) override;
// x11::XEventObserver:
void OnEvent(const x11::Event& x11_event) override;
private:
bool IsWindowStateEvent(x11::Event* x11_event) const;
bool IsWindowStateEvent(const x11::Event& x11_event) const;
NativeWindowViews* window_;
gfx::AcceleratedWidget widget_;
const x11::Atom window_state_atom_;
bool was_minimized_ = false;
bool was_maximized_ = false;
DISALLOW_COPY_AND_ASSIGN(WindowStateWatcher);
};

View File

@@ -21,16 +21,16 @@ namespace electron {
void SetWMSpecState(x11::Window window, bool enabled, x11::Atom state) {
ui::SendClientMessage(window, ui::GetX11RootWindow(),
gfx::GetAtom("_NET_WM_STATE"),
x11::GetAtom("_NET_WM_STATE"),
{enabled ? 1 : 0, static_cast<uint32_t>(state),
static_cast<uint32_t>(x11::Window::None), 1, 0});
}
void SetWindowType(x11::Window window, const std::string& type) {
std::string type_prefix = "_NET_WM_WINDOW_TYPE_";
x11::Atom window_type = gfx::GetAtom(type_prefix + base::ToUpperASCII(type));
ui::SetProperty(window, gfx::GetAtom("_NET_WM_WINDOW_TYPE"), x11::Atom::ATOM,
window_type);
x11::Atom window_type = x11::GetAtom(type_prefix + base::ToUpperASCII(type));
x11::SetProperty(window, x11::GetAtom("_NET_WM_WINDOW_TYPE"), x11::Atom::ATOM,
window_type);
}
bool ShouldUseGlobalMenuBar() {
@@ -77,7 +77,7 @@ void MoveWindowToForeground(x11::Window window) {
void MoveWindowAbove(x11::Window window, x11::Window other_window) {
ui::SendClientMessage(window, ui::GetX11RootWindow(),
gfx::GetAtom("_NET_RESTACK_WINDOW"),
x11::GetAtom("_NET_RESTACK_WINDOW"),
{2, static_cast<uint32_t>(other_window),
static_cast<uint32_t>(x11::StackMode::Above), 0, 0});
}