chore: bump chromium to 580fe983e138952553cd6af11ee8b (master) (#23379)
* chore: bump chromium in DEPS to 5ce64b91b4d6a78c97480059f15ff6469fc0918e * chore: bump chromium in DEPS to e74c73d0000f81b3f40a513176c8d024bba57d28 * chore: bump chromium in DEPS to 501640e650d4657ba63db65fa257e4a899168de7 * chore: bump chromium in DEPS to 00db20e1bc3d77706723a87ada3c1c647a1c37b7 * chore: update patches * refactor: AddNewContents now takes a target_url Refs:2167732
* chore: SetHostCleanupFinalizationGroupCallback has been removed from V8 * refactor: use WebInputEvent::Namespace types directly Refs:2160523
* refactor: FollowRedirect takes in cors exempt headers now Refs:2129787
* refactor: printing::DuplexMode moved to mojo Refs:2162388
* refactor: use MessagePortDescriptor instead of raw mojo::MessagePipeHandles Refs:1952124
* chore: update patches * chore: bump chromium in DEPS to f1537676d613f3567cfb43adf577b3847fba4bc3 * chore: update patches * refactor: service_manager::BinderMapWithContext merged into mojo::BinderMap Refs:2174654
* chore: unused argument removed from ReadAvailableTypes in ui::Clipboard Refs:2173666
* chore: bump chromium in DEPS to 949888433ab935dd6125c107226a4c9d6da9bf48 * chore: update patches * update patches * chore: update sysroots * chore: bump chromium in DEPS to eaac5b5035fe189b6706e1637122e37134206059 * chore: bump chromium in DEPS to 258b54b903d33dab963adf59016691e6537f8b70 * build: update patches * refactor: cursor.mojom and cursor_types.mojom moved to //ui/base/cursor/mojom Refs:2172874
* chore: DesktopWindowTreeHostLinux becomes DesktopWindowTreeHostPlatform Refs: * refactor: LogErrorEventDescription moved from ui to x11 Refs:2164245
* chore: update patches * chore: bump chromium in DEPS to bd06abcfe807d4461683479237cdd920dafa52ca * chore: bump chromium in DEPS to 1afb0891e56f1e79d204db43ca053a46d0974511 * chore: bump chromium in DEPS to 5cb0f794bf7f155bf8c0a241b94e01c9d90c2744 * chore: bump chromium in DEPS to 37327ba3303234e1a3cd3310ca11a68e81b95123 * update patches * remove ClientSideDetectionService from browser_process Refs:2175320
* refactor: shuttle cursor changed event to WebContentsObserver Refs:2172779
* chore: bump chromium in DEPS to 1d97904bb6936e106df13705208b73e47367c2b9 * avoid IPC crash introduced earlier in the roll Refs:b67334e781 (diff-607f4e8f7c5686aa09af98c783925babR128)
* remove WebContentsView::SizeContents Refs:2188931
* chore: bump chromium in DEPS to 87066d1db0546a9de33952ba964e1e42f76f1dae * update patches * adapt to //content creating NetworkContexts2195196
* WIP temporarily ignore mojo-ified PrintHostMsg_PrintPreviewFailed Refs:2195343
* add checkout_pgo_profiles to DEPS * chore: bump chromium in DEPS to a095318bec1dedf580d676f408eaeefdbd9956b1 * add blink's execution_context to electron_lib deps Refs:b67334e781
#,1952124
* update patches * update patches * refactor: use newly mojo-ified PrintPreviewFailed Refs:2195343
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: update patches * chore: remove NOTIFICATION_EXTENSIONS_READY_DEPRECATED Refs:2199874
* avoid a call to Profile::FromBrowserContext in printing Refs:2195757
* chore: bump chromium in DEPS to 8f5c6a46861a991e12ffd80554b6bd41a11b0b65 * chore: bump chromium in DEPS to ab66134739ff3b6bdb8de53bbc58a97d1b7b5d8a * chore: bump chromium in DEPS to dd08df9f6c8d6198f0a7b931ca9e845e27dae033 * chore: update patches * [printing] Mojofy PrintHostMsg_PrintPreviewCancelled2198331
* [printing] Mojofy PrintHostMsg_PrintPreviewInvalidPrinterSettings2200556
* [printing] Mojofy PrintHostMsg_DidPrepareDocumentForPreview2201496
* fix: inherit base network context params * fix: use message handle api specific to embedders * update patches * chore: update v8 headers * fixup! avoid a call to Profile::FromBrowserContext in printing * chore: bump chromium in DEPS to f198bc3276828d992b6202d75a9da6a8363164ea * chore: update patches * Remove cors_exempt_headers.h2203759
* Supply speech recognition sandbox from service_sandbox_type.h2206918
* [content] Remove unused methods from WebContents2199113
* [XProto] Replace XAtom with x11::Atom2202789
* chore: bump chromium in DEPS to 5df37fabaaed09f3ea511f4ef49203d8ebee7b68 * [UI] Support secondary labels in dropdown menus2208976
* chore: update patches * refactor: GetSublabelAt => GetSecondaryLabelAt * Revert "[printing] Mojofy PrintHostMsg_DidPrepareDocumentForPreview" This reverts commit 44ed0892a0c81716229638f17253bbb2cf8f037d.2208778
* Unnest CanonicalCookie::CookieInclusionStatus2203171
* update print-to-pdf.html with latest html data https://bugs.chromium.org/p/chromium/issues/detail?id=1085667 * chore: bump chromium in DEPS to 5dfa8d5f706580fe983e138952553cd6af11ee8b * fix crash in x server when setting window icon * chore: update patches * Use a normal return value for WebContentsView::GetContainerBounds.2212481
* fix build on windows * chore: bump chromium in DEPS to 9d15054f4cba060901e43deecf74002f11f47be3 * chore: update patches * [printing] Mojofy PrintHostMsg_CheckForCancel2212181
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Electron Bot <anonymous@electronjs.org> Co-authored-by: Andy Locascio <andy@slack-corp.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
This commit is contained in:
parent
2b39111e30
commit
dc72f74020
128 changed files with 3519 additions and 2749 deletions
|
@ -113,9 +113,9 @@ BrowserWindow::~BrowserWindow() {
|
|||
|
||||
void BrowserWindow::OnInputEvent(const blink::WebInputEvent& event) {
|
||||
switch (event.GetType()) {
|
||||
case blink::WebInputEvent::kGestureScrollBegin:
|
||||
case blink::WebInputEvent::kGestureScrollUpdate:
|
||||
case blink::WebInputEvent::kGestureScrollEnd:
|
||||
case blink::WebInputEvent::Type::kGestureScrollBegin:
|
||||
case blink::WebInputEvent::Type::kGestureScrollUpdate:
|
||||
case blink::WebInputEvent::Type::kGestureScrollEnd:
|
||||
Emit("scroll-touch-edge");
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "gin/dictionary.h"
|
||||
#include "gin/object_template_builder.h"
|
||||
#include "net/cookies/canonical_cookie.h"
|
||||
#include "net/cookies/cookie_inclusion_status.h"
|
||||
#include "net/cookies/cookie_store.h"
|
||||
#include "net/cookies/cookie_util.h"
|
||||
#include "shell/browser/cookie_change_notifier.h"
|
||||
|
@ -168,25 +169,23 @@ base::Time ParseTimeProperty(const base::Optional<double>& value) {
|
|||
return base::Time::FromDoubleT(*value);
|
||||
}
|
||||
|
||||
std::string InclusionStatusToString(
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
if (status.HasExclusionReason(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_HTTP_ONLY))
|
||||
std::string InclusionStatusToString(net::CookieInclusionStatus status) {
|
||||
if (status.HasExclusionReason(net::CookieInclusionStatus::EXCLUDE_HTTP_ONLY))
|
||||
return "Failed to create httponly cookie";
|
||||
if (status.HasExclusionReason(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SECURE_ONLY))
|
||||
net::CookieInclusionStatus::EXCLUDE_SECURE_ONLY))
|
||||
return "Cannot create a secure cookie from an insecure URL";
|
||||
if (status.HasExclusionReason(net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_FAILURE_TO_STORE))
|
||||
if (status.HasExclusionReason(
|
||||
net::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE))
|
||||
return "Failed to parse cookie";
|
||||
if (status.HasExclusionReason(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN))
|
||||
net::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN))
|
||||
return "Failed to get cookie domain";
|
||||
if (status.HasExclusionReason(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_PREFIX))
|
||||
net::CookieInclusionStatus::EXCLUDE_INVALID_PREFIX))
|
||||
return "Failed because the cookie violated prefix rules.";
|
||||
if (status.HasExclusionReason(net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_NONCOOKIEABLE_SCHEME))
|
||||
if (status.HasExclusionReason(
|
||||
net::CookieInclusionStatus::EXCLUDE_NONCOOKIEABLE_SCHEME))
|
||||
return "Cannot set cookie for current scheme";
|
||||
return "Setting cookie failed";
|
||||
}
|
||||
|
@ -307,9 +306,8 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
|
|||
GURL url(url_string ? *url_string : "");
|
||||
if (!url.is_valid()) {
|
||||
promise.RejectWithErrorMessage(
|
||||
InclusionStatusToString(net::CanonicalCookie::CookieInclusionStatus(
|
||||
net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_INVALID_DOMAIN)));
|
||||
InclusionStatusToString(net::CookieInclusionStatus(
|
||||
net::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN)));
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
@ -322,9 +320,8 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
|
|||
http_only, same_site, net::COOKIE_PRIORITY_DEFAULT);
|
||||
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
|
||||
promise.RejectWithErrorMessage(
|
||||
InclusionStatusToString(net::CanonicalCookie::CookieInclusionStatus(
|
||||
net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_FAILURE_TO_STORE)));
|
||||
InclusionStatusToString(net::CookieInclusionStatus(
|
||||
net::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE)));
|
||||
return handle;
|
||||
}
|
||||
net::CookieOptions options;
|
||||
|
@ -341,7 +338,7 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
|
|||
*canonical_cookie, url, options,
|
||||
base::BindOnce(
|
||||
[](gin_helper::Promise<void> promise,
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
net::CookieInclusionStatus status) {
|
||||
if (status.IsInclude()) {
|
||||
promise.Resolve();
|
||||
} else {
|
||||
|
|
|
@ -147,7 +147,7 @@ void Menu::SetIcon(int index, const gfx::Image& image) {
|
|||
}
|
||||
|
||||
void Menu::SetSublabel(int index, const base::string16& sublabel) {
|
||||
model_->SetSublabel(index, sublabel);
|
||||
model_->SetSecondaryLabel(index, sublabel);
|
||||
}
|
||||
|
||||
void Menu::SetToolTip(int index, const base::string16& toolTip) {
|
||||
|
@ -179,7 +179,7 @@ base::string16 Menu::GetLabelAt(int index) const {
|
|||
}
|
||||
|
||||
base::string16 Menu::GetSublabelAt(int index) const {
|
||||
return model_->GetSublabelAt(index);
|
||||
return model_->GetSecondaryLabelAt(index);
|
||||
}
|
||||
|
||||
base::string16 Menu::GetToolTipAt(int index) const {
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
#include "third_party/blink/public/mojom/messaging/transferable_message.mojom.h"
|
||||
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
|
||||
#include "ui/base/cursor/cursor.h"
|
||||
#include "ui/base/mojom/cursor_type.mojom-shared.h"
|
||||
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
|
||||
|
@ -178,22 +178,22 @@ struct Converter<printing::MarginType> {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct Converter<printing::DuplexMode> {
|
||||
struct Converter<printing::mojom::DuplexMode> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
printing::DuplexMode* out) {
|
||||
printing::mojom::DuplexMode* out) {
|
||||
std::string mode;
|
||||
if (ConvertFromV8(isolate, val, &mode)) {
|
||||
if (mode == "simplex") {
|
||||
*out = printing::SIMPLEX;
|
||||
*out = printing::mojom::DuplexMode::kSimplex;
|
||||
return true;
|
||||
}
|
||||
if (mode == "longEdge") {
|
||||
*out = printing::LONG_EDGE;
|
||||
*out = printing::mojom::DuplexMode::kLongEdge;
|
||||
return true;
|
||||
}
|
||||
if (mode == "shortEdge") {
|
||||
*out = printing::SHORT_EDGE;
|
||||
*out = printing::mojom::DuplexMode::kShortEdge;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -708,6 +708,7 @@ content::WebContents* WebContents::CreateCustomWebContents(
|
|||
void WebContents::AddNewContents(
|
||||
content::WebContents* source,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
const GURL& target_url,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture,
|
||||
|
@ -1392,8 +1393,6 @@ void WebContents::DevToolsClosed() {
|
|||
bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
||||
bool handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP(WebContents, message)
|
||||
IPC_MESSAGE_HANDLER_CODE(WidgetHostMsg_SetCursor, OnCursorChange,
|
||||
handled = false)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
|
||||
|
@ -2036,9 +2035,10 @@ void WebContents::Print(gin_helper::Arguments* args) {
|
|||
}
|
||||
|
||||
// Duplex type user wants to use.
|
||||
printing::DuplexMode duplex_mode;
|
||||
printing::mojom::DuplexMode duplex_mode;
|
||||
options.Get("duplexMode", &duplex_mode);
|
||||
settings.SetIntKey(printing::kSettingDuplexMode, duplex_mode);
|
||||
settings.SetIntKey(printing::kSettingDuplexMode,
|
||||
static_cast<int>(duplex_mode));
|
||||
|
||||
// We've already done necessary parameter sanitization at the
|
||||
// JS level, so we can simply pass this through.
|
||||
|
@ -2311,13 +2311,13 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
|
|||
}
|
||||
} else if (blink::WebInputEvent::IsKeyboardEventType(type)) {
|
||||
content::NativeWebKeyboardEvent keyboard_event(
|
||||
blink::WebKeyboardEvent::kRawKeyDown,
|
||||
blink::WebInputEvent::kNoModifiers, ui::EventTimeForNow());
|
||||
blink::WebKeyboardEvent::Type::kRawKeyDown,
|
||||
blink::WebInputEvent::Modifiers::kNoModifiers, ui::EventTimeForNow());
|
||||
if (gin::ConvertFromV8(isolate, input_event, &keyboard_event)) {
|
||||
rwh->ForwardKeyboardEvent(keyboard_event);
|
||||
return;
|
||||
}
|
||||
} else if (type == blink::WebInputEvent::kMouseWheel) {
|
||||
} else if (type == blink::WebInputEvent::Type::kMouseWheel) {
|
||||
blink::WebMouseWheelEvent mouse_wheel_event;
|
||||
if (gin::ConvertFromV8(isolate, input_event, &mouse_wheel_event)) {
|
||||
if (IsOffScreen()) {
|
||||
|
@ -2450,7 +2450,7 @@ bool WebContents::IsBeingCaptured() {
|
|||
return web_contents()->IsBeingCaptured();
|
||||
}
|
||||
|
||||
void WebContents::OnCursorChange(const content::WebCursor& webcursor) {
|
||||
void WebContents::OnCursorChanged(const content::WebCursor& webcursor) {
|
||||
const ui::Cursor& cursor = webcursor.cursor();
|
||||
|
||||
if (cursor.type() == ui::mojom::CursorType::kCustom) {
|
||||
|
|
|
@ -447,6 +447,7 @@ class WebContents : public gin_helper::TrackableObject<WebContents>,
|
|||
content::WebContents* new_contents) override;
|
||||
void AddNewContents(content::WebContents* source,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
const GURL& target_url,
|
||||
WindowOpenDisposition disposition,
|
||||
const gfx::Rect& initial_rect,
|
||||
bool user_gesture,
|
||||
|
@ -551,6 +552,7 @@ class WebContents : public gin_helper::TrackableObject<WebContents>,
|
|||
content::RenderFrameHost* render_frame_host,
|
||||
const std::string& interface_name,
|
||||
mojo::ScopedMessagePipeHandle* interface_pipe) override;
|
||||
void OnCursorChanged(const content::WebCursor& cursor) override;
|
||||
void DidAcquireFullscreen(content::RenderFrameHost* rfh) override;
|
||||
|
||||
// InspectableWebContentsDelegate:
|
||||
|
@ -608,9 +610,6 @@ class WebContents : public gin_helper::TrackableObject<WebContents>,
|
|||
void SetTemporaryZoomLevel(double level) override;
|
||||
void DoGetZoomLevel(DoGetZoomLevelCallback callback) override;
|
||||
|
||||
// Called when we receive a CursorChange message from chromium.
|
||||
void OnCursorChange(const content::WebCursor& cursor);
|
||||
|
||||
// Called when received a synchronous message from renderer to
|
||||
// get the zoom level.
|
||||
void OnGetZoomLevel(content::RenderFrameHost* frame_host,
|
||||
|
|
|
@ -27,7 +27,13 @@ namespace electron {
|
|||
gin::WrapperInfo MessagePort::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
MessagePort::MessagePort() = default;
|
||||
MessagePort::~MessagePort() = default;
|
||||
MessagePort::~MessagePort() {
|
||||
if (!IsNeutered()) {
|
||||
// Disentangle before teardown. The MessagePortDescriptor will blow up if it
|
||||
// hasn't had its underlying handle returned to it before teardown.
|
||||
Disentangle();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
gin::Handle<MessagePort> MessagePort::Create(v8::Isolate* isolate) {
|
||||
|
@ -97,8 +103,9 @@ void MessagePort::Close() {
|
|||
if (closed_)
|
||||
return;
|
||||
if (!IsNeutered()) {
|
||||
connector_ = nullptr;
|
||||
Entangle(mojo::MessagePipe().handle0);
|
||||
Disentangle().ReleaseHandle();
|
||||
blink::MessagePortDescriptorPair pipe;
|
||||
Entangle(pipe.TakePort0());
|
||||
}
|
||||
closed_ = true;
|
||||
if (!HasPendingActivity())
|
||||
|
@ -111,11 +118,15 @@ void MessagePort::Close() {
|
|||
gin_helper::EmitEvent(isolate, self, "close");
|
||||
}
|
||||
|
||||
void MessagePort::Entangle(mojo::ScopedMessagePipeHandle handle) {
|
||||
DCHECK(handle.is_valid());
|
||||
void MessagePort::Entangle(blink::MessagePortDescriptor port) {
|
||||
DCHECK(port.IsValid());
|
||||
DCHECK(!connector_);
|
||||
port_ = std::move(port);
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
connector_ = std::make_unique<mojo::Connector>(
|
||||
std::move(handle), mojo::Connector::SINGLE_THREADED_SEND,
|
||||
port_.TakeHandleToEntangleWithEmbedder(),
|
||||
mojo::Connector::SINGLE_THREADED_SEND,
|
||||
base::ThreadTaskRunnerHandle::Get());
|
||||
connector_->PauseIncomingMethodCallProcessing();
|
||||
connector_->set_incoming_receiver(this);
|
||||
|
@ -131,11 +142,11 @@ void MessagePort::Entangle(blink::MessagePortChannel channel) {
|
|||
|
||||
blink::MessagePortChannel MessagePort::Disentangle() {
|
||||
DCHECK(!IsNeutered());
|
||||
auto result = blink::MessagePortChannel(connector_->PassMessagePipe());
|
||||
port_.GiveDisentangledHandle(connector_->PassMessagePipe());
|
||||
connector_ = nullptr;
|
||||
if (!HasPendingActivity())
|
||||
Unpin();
|
||||
return result;
|
||||
return blink::MessagePortChannel(std::move(port_));
|
||||
}
|
||||
|
||||
bool MessagePort::HasPendingActivity() const {
|
||||
|
@ -260,9 +271,9 @@ using electron::MessagePort;
|
|||
v8::Local<v8::Value> CreatePair(v8::Isolate* isolate) {
|
||||
auto port1 = MessagePort::Create(isolate);
|
||||
auto port2 = MessagePort::Create(isolate);
|
||||
mojo::MessagePipe pipe;
|
||||
port1->Entangle(std::move(pipe.handle0));
|
||||
port2->Entangle(std::move(pipe.handle1));
|
||||
blink::MessagePortDescriptorPair pipe;
|
||||
port1->Entangle(pipe.TakePort0());
|
||||
port2->Entangle(pipe.TakePort1());
|
||||
return gin::DataObjectBuilder(isolate)
|
||||
.Set("port1", port1)
|
||||
.Set("port2", port2)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mojo/public/cpp/bindings/connector.h"
|
||||
#include "mojo/public/cpp/bindings/message.h"
|
||||
#include "third_party/blink/public/common/messaging/message_port_channel.h"
|
||||
#include "third_party/blink/public/common/messaging/message_port_descriptor.h"
|
||||
|
||||
namespace gin {
|
||||
class Arguments;
|
||||
|
@ -31,7 +32,7 @@ class MessagePort : public gin::Wrappable<MessagePort>, mojo::MessageReceiver {
|
|||
void Start();
|
||||
void Close();
|
||||
|
||||
void Entangle(mojo::ScopedMessagePipeHandle handle);
|
||||
void Entangle(blink::MessagePortDescriptor handle);
|
||||
void Entangle(blink::MessagePortChannel channel);
|
||||
|
||||
blink::MessagePortChannel Disentangle();
|
||||
|
@ -78,6 +79,10 @@ class MessagePort : public gin::Wrappable<MessagePort>, mojo::MessageReceiver {
|
|||
|
||||
v8::Global<v8::Value> pinned_;
|
||||
|
||||
// The internal port owned by this class. The handle itself is moved into the
|
||||
// |connector_| while entangled.
|
||||
blink::MessagePortDescriptor port_;
|
||||
|
||||
base::WeakPtrFactory<MessagePort> weak_factory_{this};
|
||||
};
|
||||
|
||||
|
|
|
@ -232,11 +232,6 @@ BrowserProcessImpl::safe_browsing_service() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
safe_browsing::ClientSideDetectionService*
|
||||
BrowserProcessImpl::safe_browsing_detection_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
subresource_filter::RulesetService*
|
||||
BrowserProcessImpl::subresource_filter_ruleset_service() {
|
||||
return nullptr;
|
||||
|
|
|
@ -77,8 +77,6 @@ class BrowserProcessImpl : public BrowserProcess {
|
|||
BackgroundModeManager* background_mode_manager() override;
|
||||
StatusTray* status_tray() override;
|
||||
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
|
||||
safe_browsing::ClientSideDetectionService* safe_browsing_detection_service()
|
||||
override;
|
||||
subresource_filter::RulesetService* subresource_filter_ruleset_service()
|
||||
override;
|
||||
optimization_guide::OptimizationGuideService* optimization_guide_service()
|
||||
|
|
|
@ -21,7 +21,7 @@ bool CommonWebContentsDelegate::HandleKeyboardEvent(
|
|||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
if (event.skip_in_browser ||
|
||||
event.GetType() == content::NativeWebKeyboardEvent::kChar)
|
||||
event.GetType() == content::NativeWebKeyboardEvent::Type::kChar)
|
||||
return false;
|
||||
|
||||
// Escape exits tabbed fullscreen mode.
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "extensions/browser/extension_protocols.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "mojo/public/cpp/bindings/binder_map.h"
|
||||
#include "net/base/escape.h"
|
||||
#include "net/ssl/ssl_cert_request_info.h"
|
||||
#include "ppapi/buildflags/buildflags.h"
|
||||
|
@ -59,7 +60,6 @@
|
|||
#include "services/device/public/cpp/geolocation/location_provider.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "services/network/public/cpp/resource_request_body.h"
|
||||
#include "services/service_manager/public/cpp/binder_map.h"
|
||||
#include "shell/app/manifests.h"
|
||||
#include "shell/browser/api/electron_api_app.h"
|
||||
#include "shell/browser/api/electron_api_crash_reporter.h"
|
||||
|
@ -1049,14 +1049,16 @@ ElectronBrowserClient::OverrideSystemLocationProvider() {
|
|||
#endif
|
||||
}
|
||||
|
||||
mojo::Remote<network::mojom::NetworkContext>
|
||||
ElectronBrowserClient::CreateNetworkContext(
|
||||
void ElectronBrowserClient::ConfigureNetworkContextParams(
|
||||
content::BrowserContext* browser_context,
|
||||
bool /*in_memory*/,
|
||||
const base::FilePath& /*relative_partition_path*/) {
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) {
|
||||
DCHECK(browser_context);
|
||||
return NetworkContextServiceFactory::GetForContext(browser_context)
|
||||
->CreateNetworkContext();
|
||||
->ConfigureNetworkContextParams(network_context_params,
|
||||
cert_verifier_creation_params);
|
||||
}
|
||||
|
||||
network::mojom::NetworkContext*
|
||||
|
@ -1591,7 +1593,7 @@ void BindBeforeUnloadControl(
|
|||
|
||||
void ElectronBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
||||
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
||||
map->Add<network_hints::mojom::NetworkHintsHandler>(
|
||||
base::BindRepeating(&BindNetworkHintsHandler));
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
|
|
|
@ -69,8 +69,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
|||
mojo::GenericPendingReceiver receiver) override;
|
||||
void RegisterBrowserInterfaceBindersForFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map)
|
||||
override;
|
||||
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override;
|
||||
#if defined(OS_LINUX)
|
||||
void GetAdditionalMappedFilesForChildProcess(
|
||||
const base::CommandLine& command_line,
|
||||
|
@ -152,10 +151,13 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
|||
content::BrowserContext* browser_context) override;
|
||||
std::unique_ptr<device::LocationProvider> OverrideSystemLocationProvider()
|
||||
override;
|
||||
mojo::Remote<network::mojom::NetworkContext> CreateNetworkContext(
|
||||
void ConfigureNetworkContextParams(
|
||||
content::BrowserContext* browser_context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path) override;
|
||||
const base::FilePath& relative_partition_path,
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params)
|
||||
override;
|
||||
network::mojom::NetworkContext* GetSystemNetworkContext() override;
|
||||
base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
|
||||
base::StringPiece name) override;
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include "ui/events/devices/x11/touch_factory_x11.h"
|
||||
#include "ui/gfx/color_utils.h"
|
||||
#include "ui/gfx/x/x11_types.h"
|
||||
#include "ui/gfx/x/xproto_util.h"
|
||||
#include "ui/gtk/gtk_ui.h"
|
||||
#include "ui/gtk/gtk_ui_delegate.h"
|
||||
#include "ui/gtk/gtk_util.h"
|
||||
|
@ -168,7 +169,7 @@ void OverrideLinuxAppDataPath() {
|
|||
int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) {
|
||||
if (!g_in_x11_io_error_handler && base::ThreadTaskRunnerHandle::IsSet()) {
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&ui::LogErrorEventDescription, d, *error));
|
||||
FROM_HERE, base::BindOnce(&x11::LogErrorEventDescription, *error));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -62,10 +62,6 @@ void ElectronExtensionSystem::LoadExtension(
|
|||
void ElectronExtensionSystem::FinishInitialization() {
|
||||
// Inform the rest of the extensions system to start.
|
||||
ready_.Signal();
|
||||
content::NotificationService::current()->Notify(
|
||||
NOTIFICATION_EXTENSIONS_READY_DEPRECATED,
|
||||
content::Source<BrowserContext>(browser_context_),
|
||||
content::NotificationService::NoDetails());
|
||||
}
|
||||
|
||||
void ElectronExtensionSystem::ReloadExtension(const ExtensionId& extension_id) {
|
||||
|
|
|
@ -366,7 +366,7 @@ std::string ElectronExtensionsBrowserClient::GetUserAgent() const {
|
|||
}
|
||||
|
||||
void ElectronExtensionsBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map,
|
||||
mojo::BinderMapWithContext<content::RenderFrameHost*>* map,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const extensions::Extension* extension) const {
|
||||
PopulateExtensionFrameBinders(map, render_frame_host, extension);
|
||||
|
|
|
@ -118,7 +118,7 @@ class ElectronExtensionsBrowserClient
|
|||
std::string GetApplicationLocale() override;
|
||||
std::string GetUserAgent() const override;
|
||||
void RegisterBrowserInterfaceBindersForFrame(
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map,
|
||||
mojo::BinderMapWithContext<content::RenderFrameHost*>* map,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const extensions::Extension* extension) const override;
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "shell/browser/ui/x/window_state_watcher.h"
|
||||
#include "shell/browser/ui/x/x_window_utils.h"
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
#include "ui/gfx/x/x11_types.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
||||
#include "ui/views/window/native_frame_view.h"
|
||||
|
@ -220,15 +221,15 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
|
|||
|
||||
// Before the window is mapped the SetWMSpecState can not work, so we have
|
||||
// to manually set the _NET_WM_STATE.
|
||||
std::vector<::Atom> state_atom_list;
|
||||
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(GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
|
||||
state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
|
||||
}
|
||||
|
||||
// Before the window is mapped, there is no SHOW_FULLSCREEN_STATE.
|
||||
if (fullscreen) {
|
||||
state_atom_list.push_back(GetAtom("_NET_WM_STATE_FULLSCREEN"));
|
||||
state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"));
|
||||
}
|
||||
|
||||
if (parent) {
|
||||
|
@ -237,7 +238,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
|
|||
window_type = "dialog";
|
||||
// Modal window needs the _NET_WM_STATE_MODAL hint.
|
||||
if (is_modal())
|
||||
state_atom_list.push_back(GetAtom("_NET_WM_STATE_MODAL"));
|
||||
state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_MODAL"));
|
||||
}
|
||||
|
||||
if (!state_atom_list.empty())
|
||||
|
@ -453,7 +454,7 @@ void NativeWindowViews::SetEnabledInternal(bool enable) {
|
|||
#if defined(OS_WIN)
|
||||
::EnableWindow(GetAcceleratedWidget(), enable);
|
||||
#elif defined(USE_X11)
|
||||
views::DesktopWindowTreeHostLinux* tree_host =
|
||||
views::DesktopWindowTreeHostPlatform* tree_host =
|
||||
views::DesktopWindowTreeHostLinux::GetHostForWidget(
|
||||
GetAcceleratedWidget());
|
||||
if (enable) {
|
||||
|
@ -863,7 +864,7 @@ void NativeWindowViews::SetSkipTaskbar(bool skip) {
|
|||
}
|
||||
#elif defined(USE_X11)
|
||||
SetWMSpecState(GetAcceleratedWidget(), skip,
|
||||
GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
|
||||
gfx::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -955,8 +956,9 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) {
|
|||
#elif defined(USE_X11)
|
||||
if (ignore) {
|
||||
XRectangle r = {0, 0, 1, 1};
|
||||
XShapeCombineRectangles(gfx::GetXDisplay(), GetAcceleratedWidget(),
|
||||
ShapeInput, 0, 0, &r, 1, ShapeSet, YXBanded);
|
||||
XShapeCombineRectangles(
|
||||
gfx::GetXDisplay(), GetAcceleratedWidget(), ShapeInput, 0, 0, &r, 1,
|
||||
ShapeSet, static_cast<int>(x11::XProto::ClipOrdering::YXBanded));
|
||||
} else {
|
||||
XShapeCombineMask(gfx::GetXDisplay(), GetAcceleratedWidget(), ShapeInput, 0,
|
||||
0, x11::None, ShapeSet);
|
||||
|
@ -1145,8 +1147,8 @@ bool NativeWindowViews::IsVisibleOnAllWorkspaces() {
|
|||
#if defined(USE_X11)
|
||||
// Use the presence/absence of _NET_WM_STATE_STICKY in _NET_WM_STATE to
|
||||
// determine whether the current window is visible on all workspaces.
|
||||
XAtom sticky_atom = GetAtom("_NET_WM_STATE_STICKY");
|
||||
std::vector<XAtom> wm_states;
|
||||
x11::Atom sticky_atom = gfx::GetAtom("_NET_WM_STATE_STICKY");
|
||||
std::vector<x11::Atom> wm_states;
|
||||
ui::GetAtomArrayProperty(GetAcceleratedWidget(), "_NET_WM_STATE", &wm_states);
|
||||
return std::find(wm_states.begin(), wm_states.end(), sticky_atom) !=
|
||||
wm_states.end();
|
||||
|
@ -1274,19 +1276,14 @@ void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) {
|
|||
|
||||
#if defined(USE_X11)
|
||||
void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) {
|
||||
XDisplay* xdisplay = gfx::GetXDisplay();
|
||||
if (use_dark_theme) {
|
||||
XChangeProperty(xdisplay, GetAcceleratedWidget(),
|
||||
XInternAtom(xdisplay, "_GTK_THEME_VARIANT", x11::False),
|
||||
XInternAtom(xdisplay, "UTF8_STRING", x11::False), 8,
|
||||
PropModeReplace,
|
||||
reinterpret_cast<const unsigned char*>("dark"), 4);
|
||||
ui::SetStringProperty(GetAcceleratedWidget(),
|
||||
gfx::GetAtom("_GTK_THEME_VARIANT"),
|
||||
gfx::GetAtom("UTF8_STRING"), "dark");
|
||||
} else {
|
||||
XChangeProperty(xdisplay, GetAcceleratedWidget(),
|
||||
XInternAtom(xdisplay, "_GTK_THEME_VARIANT", x11::False),
|
||||
XInternAtom(xdisplay, "UTF8_STRING", x11::False), 8,
|
||||
PropModeReplace,
|
||||
reinterpret_cast<const unsigned char*>("light"), 5);
|
||||
ui::SetStringProperty(GetAcceleratedWidget(),
|
||||
gfx::GetAtom("_GTK_THEME_VARIANT"),
|
||||
gfx::GetAtom("UTF8_STRING"), "light");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -72,9 +72,11 @@ class AsarURLLoader : public network::mojom::URLLoader {
|
|||
}
|
||||
|
||||
// network::mojom::URLLoader:
|
||||
void FollowRedirect(const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const base::Optional<GURL>& new_url) override {}
|
||||
void FollowRedirect(
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const base::Optional<GURL>& new_url) override {}
|
||||
void SetPriority(net::RequestPriority priority,
|
||||
int32_t intra_priority_value) override {}
|
||||
void PauseReadingBodyFromNet() override {}
|
||||
|
|
|
@ -19,24 +19,14 @@ NetworkContextService::NetworkContextService(content::BrowserContext* context)
|
|||
|
||||
NetworkContextService::~NetworkContextService() = default;
|
||||
|
||||
mojo::Remote<network::mojom::NetworkContext>
|
||||
NetworkContextService::CreateNetworkContext() {
|
||||
mojo::Remote<network::mojom::NetworkContext> network_context;
|
||||
void NetworkContextService::ConfigureNetworkContextParams(
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) {
|
||||
bool in_memory = browser_context_->IsOffTheRecord();
|
||||
const base::FilePath& path = browser_context_->GetPath();
|
||||
|
||||
content::GetNetworkService()->CreateNetworkContext(
|
||||
network_context.BindNewPipeAndPassReceiver(),
|
||||
CreateNetworkContextParams(browser_context_->IsOffTheRecord(),
|
||||
browser_context_->GetPath()));
|
||||
|
||||
return network_context;
|
||||
}
|
||||
|
||||
network::mojom::NetworkContextParamsPtr
|
||||
NetworkContextService::CreateNetworkContextParams(bool in_memory,
|
||||
const base::FilePath& path) {
|
||||
network::mojom::NetworkContextParamsPtr network_context_params =
|
||||
g_browser_process->system_network_context_manager()
|
||||
->CreateDefaultNetworkContextParams();
|
||||
g_browser_process->system_network_context_manager()
|
||||
->ConfigureDefaultNetworkContextParams(network_context_params);
|
||||
|
||||
network_context_params->user_agent = browser_context_->GetUserAgent();
|
||||
|
||||
|
@ -80,12 +70,10 @@ NetworkContextService::CreateNetworkContextParams(bool in_memory,
|
|||
network_context_params->enable_ftp_url_support = true;
|
||||
#endif // !BUILDFLAG(DISABLE_FTP_SUPPORT)
|
||||
|
||||
proxy_config_monitor_.AddToNetworkContextParams(network_context_params.get());
|
||||
proxy_config_monitor_.AddToNetworkContextParams(network_context_params);
|
||||
|
||||
BrowserProcessImpl::ApplyProxyModeFromCommandLine(
|
||||
browser_context_->in_memory_pref_store());
|
||||
|
||||
return network_context_params;
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -24,8 +24,10 @@ class NetworkContextService : public KeyedService {
|
|||
NetworkContextService(const NetworkContextService&) = delete;
|
||||
NetworkContextService& operator=(const NetworkContextService&) = delete;
|
||||
|
||||
// Creates a NetworkContext for the BrowserContext.
|
||||
mojo::Remote<network::mojom::NetworkContext> CreateNetworkContext();
|
||||
void ConfigureNetworkContextParams(
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams*
|
||||
cert_verifier_creation_params);
|
||||
|
||||
private:
|
||||
// Creates parameters for the NetworkContext.
|
||||
|
|
|
@ -51,9 +51,11 @@ class NodeStreamLoader : public network::mojom::URLLoader {
|
|||
void On(const char* event, EventCallback callback);
|
||||
|
||||
// URLLoader:
|
||||
void FollowRedirect(const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const base::Optional<GURL>& new_url) override {}
|
||||
void FollowRedirect(
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const base::Optional<GURL>& new_url) override {}
|
||||
void SetPriority(net::RequestPriority priority,
|
||||
int32_t intra_priority_value) override {}
|
||||
void PauseReadingBodyFromNet() override {}
|
||||
|
|
|
@ -170,6 +170,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::RestartInternal() {
|
|||
void ProxyingURLLoaderFactory::InProgressRequest::FollowRedirect(
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const base::Optional<GURL>& new_url) {
|
||||
if (new_url)
|
||||
request_.url = new_url.value();
|
||||
|
@ -190,11 +191,12 @@ void ProxyingURLLoaderFactory::InProgressRequest::FollowRedirect(
|
|||
// headers and if so we'll pass these modifications to FollowRedirect.
|
||||
if (current_request_uses_header_client_) {
|
||||
target_loader_->FollowRedirect(removed_headers, modified_headers,
|
||||
new_url);
|
||||
modified_cors_exempt_headers, new_url);
|
||||
} else {
|
||||
auto params = std::make_unique<FollowRedirectParams>();
|
||||
params->removed_headers = removed_headers;
|
||||
params->modified_headers = modified_headers;
|
||||
params->modified_cors_exempt_headers = modified_cors_exempt_headers;
|
||||
params->new_url = new_url;
|
||||
pending_follow_redirect_params_ = std::move(params);
|
||||
}
|
||||
|
@ -453,6 +455,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToSendHeaders(
|
|||
target_loader_->FollowRedirect(
|
||||
pending_follow_redirect_params_->removed_headers,
|
||||
pending_follow_redirect_params_->modified_headers,
|
||||
pending_follow_redirect_params_->modified_cors_exempt_headers,
|
||||
pending_follow_redirect_params_->new_url);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,9 +63,11 @@ class ProxyingURLLoaderFactory
|
|||
void Restart();
|
||||
|
||||
// network::mojom::URLLoader:
|
||||
void FollowRedirect(const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const base::Optional<GURL>& new_url) override;
|
||||
void FollowRedirect(
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const base::Optional<GURL>& new_url) override;
|
||||
void SetPriority(net::RequestPriority priority,
|
||||
int32_t intra_priority_value) override;
|
||||
void PauseReadingBodyFromNet() override;
|
||||
|
@ -158,6 +160,7 @@ class ProxyingURLLoaderFactory
|
|||
~FollowRedirectParams();
|
||||
std::vector<std::string> removed_headers;
|
||||
net::HttpRequestHeaders modified_headers;
|
||||
net::HttpRequestHeaders modified_cors_exempt_headers;
|
||||
base::Optional<GURL> new_url;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(FollowRedirectParams);
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/cors_exempt_headers.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
#include "content/public/common/service_names.mojom.h"
|
||||
|
@ -22,6 +21,7 @@
|
|||
#include "services/network/public/cpp/cross_thread_pending_shared_url_loader_factory.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "shell/browser/electron_browser_client.h"
|
||||
#include "shell/common/application_info.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
|
@ -155,10 +155,12 @@ SystemNetworkContextManager::CreateDefaultNetworkContextParams() {
|
|||
network::mojom::NetworkContextParamsPtr network_context_params =
|
||||
network::mojom::NetworkContextParams::New();
|
||||
|
||||
// This is required to avoid blocking X-Requested-With headers sent by PPAPI
|
||||
// plugins, more info crbug.com/940331
|
||||
content::UpdateCorsExemptHeader(network_context_params.get());
|
||||
ConfigureDefaultNetworkContextParams(network_context_params.get());
|
||||
return network_context_params;
|
||||
}
|
||||
|
||||
void SystemNetworkContextManager::ConfigureDefaultNetworkContextParams(
|
||||
network::mojom::NetworkContextParams* network_context_params) {
|
||||
network_context_params->enable_brotli = true;
|
||||
|
||||
network_context_params->enable_referrers = true;
|
||||
|
@ -169,8 +171,6 @@ SystemNetworkContextManager::CreateDefaultNetworkContextParams() {
|
|||
#if !BUILDFLAG(DISABLE_FTP_SUPPORT)
|
||||
network_context_params->enable_ftp_url_support = true;
|
||||
#endif
|
||||
|
||||
return network_context_params;
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -57,7 +57,13 @@ class SystemNetworkContextManager {
|
|||
// Destroys the global SystemNetworkContextManager instance.
|
||||
static void DeleteInstance();
|
||||
|
||||
// Returns default set of parameters for configuring the network service.
|
||||
// Configures default set of parameters for configuring the network context.
|
||||
void ConfigureDefaultNetworkContextParams(
|
||||
network::mojom::NetworkContextParams* network_context_params);
|
||||
|
||||
// Same as ConfigureDefaultNetworkContextParams() but returns a newly
|
||||
// allocated network::mojom::NetworkContextParams with the
|
||||
// CertVerifierCreationParams already placed into the NetworkContextParams.
|
||||
network::mojom::NetworkContextParamsPtr CreateDefaultNetworkContextParams();
|
||||
|
||||
// Returns the System NetworkContext. May only be called after SetUp(). Does
|
||||
|
|
|
@ -59,9 +59,11 @@ class URLPipeLoader : public network::mojom::URLLoader,
|
|||
void OnRetry(base::OnceClosure start_retry) override;
|
||||
|
||||
// URLLoader:
|
||||
void FollowRedirect(const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const base::Optional<GURL>& new_url) override {}
|
||||
void FollowRedirect(
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const base::Optional<GURL>& new_url) override {}
|
||||
void SetPriority(net::RequestPriority priority,
|
||||
int32_t intra_priority_value) override {}
|
||||
void PauseReadingBodyFromNet() override {}
|
||||
|
|
|
@ -57,22 +57,22 @@ const float kDefaultScaleFactor = 1.0;
|
|||
ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
|
||||
ui::EventType type = ui::EventType::ET_UNKNOWN;
|
||||
switch (event.GetType()) {
|
||||
case blink::WebInputEvent::kMouseDown:
|
||||
case blink::WebInputEvent::Type::kMouseDown:
|
||||
type = ui::EventType::ET_MOUSE_PRESSED;
|
||||
break;
|
||||
case blink::WebInputEvent::kMouseUp:
|
||||
case blink::WebInputEvent::Type::kMouseUp:
|
||||
type = ui::EventType::ET_MOUSE_RELEASED;
|
||||
break;
|
||||
case blink::WebInputEvent::kMouseMove:
|
||||
case blink::WebInputEvent::Type::kMouseMove:
|
||||
type = ui::EventType::ET_MOUSE_MOVED;
|
||||
break;
|
||||
case blink::WebInputEvent::kMouseEnter:
|
||||
case blink::WebInputEvent::Type::kMouseEnter:
|
||||
type = ui::EventType::ET_MOUSE_ENTERED;
|
||||
break;
|
||||
case blink::WebInputEvent::kMouseLeave:
|
||||
case blink::WebInputEvent::Type::kMouseLeave:
|
||||
type = ui::EventType::ET_MOUSE_EXITED;
|
||||
break;
|
||||
case blink::WebInputEvent::kMouseWheel:
|
||||
case blink::WebInputEvent::Type::kMouseWheel:
|
||||
type = ui::EventType::ET_MOUSEWHEEL;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -86,12 +86,10 @@ gfx::NativeWindow OffScreenWebContentsView::GetTopLevelNativeWindow() const {
|
|||
}
|
||||
#endif
|
||||
|
||||
void OffScreenWebContentsView::GetContainerBounds(gfx::Rect* out) const {
|
||||
*out = GetViewBounds();
|
||||
gfx::Rect OffScreenWebContentsView::GetContainerBounds() const {
|
||||
return GetViewBounds();
|
||||
}
|
||||
|
||||
void OffScreenWebContentsView::SizeContents(const gfx::Size& size) {}
|
||||
|
||||
void OffScreenWebContentsView::Focus() {}
|
||||
|
||||
void OffScreenWebContentsView::SetInitialFocus() {}
|
||||
|
@ -167,7 +165,8 @@ void OffScreenWebContentsView::StartDragging(
|
|||
const content::DragEventSourceInfo& event_info,
|
||||
content::RenderWidgetHostImpl* source_rwh) {
|
||||
if (web_contents_)
|
||||
web_contents_->SystemDragEnded(source_rwh);
|
||||
static_cast<content::WebContentsImpl*>(web_contents_)
|
||||
->SystemDragEnded(source_rwh);
|
||||
}
|
||||
|
||||
void OffScreenWebContentsView::UpdateDragCursor(
|
||||
|
|
|
@ -43,8 +43,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
|||
gfx::NativeView GetNativeView() const override;
|
||||
gfx::NativeView GetContentNativeView() const override;
|
||||
gfx::NativeWindow GetTopLevelNativeWindow() const override;
|
||||
void GetContainerBounds(gfx::Rect* out) const override;
|
||||
void SizeContents(const gfx::Size& size) override;
|
||||
gfx::Rect GetContainerBounds() const override;
|
||||
void Focus() override;
|
||||
void SetInitialFocus() override;
|
||||
void StoreFocus() override;
|
||||
|
|
|
@ -69,16 +69,6 @@ bool PrintPreviewMessageHandler::OnMessageReceived(
|
|||
OnMetafileReadyForPrinting)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
if (handled)
|
||||
return true;
|
||||
|
||||
handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP(PrintPreviewMessageHandler, message)
|
||||
IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewFailed, OnPrintPreviewFailed)
|
||||
IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewCancelled,
|
||||
OnPrintPreviewCancelled)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
return handled;
|
||||
}
|
||||
|
||||
|
@ -134,20 +124,24 @@ void PrintPreviewMessageHandler::OnCompositePdfDocumentDone(
|
|||
base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(region));
|
||||
}
|
||||
|
||||
void PrintPreviewMessageHandler::OnPrintPreviewFailed(
|
||||
int document_cookie,
|
||||
const PrintHostMsg_PreviewIds& ids) {
|
||||
void PrintPreviewMessageHandler::PrintPreviewFailed(int32_t document_cookie,
|
||||
int32_t request_id) {
|
||||
StopWorker(document_cookie);
|
||||
|
||||
RejectPromise(ids.request_id);
|
||||
RejectPromise(request_id);
|
||||
}
|
||||
|
||||
void PrintPreviewMessageHandler::OnPrintPreviewCancelled(
|
||||
int document_cookie,
|
||||
const PrintHostMsg_PreviewIds& ids) {
|
||||
void PrintPreviewMessageHandler::PrintPreviewCancelled(int32_t document_cookie,
|
||||
int32_t request_id) {
|
||||
StopWorker(document_cookie);
|
||||
|
||||
RejectPromise(ids.request_id);
|
||||
RejectPromise(request_id);
|
||||
}
|
||||
|
||||
void PrintPreviewMessageHandler::CheckForCancel(
|
||||
int32_t request_id,
|
||||
CheckForCancelCallback callback) {
|
||||
std::move(callback).Run(false);
|
||||
}
|
||||
|
||||
void PrintPreviewMessageHandler::PrintToPDF(
|
||||
|
@ -162,8 +156,13 @@ void PrintPreviewMessageHandler::PrintToPDF(
|
|||
? focused_frame
|
||||
: web_contents()->GetMainFrame();
|
||||
|
||||
if (!print_render_frame_.is_bound())
|
||||
if (!print_render_frame_.is_bound()) {
|
||||
rfh->GetRemoteAssociatedInterfaces()->GetInterface(&print_render_frame_);
|
||||
}
|
||||
if (!receiver_.is_bound()) {
|
||||
print_render_frame_->SetPrintPreviewUI(
|
||||
receiver_.BindNewEndpointAndPassRemote());
|
||||
}
|
||||
print_render_frame_->PrintPreview(options.Clone());
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "components/services/print_compositor/public/mojom/print_compositor.mojom.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "content/public/browser/web_contents_user_data.h"
|
||||
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/associated_remote.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
@ -29,6 +30,7 @@ namespace electron {
|
|||
// Manages the print preview handling for a WebContents.
|
||||
class PrintPreviewMessageHandler
|
||||
: public content::WebContentsObserver,
|
||||
public printing::mojom::PrintPreviewUI,
|
||||
public content::WebContentsUserData<PrintPreviewMessageHandler> {
|
||||
public:
|
||||
~PrintPreviewMessageHandler() override;
|
||||
|
@ -54,10 +56,18 @@ class PrintPreviewMessageHandler
|
|||
const PrintHostMsg_PreviewIds& ids,
|
||||
printing::mojom::PrintCompositor::Status status,
|
||||
base::ReadOnlySharedMemoryRegion region);
|
||||
void OnPrintPreviewFailed(int document_cookie,
|
||||
const PrintHostMsg_PreviewIds& ids);
|
||||
void OnPrintPreviewCancelled(int document_cookie,
|
||||
const PrintHostMsg_PreviewIds& ids);
|
||||
|
||||
// printing::mojo::PrintPreviewUI:
|
||||
void SetOptionsFromDocument(
|
||||
const printing::mojom::OptionsFromDocumentParamsPtr params,
|
||||
int32_t request_id) override {}
|
||||
void PrintPreviewFailed(int32_t document_cookie, int32_t request_id) override;
|
||||
void PrintPreviewCancelled(int32_t document_cookie,
|
||||
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);
|
||||
|
||||
|
@ -70,6 +80,8 @@ class PrintPreviewMessageHandler
|
|||
|
||||
mojo::AssociatedRemote<printing::mojom::PrintRenderFrame> print_render_frame_;
|
||||
|
||||
mojo::AssociatedReceiver<printing::mojom::PrintPreviewUI> receiver_{this};
|
||||
|
||||
base::WeakPtrFactory<PrintPreviewMessageHandler> weak_ptr_factory_;
|
||||
|
||||
WEB_CONTENTS_USER_DATA_KEY_DECL();
|
||||
|
|
|
@ -41,12 +41,13 @@ base::string16 ElectronMenuModel::GetRoleAt(int index) {
|
|||
return iter == std::end(roles_) ? base::string16() : iter->second;
|
||||
}
|
||||
|
||||
void ElectronMenuModel::SetSublabel(int index, const base::string16& sublabel) {
|
||||
void ElectronMenuModel::SetSecondaryLabel(int index,
|
||||
const base::string16& sublabel) {
|
||||
int command_id = GetCommandIdAt(index);
|
||||
sublabels_[command_id] = sublabel;
|
||||
}
|
||||
|
||||
base::string16 ElectronMenuModel::GetSublabelAt(int index) const {
|
||||
base::string16 ElectronMenuModel::GetSecondaryLabelAt(int index) const {
|
||||
int command_id = GetCommandIdAt(index);
|
||||
const auto iter = sublabels_.find(command_id);
|
||||
return iter == std::end(sublabels_) ? base::string16() : iter->second;
|
||||
|
|
|
@ -57,8 +57,8 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
|||
base::string16 GetToolTipAt(int index);
|
||||
void SetRole(int index, const base::string16& role);
|
||||
base::string16 GetRoleAt(int index);
|
||||
void SetSublabel(int index, const base::string16& sublabel);
|
||||
base::string16 GetSublabelAt(int index) const override;
|
||||
void SetSecondaryLabel(int index, const base::string16& sublabel);
|
||||
base::string16 GetSecondaryLabelAt(int index) const override;
|
||||
bool GetAcceleratorAtWithParams(int index,
|
||||
bool use_default_accelerator,
|
||||
ui::Accelerator* accelerator) const;
|
||||
|
|
|
@ -114,11 +114,11 @@ void RootView::HandleKeyEvent(const content::NativeWebKeyboardEvent& event) {
|
|||
|
||||
// Show accelerator when "Alt" is pressed.
|
||||
if (menu_bar_visible_ && IsAltKey(event))
|
||||
menu_bar_->SetAcceleratorVisibility(event.GetType() ==
|
||||
blink::WebInputEvent::kRawKeyDown);
|
||||
menu_bar_->SetAcceleratorVisibility(
|
||||
event.GetType() == blink::WebInputEvent::Type::kRawKeyDown);
|
||||
|
||||
// Show the submenu when "Alt+Key" is pressed.
|
||||
if (event.GetType() == blink::WebInputEvent::kRawKeyDown &&
|
||||
if (event.GetType() == blink::WebInputEvent::Type::kRawKeyDown &&
|
||||
!IsAltKey(event) && IsAltModifier(event)) {
|
||||
if (menu_bar_->HasAccelerator(event.windows_key_code)) {
|
||||
if (!menu_bar_visible_) {
|
||||
|
@ -135,10 +135,11 @@ void RootView::HandleKeyEvent(const content::NativeWebKeyboardEvent& event) {
|
|||
}
|
||||
|
||||
// Toggle the menu bar only when a single Alt is released.
|
||||
if (event.GetType() == blink::WebInputEvent::kRawKeyDown && IsAltKey(event)) {
|
||||
if (event.GetType() == blink::WebInputEvent::Type::kRawKeyDown &&
|
||||
IsAltKey(event)) {
|
||||
// When a single Alt is pressed:
|
||||
menu_bar_alt_pressed_ = true;
|
||||
} else if (event.GetType() == blink::WebInputEvent::kKeyUp &&
|
||||
} else if (event.GetType() == blink::WebInputEvent::Type::kKeyUp &&
|
||||
IsAltKey(event) && menu_bar_alt_pressed_) {
|
||||
// When a single Alt is released right after a Alt is pressed:
|
||||
menu_bar_alt_pressed_ = false;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/ui/x/window_state_watcher.h"
|
||||
#include "ui/gfx/x/x11.h"
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -56,7 +55,7 @@ void WindowStateWatcher::DidProcessXEvent(XEvent* xev) {
|
|||
}
|
||||
|
||||
bool WindowStateWatcher::IsWindowStateEvent(XEvent* xev) const {
|
||||
return (xev->xproperty.atom == window_state_atom_ &&
|
||||
return (static_cast<x11::Atom>(xev->xproperty.atom) == window_state_atom_ &&
|
||||
xev->type == PropertyNotify && xev->xproperty.window == widget_);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define SHELL_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
|
||||
|
||||
#include "ui/events/platform/x11/x11_event_source.h"
|
||||
#include "ui/gfx/x/x11.h"
|
||||
|
||||
#include "shell/browser/native_window_views.h"
|
||||
|
||||
|
@ -26,7 +27,7 @@ class WindowStateWatcher : public ui::XEventObserver {
|
|||
|
||||
NativeWindowViews* window_;
|
||||
gfx::AcceleratedWidget widget_;
|
||||
const ::XAtom window_state_atom_;
|
||||
const x11::Atom window_state_atom_;
|
||||
|
||||
bool was_minimized_ = false;
|
||||
bool was_maximized_ = false;
|
||||
|
|
|
@ -14,22 +14,20 @@
|
|||
#include "dbus/message.h"
|
||||
#include "dbus/object_proxy.h"
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
::Atom GetAtom(const char* name) {
|
||||
return XInternAtom(gfx::GetXDisplay(), name, false);
|
||||
}
|
||||
|
||||
void SetWMSpecState(::Window xwindow, bool enabled, ::Atom state) {
|
||||
void SetWMSpecState(::Window xwindow, bool enabled, x11::Atom state) {
|
||||
XEvent xclient;
|
||||
memset(&xclient, 0, sizeof(xclient));
|
||||
xclient.type = ClientMessage;
|
||||
xclient.xclient.window = xwindow;
|
||||
xclient.xclient.message_type = GetAtom("_NET_WM_STATE");
|
||||
xclient.xclient.message_type =
|
||||
static_cast<uint32_t>(gfx::GetAtom("_NET_WM_STATE"));
|
||||
xclient.xclient.format = 32;
|
||||
xclient.xclient.data.l[0] = enabled ? 1 : 0;
|
||||
xclient.xclient.data.l[1] = state;
|
||||
xclient.xclient.data.l[1] = static_cast<uint32_t>(state);
|
||||
xclient.xclient.data.l[2] = x11::None;
|
||||
xclient.xclient.data.l[3] = 1;
|
||||
xclient.xclient.data.l[4] = 0;
|
||||
|
@ -40,14 +38,10 @@ void SetWMSpecState(::Window xwindow, bool enabled, ::Atom state) {
|
|||
}
|
||||
|
||||
void SetWindowType(::Window xwindow, const std::string& type) {
|
||||
XDisplay* xdisplay = gfx::GetXDisplay();
|
||||
std::string type_prefix = "_NET_WM_WINDOW_TYPE_";
|
||||
::Atom window_type = XInternAtom(
|
||||
xdisplay, (type_prefix + base::ToUpperASCII(type)).c_str(), x11::False);
|
||||
XChangeProperty(xdisplay, xwindow,
|
||||
XInternAtom(xdisplay, "_NET_WM_WINDOW_TYPE", x11::False),
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
reinterpret_cast<unsigned char*>(&window_type), 1);
|
||||
x11::Atom window_type = gfx::GetAtom(type_prefix + base::ToUpperASCII(type));
|
||||
ui::SetProperty(xwindow, gfx::GetAtom("_NET_WM_WINDOW_TYPE"), x11::Atom::ATOM,
|
||||
window_type);
|
||||
}
|
||||
|
||||
bool ShouldUseGlobalMenuBar() {
|
||||
|
@ -100,11 +94,13 @@ void MoveWindowAbove(::Window xwindow, ::Window other_xwindow) {
|
|||
xclient.type = ClientMessage;
|
||||
xclient.xclient.display = xdisplay;
|
||||
xclient.xclient.window = xwindow;
|
||||
xclient.xclient.message_type = GetAtom("_NET_RESTACK_WINDOW");
|
||||
xclient.xclient.message_type =
|
||||
static_cast<uint32_t>(gfx::GetAtom("_NET_RESTACK_WINDOW"));
|
||||
xclient.xclient.format = 32;
|
||||
xclient.xclient.data.l[0] = 2;
|
||||
xclient.xclient.data.l[1] = other_xwindow;
|
||||
xclient.xclient.data.l[2] = Above;
|
||||
xclient.xclient.data.l[2] =
|
||||
static_cast<uint32_t>(x11::Connection::StackMode::Above);
|
||||
xclient.xclient.data.l[3] = 0;
|
||||
xclient.xclient.data.l[4] = 0;
|
||||
|
||||
|
|
|
@ -11,11 +11,9 @@
|
|||
|
||||
namespace electron {
|
||||
|
||||
::Atom GetAtom(const char* name);
|
||||
|
||||
// Sends a message to the x11 window manager, enabling or disabling the |state|
|
||||
// for _NET_WM_STATE.
|
||||
void SetWMSpecState(::Window xwindow, bool enabled, ::Atom state);
|
||||
void SetWMSpecState(::Window xwindow, bool enabled, x11::Atom state);
|
||||
|
||||
// Sets the _NET_WM_WINDOW_TYPE of window.
|
||||
void SetWindowType(::Window xwindow, const std::string& type);
|
||||
|
|
|
@ -29,10 +29,8 @@ ui::ClipboardBuffer Clipboard::GetClipboardBuffer(gin_helper::Arguments* args) {
|
|||
std::vector<base::string16> Clipboard::AvailableFormats(
|
||||
gin_helper::Arguments* args) {
|
||||
std::vector<base::string16> format_types;
|
||||
bool ignore;
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
clipboard->ReadAvailableTypes(GetClipboardBuffer(args), &format_types,
|
||||
&ignore);
|
||||
clipboard->ReadAvailableTypes(GetClipboardBuffer(args), &format_types);
|
||||
return format_types;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,33 +61,33 @@ struct Converter<blink::WebInputEvent::Type> {
|
|||
blink::WebInputEvent::Type* out) {
|
||||
std::string type = base::ToLowerASCII(gin::V8ToString(isolate, val));
|
||||
if (type == "mousedown")
|
||||
*out = blink::WebInputEvent::kMouseDown;
|
||||
*out = blink::WebInputEvent::Type::kMouseDown;
|
||||
else if (type == "mouseup")
|
||||
*out = blink::WebInputEvent::kMouseUp;
|
||||
*out = blink::WebInputEvent::Type::kMouseUp;
|
||||
else if (type == "mousemove")
|
||||
*out = blink::WebInputEvent::kMouseMove;
|
||||
*out = blink::WebInputEvent::Type::kMouseMove;
|
||||
else if (type == "mouseenter")
|
||||
*out = blink::WebInputEvent::kMouseEnter;
|
||||
*out = blink::WebInputEvent::Type::kMouseEnter;
|
||||
else if (type == "mouseleave")
|
||||
*out = blink::WebInputEvent::kMouseLeave;
|
||||
*out = blink::WebInputEvent::Type::kMouseLeave;
|
||||
else if (type == "contextmenu")
|
||||
*out = blink::WebInputEvent::kContextMenu;
|
||||
*out = blink::WebInputEvent::Type::kContextMenu;
|
||||
else if (type == "mousewheel")
|
||||
*out = blink::WebInputEvent::kMouseWheel;
|
||||
*out = blink::WebInputEvent::Type::kMouseWheel;
|
||||
else if (type == "keydown")
|
||||
*out = blink::WebInputEvent::kRawKeyDown;
|
||||
*out = blink::WebInputEvent::Type::kRawKeyDown;
|
||||
else if (type == "keyup")
|
||||
*out = blink::WebInputEvent::kKeyUp;
|
||||
*out = blink::WebInputEvent::Type::kKeyUp;
|
||||
else if (type == "char")
|
||||
*out = blink::WebInputEvent::kChar;
|
||||
*out = blink::WebInputEvent::Type::kChar;
|
||||
else if (type == "touchstart")
|
||||
*out = blink::WebInputEvent::kTouchStart;
|
||||
*out = blink::WebInputEvent::Type::kTouchStart;
|
||||
else if (type == "touchmove")
|
||||
*out = blink::WebInputEvent::kTouchMove;
|
||||
*out = blink::WebInputEvent::Type::kTouchMove;
|
||||
else if (type == "touchend")
|
||||
*out = blink::WebInputEvent::kTouchEnd;
|
||||
*out = blink::WebInputEvent::Type::kTouchEnd;
|
||||
else if (type == "touchcancel")
|
||||
*out = blink::WebInputEvent::kTouchCancel;
|
||||
*out = blink::WebInputEvent::Type::kTouchCancel;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -117,38 +117,38 @@ struct Converter<blink::WebInputEvent::Modifiers> {
|
|||
blink::WebInputEvent::Modifiers* out) {
|
||||
std::string modifier = base::ToLowerASCII(gin::V8ToString(isolate, val));
|
||||
if (modifier == "shift")
|
||||
*out = blink::WebInputEvent::kShiftKey;
|
||||
*out = blink::WebInputEvent::Modifiers::kShiftKey;
|
||||
else if (modifier == "control" || modifier == "ctrl")
|
||||
*out = blink::WebInputEvent::kControlKey;
|
||||
*out = blink::WebInputEvent::Modifiers::kControlKey;
|
||||
else if (modifier == "alt")
|
||||
*out = blink::WebInputEvent::kAltKey;
|
||||
*out = blink::WebInputEvent::Modifiers::kAltKey;
|
||||
else if (modifier == "meta" || modifier == "command" || modifier == "cmd")
|
||||
*out = blink::WebInputEvent::kMetaKey;
|
||||
*out = blink::WebInputEvent::Modifiers::kMetaKey;
|
||||
else if (modifier == "iskeypad")
|
||||
*out = blink::WebInputEvent::kIsKeyPad;
|
||||
*out = blink::WebInputEvent::Modifiers::kIsKeyPad;
|
||||
else if (modifier == "isautorepeat")
|
||||
*out = blink::WebInputEvent::kIsAutoRepeat;
|
||||
*out = blink::WebInputEvent::Modifiers::kIsAutoRepeat;
|
||||
else if (modifier == "leftbuttondown")
|
||||
*out = blink::WebInputEvent::kLeftButtonDown;
|
||||
*out = blink::WebInputEvent::Modifiers::kLeftButtonDown;
|
||||
else if (modifier == "middlebuttondown")
|
||||
*out = blink::WebInputEvent::kMiddleButtonDown;
|
||||
*out = blink::WebInputEvent::Modifiers::kMiddleButtonDown;
|
||||
else if (modifier == "rightbuttondown")
|
||||
*out = blink::WebInputEvent::kRightButtonDown;
|
||||
*out = blink::WebInputEvent::Modifiers::kRightButtonDown;
|
||||
else if (modifier == "capslock")
|
||||
*out = blink::WebInputEvent::kCapsLockOn;
|
||||
*out = blink::WebInputEvent::Modifiers::kCapsLockOn;
|
||||
else if (modifier == "numlock")
|
||||
*out = blink::WebInputEvent::kNumLockOn;
|
||||
*out = blink::WebInputEvent::Modifiers::kNumLockOn;
|
||||
else if (modifier == "left")
|
||||
*out = blink::WebInputEvent::kIsLeft;
|
||||
*out = blink::WebInputEvent::Modifiers::kIsLeft;
|
||||
else if (modifier == "right")
|
||||
*out = blink::WebInputEvent::kIsRight;
|
||||
*out = blink::WebInputEvent::Modifiers::kIsRight;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
blink::WebInputEvent::Type GetWebInputEventType(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val) {
|
||||
blink::WebInputEvent::Type type = blink::WebInputEvent::kUndefined;
|
||||
blink::WebInputEvent::Type type = blink::WebInputEvent::Type::kUndefined;
|
||||
gin_helper::Dictionary dict;
|
||||
ConvertFromV8(isolate, val, &dict) && dict.Get("type", &type);
|
||||
return type;
|
||||
|
@ -188,7 +188,8 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(v8::Isolate* isolate,
|
|||
ui::KeyboardCode keyCode = electron::KeyboardCodeFromStr(str, &shifted);
|
||||
out->windows_key_code = keyCode;
|
||||
if (shifted)
|
||||
out->SetModifiers(out->GetModifiers() | blink::WebInputEvent::kShiftKey);
|
||||
out->SetModifiers(out->GetModifiers() |
|
||||
blink::WebInputEvent::Modifiers::kShiftKey);
|
||||
|
||||
ui::DomCode domCode = ui::UsLayoutKeyboardCodeToDomCode(keyCode);
|
||||
out->dom_code = static_cast<int>(domCode);
|
||||
|
@ -199,8 +200,8 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(v8::Isolate* isolate,
|
|||
if (ui::DomCodeToUsLayoutDomKey(domCode, flags, &domKey, &dummy_code))
|
||||
out->dom_key = static_cast<int>(domKey);
|
||||
|
||||
if ((out->GetType() == blink::WebInputEvent::kChar ||
|
||||
out->GetType() == blink::WebInputEvent::kRawKeyDown)) {
|
||||
if ((out->GetType() == blink::WebInputEvent::Type::kChar ||
|
||||
out->GetType() == blink::WebInputEvent::Type::kRawKeyDown)) {
|
||||
// Make sure to not read beyond the buffer in case some bad code doesn't
|
||||
// NULL-terminate it (this is called from plugins).
|
||||
size_t text_length_cap = blink::WebKeyboardEvent::kTextLengthCap;
|
||||
|
@ -275,7 +276,8 @@ bool Converter<blink::WebMouseWheelEvent>::FromV8(
|
|||
bool can_scroll = true;
|
||||
if (dict.Get("canScroll", &can_scroll) && !can_scroll) {
|
||||
out->delta_units = ui::ScrollGranularity::kScrollByPage;
|
||||
out->SetModifiers(out->GetModifiers() & ~blink::WebInputEvent::kControlKey);
|
||||
out->SetModifiers(out->GetModifiers() &
|
||||
~blink::WebInputEvent::Modifiers::kControlKey);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
|
@ -371,9 +373,8 @@ v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags) {
|
|||
bool pasteFlag = false;
|
||||
if (editFlags & blink::ContextMenuDataEditFlags::kCanPaste) {
|
||||
std::vector<base::string16> types;
|
||||
bool ignore;
|
||||
ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes(
|
||||
ui::ClipboardBuffer::kCopyPaste, &types, &ignore);
|
||||
ui::ClipboardBuffer::kCopyPaste, &types);
|
||||
pasteFlag = !types.empty();
|
||||
}
|
||||
dict.Set("canPaste", pasteFlag);
|
||||
|
|
|
@ -329,27 +329,27 @@ ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted) {
|
|||
int WebEventModifiersToEventFlags(int modifiers) {
|
||||
int flags = 0;
|
||||
|
||||
if (modifiers & blink::WebInputEvent::kShiftKey)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kShiftKey)
|
||||
flags |= ui::EF_SHIFT_DOWN;
|
||||
if (modifiers & blink::WebInputEvent::kControlKey)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kControlKey)
|
||||
flags |= ui::EF_CONTROL_DOWN;
|
||||
if (modifiers & blink::WebInputEvent::kAltKey)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kAltKey)
|
||||
flags |= ui::EF_ALT_DOWN;
|
||||
if (modifiers & blink::WebInputEvent::kMetaKey)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kMetaKey)
|
||||
flags |= ui::EF_COMMAND_DOWN;
|
||||
if (modifiers & blink::WebInputEvent::kCapsLockOn)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kCapsLockOn)
|
||||
flags |= ui::EF_CAPS_LOCK_ON;
|
||||
if (modifiers & blink::WebInputEvent::kNumLockOn)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kNumLockOn)
|
||||
flags |= ui::EF_NUM_LOCK_ON;
|
||||
if (modifiers & blink::WebInputEvent::kScrollLockOn)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kScrollLockOn)
|
||||
flags |= ui::EF_SCROLL_LOCK_ON;
|
||||
if (modifiers & blink::WebInputEvent::kLeftButtonDown)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kLeftButtonDown)
|
||||
flags |= ui::EF_LEFT_MOUSE_BUTTON;
|
||||
if (modifiers & blink::WebInputEvent::kMiddleButtonDown)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kMiddleButtonDown)
|
||||
flags |= ui::EF_MIDDLE_MOUSE_BUTTON;
|
||||
if (modifiers & blink::WebInputEvent::kRightButtonDown)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kRightButtonDown)
|
||||
flags |= ui::EF_RIGHT_MOUSE_BUTTON;
|
||||
if (modifiers & blink::WebInputEvent::kIsAutoRepeat)
|
||||
if (modifiers & blink::WebInputEvent::Modifiers::kIsAutoRepeat)
|
||||
flags |= ui::EF_IS_REPEAT;
|
||||
|
||||
return flags;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "shell/common/mouse_util.h"
|
||||
#include "ui/base/mojom/cursor_type.mojom-shared.h"
|
||||
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
|
||||
|
||||
using Cursor = ui::mojom::CursorType;
|
||||
|
||||
|
|
|
@ -220,16 +220,6 @@ void SetNodeOptions(base::Environment* env) {
|
|||
}
|
||||
}
|
||||
|
||||
void HostCleanupFinalizationGroupCallback(
|
||||
v8::Local<v8::Context> context,
|
||||
v8::Local<v8::FinalizationGroup> group) {
|
||||
node::Environment* env = node::Environment::GetCurrent(context);
|
||||
if (env == nullptr) {
|
||||
return;
|
||||
}
|
||||
env->RegisterFinalizationGroupForCleanup(group);
|
||||
}
|
||||
|
||||
bool AllowWasmCodeGenerationCallback(v8::Local<v8::Context> context,
|
||||
v8::Local<v8::String>) {
|
||||
v8::Local<v8::Value> wasm_code_gen = context->GetEmbedderData(
|
||||
|
@ -424,12 +414,6 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
// This needs to be called before the inspector is initialized.
|
||||
env->InitializeDiagnostics();
|
||||
|
||||
// Ensure that WeakRefs work properly by specifying the callback to be called
|
||||
// when FinalizationRegistries are ready to be cleaned up and require
|
||||
// FinalizationGroup::Cleanup() to be called in a future task.
|
||||
context->GetIsolate()->SetHostCleanupFinalizationGroupCallback(
|
||||
HostCleanupFinalizationGroupCallback);
|
||||
|
||||
// Set the callback to invoke to check if wasm code generation should be
|
||||
// allowed.
|
||||
context->GetIsolate()->SetAllowWasmCodeGenerationCallback(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue