electron/shell/browser/native_window_mac.mm

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1873 lines
62 KiB
Text
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
2013-04-12 07:04:46 +00:00
// found in the LICENSE file.
#include "shell/browser/native_window_mac.h"
2013-04-12 07:04:46 +00:00
2017-10-05 22:57:27 +00:00
#include <AvailabilityMacros.h>
2018-05-02 11:43:45 +00:00
#include <objc/objc-runtime.h>
#include <algorithm>
2016-10-26 00:55:34 +00:00
#include <string>
#include <utility>
#include <vector>
chore: bump chromium to 94.0.4590.2 (main) (#30274) * chore: bump chromium in DEPS to 94.0.4587.0 * chore: update patches * 2823155: fix GPU video decoding capabilities enumeration Ref: https://chromium-review.googlesource.com/c/chromium/src/+/2823155 * 3041383: Reduce includes in url_request_mojom_traits.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3041383 * chore: bump chromium in DEPS to 94.0.4588.0 * chore: update patches * chore: bump chromium in DEPS to 94.0.4589.0 * chore: update patches * 3050633: Rename ScaleFactor to ResourceScaleFactor Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3050633 * 3048296: Create new mojo target to prevent traits header spreading Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3048296 * 3046186: Rename base::ClampToRange Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3046186 * chore: update picture-in-picture patch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056037 * chore: bump chromium in DEPS to 94.0.4590.0 * chore: update patches * 3057495: Fix base::NoDestructor usage in Mac KeychainPassword Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3057495 * 3056134: Remove NetworkIsolationKey unused methods Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056134 * 3035091: [rab/gsab] Fix gsab maxByteLength after transferring to worker Adds a patch to v8 to disable a DCHECK that is also firing on node streams in child processes. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3035091 * chore: bump chromium in DEPS to 94.0.4590.2 * chore: fix mas_no_private_api.patch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049052 * 3049555: [views] Add CHECK to prevent fallthrough to global NativeTheme Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049555 * chore: empty commit * chore: fix whitespace for lint * chore: cherry-pick chromium woa fix * Revert "chore: cherry-pick chromium woa fix" This reverts commit 64f3082e2d5f93ef0e2ac5d98246532a105fd4a1. * chore: fix the build on Windows on ARM * chore: remove commented code in printing.patch * fixup! chore: remove commented code in printing.patch do not remove the new weak_ptr check * build: sync disable_use_lld_for_macos.patch Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <keeleymhammond@gmail.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-08-11 21:04:56 +00:00
#include "base/cxx17_backports.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/strings/sys_string_conversions.h"
#include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
chore: bump chromium to 92.0.4475.0 (master) (#28462) * chore: bump chromium in DEPS to 91.0.4464.0 * chore: rebuild chromium/dcheck.patch with import-patches -3 Mechanical only; no code changes * chore: remove content_browser_main_loop.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 The function being patched (BrowserMainLoop::MainMessageLoopRun()) no longer exists. NB: if removing this introduces regressions the likely fix will be to add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop() which has similar code and was added at the same time this was removed. * chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch Mechanical only; no code changes * chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/ui_gtk_public_header.patch manually no code changes * chore: rebuild chromium/web_contents.patch with import-patches -3 Mechanical only; no code changes * chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874 This patch has been merged upstream * chore: export patches * chore: update add_trustedauthclient_to_urlloaderfactory.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969 Sync with removal of render_frame_id_ * chore: sync chromium/put_back_deleted_colors_for_autofill.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841 SkColorFromColorId() no longer takes theme, scheme args * chore: sync chromium/put_back_deleted_colors_for_autofill.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143 Change new calls to GetDarkSchemeColor to fit our patched call signature * chore: update add_trustedauthclient_to_urlloaderfactory.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969 Sync with removal of render_frame_id_ in our mojom * chore: update chromium/frame_host_manager.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008 UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool * chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314 Upstream has removed `history_list_length_` which we were comparing to 0 to calculate our `is_initial_navigation` bool when calling ShouldFork(). ShouldFork() is ours and none of the code paths actually use that param, so this commit removes it altogether. * chore: update permissions_to_register Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074 Replace all uses of APIPermission::ID enum with Mojo type * refactor: update return type of PreMainMessageLoopRun() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 Used to return void; now returns an int errorcode. Note: 2725153 also has some nice doc updates about Browser's "stages" * refactor: sync ElectronBrowserMainParts to MainParts changes Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop so `BrowserMainLoop::result_code_` is no longer available to us for our exit_code_ pointer. This variable held a dual role: (1) of course, hold the exit code, but also (2) was a nullptr before the message loop was ready, indicating to anyone calling SetExitCode() that we were still in startup and could just exit() without any extra steps. exit_code_ still fulfills these two roles but is now a base::Optional. * chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been removed; move that work to the new WillRunMainMessageLoop(). * refactor: stop using CallbackList; it has been removed. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973 * refactor: update use of threadpools. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408 The upstream code is still in flux (e.g. reverts and re-lands) but the tl;dr for this commit is (1) include thread_pool.h if you're using it and (2) don't instantiate pools directly. * refactor: remove routing_id from CreateLoaderAndStart Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858 NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart calls std::make_unique<InProgressRequest>, which needs a routing_id. This PR uses the member field `routing_id_` since there's no longer one being passed into CreateLoaderAndStart. * refactor: sync to upstream ParittionOptions churn Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318 PartitionOptions' enums have changed. * refactor: update Manifest::Location usage Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320 tldr: s/Manifest::FOO/ManifestLocation::kFoo/ * chore: bump chromium in DEPS to 91.0.4465.0 * update patches * refactor: update extensions::Manifest to upstream Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320 - extensions::Manifest::COMPONENT + extensions::mojom::ManifestLocation::kExternalComponent * refactor: sync with upstream UrlInfo ctor changes Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008 UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool * chore: update invocation of convert_protocol_to_json.py Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623 python3 is being used in parts of the upstream build, but the copy of convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol is not python3-friendly. Node has a py2+3-friendly version of it in its tools directory, so call it instead. * chore: use extensions::mojom::APIPermissionID Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122 tldr: - extensions::APIPermission::kFoo + extensions::mojom::APIPermissionID::kFoo * chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737 Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function. This is the same change made upstream at https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc * fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun * chore: Use IDType for permission change subscriptions. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431 tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to be an int; now it's the new SubscriptionId type (which is an IdType64). * chore: sync PowerMonitor code to upstream refactor Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635 tldr: PowerMonitor has been split into PowerStateObserver, PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks posted to consumers who only need notifications for one of those things instead of all of them. * chore: use PartitionOptions's new Cookies field Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318 * Revert "refactor: remove routing_id from CreateLoaderAndStart" This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245. 8c9773b was only a partial fix; reverting to start & try again. * update patches * chore: bump chromium in DEPS to 91.0.4466.0 * chore: update chromium/accelerator.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472 tldr: sync patch with upstream renamed variable & macro names. * chore: update chromium/gtk_visibility.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200 tldr: no code changes; just updating the diff to apply cleanly. note: ooh upstream Wayland hacking! * chore: update chromium/picture-in-picture.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023 tldr: no code changes; just updating the diff to apply cleanly. * chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573 tldr: no code changes; just updating the diff to apply cleanly. * chore: export_all_patches * chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511 tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated, so update the invocation in our patch. * chore: update ElectronBrowserClient w/upstream API Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454 tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer. Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>. * chore: handle new content::PermissionType::FILE_HANDLING in toV8() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201 `file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc * refactor: remove routing_id from CreateLoaderAndStart pt 1 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858 Part 1: the easiest ones * 2796724: Support Python3 https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724 * chore: bump chromium in DEPS to 91.0.4468.0 * 2668974: WebShare: Implement SharingServicePicker https://chromium-review.googlesource.com/c/chromium/src/+/2668974 * 2802766: Apply modernize-make-unique to media/ https://chromium-review.googlesource.com/c/chromium/src/+/2802766 * 2802823: Apply modernize-make-unique to gpu/ https://chromium-review.googlesource.com/c/chromium/src/+/2802823 * 2803041: Apply modernize-make-unique to remaining files https://chromium-review.googlesource.com/c/chromium/src/+/2803041 * 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks https://chromium-review.googlesource.com/c/chromium/src/+/2798873 * 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed https://chromium-review.googlesource.com/c/chromium/src/+/2733595 * chore: update patch indices * 2795107: Remove unused PermissionRequest IDs. https://chromium-review.googlesource.com/c/chromium/src/+/2795107 * chore: bump chromium in DEPS to 91.0.4469.0 * chore: fixup patch indices * chore: bump chromium in DEPS to 91.0.4469.5 * PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window https://chromium-review.googlesource.com/c/chromium/src/+/2710023 * fixup! refactor: remove routing_id from CreateLoaderAndStart * refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader * fixup! chore: fixup patch indices * 2724817: Expand scope of wasm-eval to all URLs https://chromium-review.googlesource.com/c/chromium/src/+/2724817 * Fixup patch after rebase * chore: bump chromium in DEPS to 91.0.4472.0 * 2797341: [ozone/x11] Enabled the global shortcut listener. https://chromium-review.googlesource.com/c/chromium/src/+/2797341 * 2805553: Reland Add GTK ColorMixers to ColorPipeline P1 https://chromium-review.googlesource.com/c/chromium/src/+/2805553 * 2804366: PiP 1.5: Label back to tab button with origin and center it https://chromium-review.googlesource.com/c/chromium/src/+/2804366 * 2784730: Fix crash on AX mode change in NativeViewHost without a Widget https://chromium-review.googlesource.com/c/chromium/src/+/2784730 * chore: update patch indices * 2810174: Add PdfAnnotationsEnabled policy. https://chromium-review.googlesource.com/c/chromium/src/+/2810174 * 2807829: Allow capturers to indicate if they want a WakeLock or not. https://chromium-review.googlesource.com/c/chromium/src/+/2807829 * chore: bump chromium in DEPS to 92.0.4473.0 * chore: bump chromium in DEPS to 92.0.4474.0 * chore: bump chromium in DEPS to 92.0.4475.0 * chore: update patches * chore: updates patches * chore: update is_media_key patch to handle new ozone impl Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341 * fix: ExecuteJavascript requests now need to be flagged as non-bf-aware Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195 * chore: icon_util_x11 is now icon_util_linux Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362 * build: update sysroots Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496 * build: fix missing symbols on linux build * use_ozone and use_x11 are not exclusive * new button view to build for pip Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366 * chore: fix broken gtk_util color patch * chore: remove patch conflict * build: update linux manifests * chore: build bttlb on all platforms for pip * chore: add thread_pool include for views delegate win * chore: fix lint * chore: add node patches for V8 changes * build: add missing base include on windows * fix: update frame host manager patch for new state transitions Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464 * chore: update windows zip manifests * chore: update mac zip manifests * chore: fix patch linting * refactor: implement missing URLLoaderNetworkServiceObserver methods It is against The Mojo Rules to leave hanging callbacks. These always have to be called. Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda * spec: fix locale test on local linux * fix: pass the exit code correctly in new PreMainMessageLoopRun Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475 * fix: ensure we early-exit when request_handler_ is not provided Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5 * fix: strongly set result_code in the BrowserMainLoop * fix: invalid usage of non-targetted PostTask You must always either use a host threadpool or specify a target thread. In this case we did neither after this refactor. Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f * chore: fix gn check * chore: remove stray .rej files in patch * chore: add mojo error code to url loader failure * build: ensure CI is truthy in arm test env * fix: handle windowCaptureMacV2 being enabled when fetching media source id Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931 Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
#include "components/remote_cocoa/browser/scoped_cg_window_id.h"
2015-04-13 12:10:51 +00:00
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/desktop_media_id.h"
#include "shell/browser/javascript_environment.h"
#include "shell/browser/native_browser_view_mac.h"
#include "shell/browser/ui/cocoa/electron_native_widget_mac.h"
#include "shell/browser/ui/cocoa/electron_ns_window.h"
#include "shell/browser/ui/cocoa/electron_ns_window_delegate.h"
#include "shell/browser/ui/cocoa/electron_preview_item.h"
#include "shell/browser/ui/cocoa/electron_touch_bar.h"
#include "shell/browser/ui/cocoa/root_view_mac.h"
#include "shell/browser/ui/cocoa/window_buttons_proxy.h"
#include "shell/browser/ui/inspectable_web_contents.h"
#include "shell/browser/ui/inspectable_web_contents_view.h"
#include "shell/browser/window_list.h"
#include "shell/common/gin_converters/gfx_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"
#include "shell/common/options_switches.h"
#include "shell/common/process_util.h"
#include "skia/ext/skia_utils_mac.h"
#include "third_party/webrtc/modules/desktop_capture/mac/window_list_utils.h"
#include "ui/display/screen.h"
#include "ui/gfx/skia_util.h"
#include "ui/gl/gpu_switching_manager.h"
2018-04-24 10:00:44 +00:00
#include "ui/views/background.h"
#include "ui/views/cocoa/native_widget_mac_ns_window_host.h"
2018-04-19 06:26:34 +00:00
#include "ui/views/widget/widget.h"
2013-04-12 07:04:46 +00:00
// This view would inform Chromium to resize the hosted views::View.
//
2022-02-21 09:27:45 +00:00
// The overridden methods should behave the same with BridgedContentView.
@interface ElectronAdaptedContentView : NSView {
@private
views::NativeWidgetMacNSWindowHost* bridge_host_;
}
@end
@implementation ElectronAdaptedContentView
- (id)initWithShell:(electron::NativeWindowMac*)shell {
if ((self = [self init])) {
bridge_host_ = views::NativeWidgetMacNSWindowHost::GetFromNativeWindow(
shell->GetNativeWindow());
}
return self;
}
- (void)viewDidMoveToWindow {
// When this view is added to a window, AppKit calls setFrameSize before it is
// added to the window, so the behavior in setFrameSize is not triggered.
NSWindow* window = [self window];
if (window)
[self setFrameSize:NSZeroSize];
}
- (void)setFrameSize:(NSSize)newSize {
// The size passed in here does not always use
// -[NSWindow contentRectForFrameRect]. The following ensures that the
// contentView for a frameless window can extend over the titlebar of the new
// window containing it, since AppKit requires a titlebar to give frameless
// windows correct shadows and rounded corners.
NSWindow* window = [self window];
if (window && [window contentView] == self) {
newSize = [window contentRectForFrameRect:[window frame]].size;
// Ensure that the window geometry be updated on the host side before the
// view size is updated.
bridge_host_->GetInProcessNSWindowBridge()->UpdateWindowGeometry();
}
[super setFrameSize:newSize];
// The OnViewSizeChanged is marked private in derived class.
static_cast<remote_cocoa::mojom::NativeWidgetNSWindowHost*>(bridge_host_)
->OnViewSizeChanged(gfx::Size(newSize.width, newSize.height));
}
@end
// This view always takes the size of its superview. It is intended to be used
// as a NSWindow's contentView. It is needed because NSWindow's implementation
// explicitly resizes the contentView at inopportune times.
@interface FullSizeContentView : NSView
@end
@implementation FullSizeContentView
// This method is directly called by NSWindow during a window resize on OSX
// 10.10.0, beta 2. We must override it to prevent the content view from
// shrinking.
- (void)setFrameSize:(NSSize)size {
if ([self superview])
size = [[self superview] bounds].size;
[super setFrameSize:size];
}
// The contentView gets moved around during certain full-screen operations.
// This is less than ideal, and should eventually be removed.
- (void)viewDidMoveToSuperview {
[self setFrame:[[self superview] bounds]];
}
@end
2014-09-17 07:58:08 +00:00
@interface ElectronProgressBar : NSProgressIndicator
@end
@implementation ElectronProgressBar
- (void)drawRect:(NSRect)dirtyRect {
if (self.style != NSProgressIndicatorBarStyle)
return;
// Draw edges of rounded rect.
NSRect rect = NSInsetRect([self bounds], 1.0, 1.0);
2014-09-18 08:17:49 +00:00
CGFloat radius = rect.size.height / 2;
2018-04-20 18:47:04 +00:00
NSBezierPath* bezier_path = [NSBezierPath bezierPathWithRoundedRect:rect
xRadius:radius
yRadius:radius];
2014-09-18 08:17:49 +00:00
[bezier_path setLineWidth:2.0];
[[NSColor grayColor] set];
[bezier_path stroke];
2014-09-17 07:58:08 +00:00
// Fill the rounded rect.
2014-09-18 08:17:49 +00:00
rect = NSInsetRect(rect, 2.0, 2.0);
radius = rect.size.height / 2;
2018-04-20 18:47:04 +00:00
bezier_path = [NSBezierPath bezierPathWithRoundedRect:rect
xRadius:radius
yRadius:radius];
2014-09-18 08:17:49 +00:00
[bezier_path setLineWidth:1.0];
[bezier_path addClip];
2014-09-17 07:58:08 +00:00
// Calculate the progress width.
2018-04-20 18:47:04 +00:00
rect.size.width =
floor(rect.size.width * ([self doubleValue] / [self maxValue]));
2014-09-17 07:58:08 +00:00
// Fill the progress bar with color blue.
[[NSColor colorWithSRGBRed:0.2 green:0.6 blue:1 alpha:1] set];
NSRectFill(rect);
}
@end
namespace gin {
template <>
struct Converter<electron::NativeWindowMac::VisualEffectState> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
electron::NativeWindowMac::VisualEffectState* out) {
using VisualEffectState = electron::NativeWindowMac::VisualEffectState;
std::string visual_effect_state;
if (!ConvertFromV8(isolate, val, &visual_effect_state))
return false;
if (visual_effect_state == "followWindow") {
*out = VisualEffectState::kFollowWindow;
} else if (visual_effect_state == "active") {
*out = VisualEffectState::kActive;
} else if (visual_effect_state == "inactive") {
*out = VisualEffectState::kInactive;
} else {
return false;
}
return true;
}
};
} // namespace gin
2013-04-12 07:04:46 +00:00
namespace electron {
2018-05-02 11:43:45 +00:00
namespace {
bool IsFramelessWindow(NSView* view) {
NSWindow* nswindow = [view window];
if (![nswindow respondsToSelector:@selector(shell)])
return false;
NativeWindow* window = [static_cast<ElectronNSWindow*>(nswindow) shell];
2018-05-02 11:43:45 +00:00
return window && !window->has_frame();
}
IMP original_set_frame_size = nullptr;
IMP original_view_did_move_to_superview = nullptr;
// This method is directly called by NSWindow during a window resize on OSX
// 10.10.0, beta 2. We must override it to prevent the content view from
// shrinking.
void SetFrameSize(NSView* self, SEL _cmd, NSSize size) {
if (!IsFramelessWindow(self)) {
auto original =
reinterpret_cast<decltype(&SetFrameSize)>(original_set_frame_size);
return original(self, _cmd, size);
}
// For frameless window, resize the view to cover full window.
if ([self superview])
size = [[self superview] bounds].size;
auto super_impl = reinterpret_cast<decltype(&SetFrameSize)>(
[[self superclass] instanceMethodForSelector:_cmd]);
super_impl(self, _cmd, size);
}
// The contentView gets moved around during certain full-screen operations.
// This is less than ideal, and should eventually be removed.
void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
if (!IsFramelessWindow(self)) {
// [BridgedContentView viewDidMoveToSuperview];
auto original = reinterpret_cast<decltype(&ViewDidMoveToSuperview)>(
original_view_did_move_to_superview);
if (original)
original(self, _cmd);
return;
2018-05-02 11:43:45 +00:00
}
[self setFrame:[[self superview] bounds]];
}
} // namespace
NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
2018-04-08 11:20:43 +00:00
NativeWindow* parent)
: NativeWindow(options, parent), root_view_(new RootViewMac(this)) {
ui::NativeTheme::GetInstanceForNativeUi()->AddObserver(this);
display::Screen::GetScreen()->AddObserver(this);
int width = 800, height = 600;
options.Get(options::kWidth, &width);
options.Get(options::kHeight, &height);
2013-04-12 07:04:46 +00:00
NSRect main_screen_rect = [[[NSScreen screens] firstObject] frame];
2018-04-24 08:23:08 +00:00
gfx::Rect bounds(round((NSWidth(main_screen_rect) - width) / 2),
round((NSHeight(main_screen_rect) - height) / 2), width,
2018-04-24 08:23:08 +00:00
height);
chore: bump chromium to 93.0.4530.0 (master) (#29256) * chore: bump chromium in DEPS to 92.0.4512.6 * 2887336: [CaptureHandle][#2] Propagate CaptureHandleConfig in browser process https://chromium-review.googlesource.com/c/chromium/src/+/2887336 * refactor: base::Optional -> absl::optional * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4514.0 * 2899417: Make build work when enable_pdf is set to false. https://chromium-review.googlesource.com/c/chromium/src/+/2899417 * 2904731: use BrowserContext instead of Profile in PreconnectManager https://chromium-review.googlesource.com/c/chromium/src/+/2904731 * 2295749: fix: check IsSecureEventInputEnabled in constructor before setting SetPasswordInputEnabled to true https://chromium-review.googlesource.com/c/chromium/src/+/2295749 * 2893803: Add a GetWebView to RenderFrame. https://chromium-review.googlesource.com/c/chromium/src/+/2893803 * 2892345: Implement WebContents::ForEachRenderFrameHost https://chromium-review.googlesource.com/c/chromium/src/+/2892345 * chore: fixup patch indices * 2892048: Real instance methods for BrowserContext: remaining 5 methods. https://chromium-review.googlesource.com/c/chromium/src/+/2892048 * 2902821: [mojo] Don't require full header includes for referenced interfaces https://chromium-review.googlesource.com/c/chromium/src/+/2902821 * 2496500: Remove last deprecated extension Event ctor. https://chromium-review.googlesource.com/c/chromium/src/+/2496500 * chore: fixup malformed pepper support patch * chore: bump chromium in DEPS to 92.0.4515.0 * 2908461: Add CreateEmptyPrintPagesParamsPtr() inside print_view_manager_base.cc. https://chromium-review.googlesource.com/c/chromium/src/+/2908461 * 2880838: viz: add optional HDRMetadata to TransferableResource https://chromium-review.googlesource.com/c/chromium/src/+/2880838 * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4515.5 * chore: update patches * chore: bump chromium in DEPS to 92.0.4515.7 * chore: bump chromium in DEPS to 92.0.4515.9 * chore: bump chromium in DEPS to 93.0.4522.0 * chore: bump chromium in DEPS to 93.0.4523.0 * chore: bump chromium in DEPS to 93.0.4524.0 * chore: update patches * chore: enable_pak_file_integrity_checks was reverted * chore: update patches * refactor: base/optional was replaced with absl::optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::nullopt with absl::nullopt Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::make_optional with absl::make_optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace WorldScriptContext() with GetScriptContextFromWorldId Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893213 * chore: clean up left over opening namespace Refs: https://github.com/electron/electron/commit/95bfe6d08f65471394fb3005dbfa177cdf71210a * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace GetCurrentDisplayIterator with the hard checker GetCurrentDisplay This code looks suspicious but if the iterator was invalid before it will also be invalid now. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893191 * refactor: headers are now passed directly in extensions client Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2918906 * refactor: base::DictionaryValue::empty() has been removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2912424 * chore: add missing includes for network URLLoaderFactory Refs: unknown, probably a side effect of header changes * refactor: make convenience wrapper around AppendArg There is no converter FromV8 for base::StringPiece (apparently its not possible). So we now take in an std::string and use the construct for StringPiece to do implicit conversion. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2905544 * chore: add patch * chore: bump chromium in DEPS to 93.0.4525.0 * chore: update patches * refactor: CanResize has been de-virtualized Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2485774 * chore: update resource integrity patch * chore: add character encoding idl patch * chore: bump chromium in DEPS to 93.0.4526.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4527.0 * chore: bump chromium in DEPS to 93.0.4528.0 * chore: update patches * chore: update idl encoding patch * chore: bump chromium in DEPS to 93.0.4529.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4530.0 * chore: update patches * fix: only SetCanResize after the widget has been initialized * chore: add patch for vr on windows gn gen * spec: fix focus related tests on linux due to delay in focus swap * chore: remove new usages of base::Optional from main Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-03 08:05:04 +00:00
bool resizable = true;
options.Get(options::kResizable, &resizable);
2018-04-24 10:00:44 +00:00
options.Get(options::kZoomToPageWidth, &zoom_to_page_width_);
options.Get(options::kSimpleFullScreen, &always_simple_fullscreen_);
options.GetOptional(options::kTrafficLightPosition, &traffic_light_position_);
options.Get(options::kVisualEffectState, &visual_effect_state_);
if (options.Has(options::kFullscreenWindowTitle)) {
EmitWarning(
node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate()),
"\"fullscreenWindowTitle\" option has been deprecated and is "
"no-op now.",
"electron");
}
bool minimizable = true;
options.Get(options::kMinimizable, &minimizable);
2016-01-23 07:51:52 +00:00
2016-01-22 21:24:33 +00:00
bool maximizable = true;
options.Get(options::kMaximizable, &maximizable);
bool closable = true;
options.Get(options::kClosable, &closable);
2017-03-30 20:47:11 +00:00
std::string tabbingIdentifier;
options.Get(options::kTabbingIdentifier, &tabbingIdentifier);
2017-03-27 14:15:17 +00:00
std::string windowType;
options.Get(options::kType, &windowType);
bool useStandardWindow = true;
// eventually deprecate separate "standardWindow" option in favor of
// standard / textured window types
options.Get(options::kStandardWindow, &useStandardWindow);
if (windowType == "textured") {
useStandardWindow = false;
}
// The window without titlebar is treated the same with frameless window.
if (title_bar_style_ != TitleBarStyle::kNormal)
set_has_frame(false);
NSUInteger styleMask = NSWindowStyleMaskTitled;
// Removing NSWindowStyleMaskTitled removes window title, which removes
// rounded corners of window.
bool rounded_corner = true;
options.Get(options::kRoundedCorners, &rounded_corner);
if (!rounded_corner && !has_frame())
styleMask = 0;
if (minimizable)
styleMask |= NSWindowStyleMaskMiniaturizable;
if (closable)
styleMask |= NSWindowStyleMaskClosable;
chore: bump chromium to 93.0.4530.0 (master) (#29256) * chore: bump chromium in DEPS to 92.0.4512.6 * 2887336: [CaptureHandle][#2] Propagate CaptureHandleConfig in browser process https://chromium-review.googlesource.com/c/chromium/src/+/2887336 * refactor: base::Optional -> absl::optional * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4514.0 * 2899417: Make build work when enable_pdf is set to false. https://chromium-review.googlesource.com/c/chromium/src/+/2899417 * 2904731: use BrowserContext instead of Profile in PreconnectManager https://chromium-review.googlesource.com/c/chromium/src/+/2904731 * 2295749: fix: check IsSecureEventInputEnabled in constructor before setting SetPasswordInputEnabled to true https://chromium-review.googlesource.com/c/chromium/src/+/2295749 * 2893803: Add a GetWebView to RenderFrame. https://chromium-review.googlesource.com/c/chromium/src/+/2893803 * 2892345: Implement WebContents::ForEachRenderFrameHost https://chromium-review.googlesource.com/c/chromium/src/+/2892345 * chore: fixup patch indices * 2892048: Real instance methods for BrowserContext: remaining 5 methods. https://chromium-review.googlesource.com/c/chromium/src/+/2892048 * 2902821: [mojo] Don't require full header includes for referenced interfaces https://chromium-review.googlesource.com/c/chromium/src/+/2902821 * 2496500: Remove last deprecated extension Event ctor. https://chromium-review.googlesource.com/c/chromium/src/+/2496500 * chore: fixup malformed pepper support patch * chore: bump chromium in DEPS to 92.0.4515.0 * 2908461: Add CreateEmptyPrintPagesParamsPtr() inside print_view_manager_base.cc. https://chromium-review.googlesource.com/c/chromium/src/+/2908461 * 2880838: viz: add optional HDRMetadata to TransferableResource https://chromium-review.googlesource.com/c/chromium/src/+/2880838 * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4515.5 * chore: update patches * chore: bump chromium in DEPS to 92.0.4515.7 * chore: bump chromium in DEPS to 92.0.4515.9 * chore: bump chromium in DEPS to 93.0.4522.0 * chore: bump chromium in DEPS to 93.0.4523.0 * chore: bump chromium in DEPS to 93.0.4524.0 * chore: update patches * chore: enable_pak_file_integrity_checks was reverted * chore: update patches * refactor: base/optional was replaced with absl::optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::nullopt with absl::nullopt Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::make_optional with absl::make_optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace WorldScriptContext() with GetScriptContextFromWorldId Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893213 * chore: clean up left over opening namespace Refs: https://github.com/electron/electron/commit/95bfe6d08f65471394fb3005dbfa177cdf71210a * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace GetCurrentDisplayIterator with the hard checker GetCurrentDisplay This code looks suspicious but if the iterator was invalid before it will also be invalid now. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893191 * refactor: headers are now passed directly in extensions client Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2918906 * refactor: base::DictionaryValue::empty() has been removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2912424 * chore: add missing includes for network URLLoaderFactory Refs: unknown, probably a side effect of header changes * refactor: make convenience wrapper around AppendArg There is no converter FromV8 for base::StringPiece (apparently its not possible). So we now take in an std::string and use the construct for StringPiece to do implicit conversion. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2905544 * chore: add patch * chore: bump chromium in DEPS to 93.0.4525.0 * chore: update patches * refactor: CanResize has been de-virtualized Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2485774 * chore: update resource integrity patch * chore: add character encoding idl patch * chore: bump chromium in DEPS to 93.0.4526.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4527.0 * chore: bump chromium in DEPS to 93.0.4528.0 * chore: update patches * chore: update idl encoding patch * chore: bump chromium in DEPS to 93.0.4529.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4530.0 * chore: update patches * fix: only SetCanResize after the widget has been initialized * chore: add patch for vr on windows gn gen * spec: fix focus related tests on linux due to delay in focus swap * chore: remove new usages of base::Optional from main Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-03 08:05:04 +00:00
if (resizable)
styleMask |= NSWindowStyleMaskResizable;
if (!useStandardWindow || transparent() || !has_frame())
styleMask |= NSWindowStyleMaskTexturedBackground;
2018-04-24 08:23:08 +00:00
// Create views::Widget and assign window_ with it.
// TODO(zcbenz): Get rid of the window_ in future.
views::Widget::InitParams params;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.bounds = bounds;
params.delegate = this;
params.type = views::Widget::InitParams::TYPE_WINDOW;
params.native_widget = new ElectronNativeWidgetMac(this, styleMask, widget());
widget()->Init(std::move(params));
chore: bump chromium to 93.0.4530.0 (master) (#29256) * chore: bump chromium in DEPS to 92.0.4512.6 * 2887336: [CaptureHandle][#2] Propagate CaptureHandleConfig in browser process https://chromium-review.googlesource.com/c/chromium/src/+/2887336 * refactor: base::Optional -> absl::optional * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4514.0 * 2899417: Make build work when enable_pdf is set to false. https://chromium-review.googlesource.com/c/chromium/src/+/2899417 * 2904731: use BrowserContext instead of Profile in PreconnectManager https://chromium-review.googlesource.com/c/chromium/src/+/2904731 * 2295749: fix: check IsSecureEventInputEnabled in constructor before setting SetPasswordInputEnabled to true https://chromium-review.googlesource.com/c/chromium/src/+/2295749 * 2893803: Add a GetWebView to RenderFrame. https://chromium-review.googlesource.com/c/chromium/src/+/2893803 * 2892345: Implement WebContents::ForEachRenderFrameHost https://chromium-review.googlesource.com/c/chromium/src/+/2892345 * chore: fixup patch indices * 2892048: Real instance methods for BrowserContext: remaining 5 methods. https://chromium-review.googlesource.com/c/chromium/src/+/2892048 * 2902821: [mojo] Don't require full header includes for referenced interfaces https://chromium-review.googlesource.com/c/chromium/src/+/2902821 * 2496500: Remove last deprecated extension Event ctor. https://chromium-review.googlesource.com/c/chromium/src/+/2496500 * chore: fixup malformed pepper support patch * chore: bump chromium in DEPS to 92.0.4515.0 * 2908461: Add CreateEmptyPrintPagesParamsPtr() inside print_view_manager_base.cc. https://chromium-review.googlesource.com/c/chromium/src/+/2908461 * 2880838: viz: add optional HDRMetadata to TransferableResource https://chromium-review.googlesource.com/c/chromium/src/+/2880838 * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4515.5 * chore: update patches * chore: bump chromium in DEPS to 92.0.4515.7 * chore: bump chromium in DEPS to 92.0.4515.9 * chore: bump chromium in DEPS to 93.0.4522.0 * chore: bump chromium in DEPS to 93.0.4523.0 * chore: bump chromium in DEPS to 93.0.4524.0 * chore: update patches * chore: enable_pak_file_integrity_checks was reverted * chore: update patches * refactor: base/optional was replaced with absl::optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::nullopt with absl::nullopt Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::make_optional with absl::make_optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace WorldScriptContext() with GetScriptContextFromWorldId Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893213 * chore: clean up left over opening namespace Refs: https://github.com/electron/electron/commit/95bfe6d08f65471394fb3005dbfa177cdf71210a * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace GetCurrentDisplayIterator with the hard checker GetCurrentDisplay This code looks suspicious but if the iterator was invalid before it will also be invalid now. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893191 * refactor: headers are now passed directly in extensions client Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2918906 * refactor: base::DictionaryValue::empty() has been removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2912424 * chore: add missing includes for network URLLoaderFactory Refs: unknown, probably a side effect of header changes * refactor: make convenience wrapper around AppendArg There is no converter FromV8 for base::StringPiece (apparently its not possible). So we now take in an std::string and use the construct for StringPiece to do implicit conversion. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2905544 * chore: add patch * chore: bump chromium in DEPS to 93.0.4525.0 * chore: update patches * refactor: CanResize has been de-virtualized Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2485774 * chore: update resource integrity patch * chore: add character encoding idl patch * chore: bump chromium in DEPS to 93.0.4526.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4527.0 * chore: bump chromium in DEPS to 93.0.4528.0 * chore: update patches * chore: update idl encoding patch * chore: bump chromium in DEPS to 93.0.4529.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4530.0 * chore: update patches * fix: only SetCanResize after the widget has been initialized * chore: add patch for vr on windows gn gen * spec: fix focus related tests on linux due to delay in focus swap * chore: remove new usages of base::Optional from main Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-03 08:05:04 +00:00
SetCanResize(resizable);
window_ = static_cast<ElectronNSWindow*>(
widget()->GetNativeWindow().GetNativeNSWindow());
2018-04-24 08:23:08 +00:00
RegisterDeleteDelegateCallback(base::BindOnce(
[](NativeWindowMac* window) {
if (window->window_)
window->window_ = nil;
if (window->buttons_proxy_)
window->buttons_proxy_.reset();
},
this));
[window_ setEnableLargerThanScreen:enable_larger_than_screen()];
window_delegate_.reset([[ElectronNSWindowDelegate alloc] initWithShell:this]);
[window_ setDelegate:window_delegate_];
// Only use native parent window for non-modal windows.
if (parent && !is_modal()) {
SetParentWindow(parent);
2016-06-19 03:06:08 +00:00
}
if (transparent()) {
// Setting the background color to clear will also hide the shadow.
2014-12-23 19:17:56 +00:00
[window_ setBackgroundColor:[NSColor clearColor]];
}
2015-04-25 02:35:28 +00:00
if (windowType == "desktop") {
[window_ setLevel:kCGDesktopWindowLevel - 1];
2015-11-20 05:06:42 +00:00
[window_ setDisableKeyOrMainWindow:YES];
2018-04-20 18:47:04 +00:00
[window_ setCollectionBehavior:(NSWindowCollectionBehaviorCanJoinAllSpaces |
NSWindowCollectionBehaviorStationary |
NSWindowCollectionBehaviorIgnoresCycle)];
}
2016-06-13 08:10:28 +00:00
bool focusable;
if (options.Get(options::kFocusable, &focusable) && !focusable)
[window_ setDisableKeyOrMainWindow:YES];
if (transparent() || !has_frame()) {
// Don't show title bar.
[window_ setTitlebarAppearsTransparent:YES];
[window_ setTitleVisibility:NSWindowTitleHidden];
// Remove non-transparent corners, see
// https://github.com/electron/electron/issues/517.
[window_ setOpaque:NO];
// Show window buttons if titleBarStyle is not "normal".
if (title_bar_style_ == TitleBarStyle::kNormal) {
InternalSetWindowButtonVisibility(false);
} else {
buttons_proxy_.reset([[WindowButtonsProxy alloc] initWithWindow:window_]);
[buttons_proxy_ setHeight:titlebar_overlay_height()];
if (traffic_light_position_) {
[buttons_proxy_ setMargin:*traffic_light_position_];
} else if (title_bar_style_ == TitleBarStyle::kHiddenInset) {
2022-02-21 09:27:45 +00:00
// For macOS >= 11, while this value does not match official macOS apps
// like Safari or Notes, it matches titleBarStyle's old implementation
// before Electron <= 12.
[buttons_proxy_ setMargin:gfx::Point(12, 11)];
}
if (title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover) {
[buttons_proxy_ setShowOnHover:YES];
} else {
2022-02-21 09:27:45 +00:00
// customButtonsOnHover does not show buttons initially.
InternalSetWindowButtonVisibility(true);
}
}
}
2014-12-23 19:17:56 +00:00
// Create a tab only if tabbing identifier is specified and window has
// a native title bar.
2017-03-30 20:47:11 +00:00
if (tabbingIdentifier.empty() || transparent() || !has_frame()) {
[window_ setTabbingMode:NSWindowTabbingModeDisallowed];
} else {
[window_ setTabbingIdentifier:base::SysUTF8ToNSString(tabbingIdentifier)];
2017-03-27 14:15:17 +00:00
}
2018-04-24 10:00:44 +00:00
// Resize to content bounds.
bool use_content_size = false;
options.Get(options::kUseContentSize, &use_content_size);
2018-04-24 10:00:44 +00:00
if (!has_frame() || use_content_size)
SetContentSize(gfx::Size(width, height));
// Enable the NSView to accept first mouse event.
bool acceptsFirstMouse = false;
options.Get(options::kAcceptFirstMouse, &acceptsFirstMouse);
[window_ setAcceptsFirstMouse:acceptsFirstMouse];
2013-04-12 07:04:46 +00:00
2015-04-27 04:08:22 +00:00
// Disable auto-hiding cursor.
bool disableAutoHideCursor = false;
options.Get(options::kDisableAutoHideCursor, &disableAutoHideCursor);
2015-04-27 04:08:22 +00:00
[window_ setDisableAutoHideCursor:disableAutoHideCursor];
2016-01-25 07:02:43 +00:00
// Use an NSEvent monitor to listen for the wheel event.
BOOL __block began = NO;
wheel_event_monitor_ = [NSEvent
addLocalMonitorForEventsMatchingMask:NSEventMaskScrollWheel
2018-04-20 18:47:04 +00:00
handler:^(NSEvent* event) {
if ([[event window] windowNumber] !=
[window_ windowNumber])
return event;
if (!began && (([event phase] ==
NSEventPhaseMayBegin) ||
([event phase] ==
NSEventPhaseBegan))) {
this->NotifyWindowScrollTouchBegin();
began = YES;
} else if (began &&
(([event phase] ==
NSEventPhaseEnded) ||
([event phase] ==
NSEventPhaseCancelled))) {
this->NotifyWindowScrollTouchEnd();
began = NO;
}
return event;
}];
// Set maximizable state last to ensure zoom button does not get reset
// by calls to other APIs.
2016-08-04 23:47:03 +00:00
SetMaximizable(maximizable);
2018-04-10 08:30:46 +00:00
// Default content view.
SetContentView(new views::View());
AddContentViewLayers();
original_frame_ = [window_ frame];
original_level_ = [window_ level];
2018-04-08 11:20:43 +00:00
}
NativeWindowMac::~NativeWindowMac() = default;
void NativeWindowMac::SetContentView(views::View* view) {
views::View* root_view = GetContentsView();
if (content_view())
root_view->RemoveChildView(content_view());
set_content_view(view);
root_view->AddChildView(content_view());
root_view->Layout();
}
2013-04-12 07:04:46 +00:00
void NativeWindowMac::Close() {
if (!IsClosable()) {
WindowList::WindowCloseCancelled(this);
return;
}
if (fullscreen_transition_state() != FullScreenTransitionState::NONE) {
SetHasDeferredWindowClose(true);
return;
}
// If a sheet is attached to the window when we call
// [window_ performClose:nil], the window won't close properly
// even after the user has ended the sheet.
// Ensure it's closed before calling [window_ performClose:nil].
SetEnabled(true);
2014-04-11 04:45:48 +00:00
[window_ performClose:nil];
// Closing a sheet doesn't trigger windowShouldClose,
// so we need to manually call it ourselves here.
if (is_modal() && parent() && IsVisible()) {
NotifyWindowCloseButtonClicked();
}
2013-04-12 07:04:46 +00:00
}
2013-05-01 08:12:00 +00:00
void NativeWindowMac::CloseImmediately() {
// Retain the child window before closing it. If the last reference to the
// NSWindow goes away inside -[NSWindow close], then bad stuff can happen.
// See e.g. http://crbug.com/616701.
base::scoped_nsobject<NSWindow> child_window(window_,
base::scoped_policy::RETAIN);
2014-04-11 04:45:48 +00:00
[window_ close];
2013-05-01 08:12:00 +00:00
}
2013-04-12 07:04:46 +00:00
void NativeWindowMac::Focus(bool focus) {
if (!IsVisible())
return;
if (focus) {
[[NSApplication sharedApplication] activateIgnoringOtherApps:NO];
2014-04-11 04:45:48 +00:00
[window_ makeKeyAndOrderFront:nil];
} else {
[window_ orderOut:nil];
2014-04-11 04:45:48 +00:00
[window_ orderBack:nil];
}
2013-04-12 07:04:46 +00:00
}
2013-05-16 14:56:52 +00:00
bool NativeWindowMac::IsFocused() {
2014-04-11 04:45:48 +00:00
return [window_ isKeyWindow];
2013-05-16 14:56:52 +00:00
}
2013-04-12 07:04:46 +00:00
void NativeWindowMac::Show() {
if (is_modal() && parent()) {
NSWindow* window = parent()->GetNativeWindow().GetNativeNSWindow();
2016-09-29 18:49:24 +00:00
if ([window_ sheetParent] == nil)
[window beginSheet:window_
completionHandler:^(NSModalResponse){
}];
return;
}
2017-09-14 05:43:22 +00:00
// Reattach the window to the parent to actually show it.
if (parent())
InternalSetParentWindow(parent(), true);
// This method is supposed to put focus on window, however if the app does not
// have focus then "makeKeyAndOrderFront" will only show the window.
[NSApp activateIgnoringOtherApps:YES];
2014-10-17 14:51:20 +00:00
[window_ makeKeyAndOrderFront:nil];
}
void NativeWindowMac::ShowInactive() {
2017-05-01 21:01:48 +00:00
// Reattach the window to the parent to actually show it.
if (parent())
InternalSetParentWindow(parent(), true);
2017-09-14 05:43:22 +00:00
[window_ orderFrontRegardless];
2013-04-12 07:04:46 +00:00
}
void NativeWindowMac::Hide() {
// If a sheet is attached to the window when we call [window_ orderOut:nil],
// the sheet won't be able to show again on the same window.
// Ensure it's closed before calling [window_ orderOut:nil].
SetEnabled(true);
if (is_modal() && parent()) {
[window_ orderOut:nil];
[parent()->GetNativeWindow().GetNativeNSWindow() endSheet:window_];
return;
}
2017-09-14 05:43:22 +00:00
// Hide all children of the current window before hiding the window.
// components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
// expects this when window visibility changes.
if ([window_ childWindows]) {
for (NSWindow* child in [window_ childWindows]) {
[child orderOut:nil];
}
}
2022-02-21 09:27:45 +00:00
// Detach the window from the parent before.
if (parent())
InternalSetParentWindow(parent(), false);
2014-04-11 04:45:48 +00:00
[window_ orderOut:nil];
2013-04-12 07:04:46 +00:00
}
2013-10-03 00:27:59 +00:00
bool NativeWindowMac::IsVisible() {
bool occluded = [window_ occlusionState] == NSWindowOcclusionStateVisible;
// For a window to be visible, it must be visible to the user in the
// foreground of the app, which means that it should not be minimized or
// occluded
return [window_ isVisible] && !occluded && !IsMinimized();
2013-10-03 00:27:59 +00:00
}
void NativeWindowMac::SetFullScreenTransitionState(
FullScreenTransitionState state) {
fullscreen_transition_state_ = state;
}
bool NativeWindowMac::IsEnabled() {
return [window_ attachedSheet] == nil;
}
void NativeWindowMac::SetEnabled(bool enable) {
if (!enable) {
2018-04-20 18:47:04 +00:00
[window_ beginSheet:window_
completionHandler:^(NSModalResponse returnCode) {
NSLog(@"modal enabled");
return;
}];
} else if ([window_ attachedSheet]) {
[window_ endSheet:[window_ attachedSheet]];
}
}
2013-04-12 07:04:46 +00:00
void NativeWindowMac::Maximize() {
const bool is_visible = [window_ isVisible];
if (IsMaximized()) {
if (!is_visible)
ShowInactive();
return;
}
// Take note of the current window size
if (IsNormal())
original_frame_ = [window_ frame];
2014-04-11 04:45:48 +00:00
[window_ zoom:nil];
if (!is_visible) {
ShowInactive();
NotifyWindowMaximize();
}
2013-04-12 07:04:46 +00:00
}
void NativeWindowMac::Unmaximize() {
// Bail if the last user set bounds were the same size as the window
// screen (e.g. the user set the window to maximized via setBounds)
//
// Per docs during zoom:
// > If theres no saved user state because there has been no previous
// > zoom,the size and location of the window dont change.
//
// However, in classic Apple fashion, this is not the case in practice,
// and the frame inexplicably becomes very tiny. We should prevent
// zoom from being called if the window is being unmaximized and its
// unmaximized window bounds are themselves functionally maximized.
if (!IsMaximized() || user_set_bounds_maximized_)
return;
2014-04-11 04:45:48 +00:00
[window_ zoom:nil];
2013-04-12 07:04:46 +00:00
}
2014-06-28 01:17:37 +00:00
bool NativeWindowMac::IsMaximized() {
if (([window_ styleMask] & NSWindowStyleMaskResizable) != 0)
return [window_ isZoomed];
NSRect rectScreen = GetAspectRatio() > 0.0
? default_frame_for_zoom()
: [[NSScreen mainScreen] visibleFrame];
return NSEqualRects([window_ frame], rectScreen);
2014-05-14 21:58:49 +00:00
}
2013-04-12 07:04:46 +00:00
void NativeWindowMac::Minimize() {
if (IsMinimized())
return;
// Take note of the current window size
if (IsNormal())
original_frame_ = [window_ frame];
2014-04-11 04:45:48 +00:00
[window_ miniaturize:nil];
2013-04-12 07:04:46 +00:00
}
void NativeWindowMac::Restore() {
2014-04-11 04:45:48 +00:00
[window_ deminiaturize:nil];
2013-04-12 07:04:46 +00:00
}
2014-07-26 05:58:26 +00:00
bool NativeWindowMac::IsMinimized() {
return [window_ isMiniaturized];
}
void NativeWindowMac::HandlePendingFullscreenTransitions() {
if (pending_transitions_.empty())
return;
bool next_transition = pending_transitions_.front();
pending_transitions_.pop();
SetFullScreen(next_transition);
}
bool NativeWindowMac::HandleDeferredClose() {
if (has_deferred_window_close_) {
SetHasDeferredWindowClose(false);
Close();
return true;
}
return false;
}
2014-11-25 06:34:14 +00:00
void NativeWindowMac::SetFullScreen(bool fullscreen) {
// [NSWindow -toggleFullScreen] is an asynchronous operation, which means
// that it's possible to call it while a fullscreen transition is currently
// in process. This can create weird behavior (incl. phantom windows),
// so we want to schedule a transition for when the current one has completed.
if (fullscreen_transition_state() != FullScreenTransitionState::NONE) {
if (!pending_transitions_.empty()) {
bool last_pending = pending_transitions_.back();
// Only push new transitions if they're different than the last transition
// in the queue.
if (last_pending != fullscreen)
pending_transitions_.push(fullscreen);
} else {
pending_transitions_.push(fullscreen);
}
return;
}
if (fullscreen == IsFullscreen())
2013-04-12 07:04:46 +00:00
return;
// Take note of the current window size
if (IsNormal())
original_frame_ = [window_ frame];
// This needs to be set here because it can be the case that
// SetFullScreen is called by a user before windowWillEnterFullScreen
// or windowWillExitFullScreen are invoked, and so a potential transition
// could be dropped.
fullscreen_transition_state_ = fullscreen
? FullScreenTransitionState::ENTERING
: FullScreenTransitionState::EXITING;
[window_ toggleFullScreenMode:nil];
2013-04-12 07:04:46 +00:00
}
2015-04-21 13:35:36 +00:00
bool NativeWindowMac::IsFullscreen() const {
return [window_ styleMask] & NSWindowStyleMaskFullScreen;
2013-04-12 07:04:46 +00:00
}
2016-01-15 04:54:12 +00:00
void NativeWindowMac::SetBounds(const gfx::Rect& bounds, bool animate) {
// Do nothing if in fullscreen mode.
if (IsFullscreen())
return;
2016-07-07 11:02:18 +00:00
// Check size constraints since setFrame does not check it.
gfx::Size size = bounds.size();
size.SetToMax(GetMinimumSize());
gfx::Size max_size = GetMaximumSize();
if (!max_size.IsEmpty())
size.SetToMin(max_size);
NSRect cocoa_bounds = NSMakeRect(bounds.x(), 0, size.width(), size.height());
// Flip coordinates based on the primary screen.
NSScreen* screen = [[NSScreen screens] firstObject];
2018-04-20 18:47:04 +00:00
cocoa_bounds.origin.y = NSHeight([screen frame]) - size.height() - bounds.y();
2016-01-15 04:54:12 +00:00
[window_ setFrame:cocoa_bounds display:YES animate:animate];
user_set_bounds_maximized_ = IsMaximized() ? true : false;
}
gfx::Rect NativeWindowMac::GetBounds() {
NSRect frame = [window_ frame];
gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame));
NSScreen* screen = [[NSScreen screens] firstObject];
bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame));
return bounds;
}
bool NativeWindowMac::IsNormal() {
return NativeWindow::IsNormal() && !IsSimpleFullScreen();
}
gfx::Rect NativeWindowMac::GetNormalBounds() {
if (IsNormal()) {
return GetBounds();
}
NSRect frame = original_frame_;
gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame));
NSScreen* screen = [[NSScreen screens] firstObject];
bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame));
return bounds;
// Works on OS_WIN !
// return widget()->GetRestoredBounds();
}
void NativeWindowMac::SetContentSizeConstraints(
const extensions::SizeConstraints& size_constraints) {
auto convertSize = [this](const gfx::Size& size) {
// Our frameless window still has titlebar attached, so setting contentSize
// will result in actual content size being larger.
if (!has_frame()) {
NSRect frame = NSMakeRect(0, 0, size.width(), size.height());
NSRect content = [window_ originalContentRectForFrameRect:frame];
return content.size;
} else {
return NSMakeSize(size.width(), size.height());
}
};
2014-04-11 04:45:48 +00:00
NSView* content = [window_ contentView];
if (size_constraints.HasMinimumSize()) {
NSSize min_size = convertSize(size_constraints.GetMinimumSize());
[window_ setContentMinSize:[content convertSize:min_size toView:nil]];
}
if (size_constraints.HasMaximumSize()) {
NSSize max_size = convertSize(size_constraints.GetMaximumSize());
[window_ setContentMaxSize:[content convertSize:max_size toView:nil]];
}
NativeWindow::SetContentSizeConstraints(size_constraints);
2013-04-18 07:38:04 +00:00
}
bool NativeWindowMac::MoveAbove(const std::string& sourceId) {
const content::DesktopMediaID id = content::DesktopMediaID::Parse(sourceId);
if (id.type != content::DesktopMediaID::TYPE_WINDOW)
return false;
// Check if the window source is valid.
const CGWindowID window_id = id.id;
if (!webrtc::GetWindowOwnerPid(window_id))
return false;
[window_ orderWindow:NSWindowAbove relativeTo:id.id];
return true;
}
2018-04-20 18:47:04 +00:00
void NativeWindowMac::MoveTop() {
[window_ orderWindow:NSWindowAbove relativeTo:0];
}
2018-04-24 10:00:44 +00:00
2013-04-12 07:04:46 +00:00
void NativeWindowMac::SetResizable(bool resizable) {
SetStyleMask(resizable, NSWindowStyleMaskResizable);
chore: bump chromium to 93.0.4530.0 (master) (#29256) * chore: bump chromium in DEPS to 92.0.4512.6 * 2887336: [CaptureHandle][#2] Propagate CaptureHandleConfig in browser process https://chromium-review.googlesource.com/c/chromium/src/+/2887336 * refactor: base::Optional -> absl::optional * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4514.0 * 2899417: Make build work when enable_pdf is set to false. https://chromium-review.googlesource.com/c/chromium/src/+/2899417 * 2904731: use BrowserContext instead of Profile in PreconnectManager https://chromium-review.googlesource.com/c/chromium/src/+/2904731 * 2295749: fix: check IsSecureEventInputEnabled in constructor before setting SetPasswordInputEnabled to true https://chromium-review.googlesource.com/c/chromium/src/+/2295749 * 2893803: Add a GetWebView to RenderFrame. https://chromium-review.googlesource.com/c/chromium/src/+/2893803 * 2892345: Implement WebContents::ForEachRenderFrameHost https://chromium-review.googlesource.com/c/chromium/src/+/2892345 * chore: fixup patch indices * 2892048: Real instance methods for BrowserContext: remaining 5 methods. https://chromium-review.googlesource.com/c/chromium/src/+/2892048 * 2902821: [mojo] Don't require full header includes for referenced interfaces https://chromium-review.googlesource.com/c/chromium/src/+/2902821 * 2496500: Remove last deprecated extension Event ctor. https://chromium-review.googlesource.com/c/chromium/src/+/2496500 * chore: fixup malformed pepper support patch * chore: bump chromium in DEPS to 92.0.4515.0 * 2908461: Add CreateEmptyPrintPagesParamsPtr() inside print_view_manager_base.cc. https://chromium-review.googlesource.com/c/chromium/src/+/2908461 * 2880838: viz: add optional HDRMetadata to TransferableResource https://chromium-review.googlesource.com/c/chromium/src/+/2880838 * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4515.5 * chore: update patches * chore: bump chromium in DEPS to 92.0.4515.7 * chore: bump chromium in DEPS to 92.0.4515.9 * chore: bump chromium in DEPS to 93.0.4522.0 * chore: bump chromium in DEPS to 93.0.4523.0 * chore: bump chromium in DEPS to 93.0.4524.0 * chore: update patches * chore: enable_pak_file_integrity_checks was reverted * chore: update patches * refactor: base/optional was replaced with absl::optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::nullopt with absl::nullopt Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::make_optional with absl::make_optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace WorldScriptContext() with GetScriptContextFromWorldId Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893213 * chore: clean up left over opening namespace Refs: https://github.com/electron/electron/commit/95bfe6d08f65471394fb3005dbfa177cdf71210a * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace GetCurrentDisplayIterator with the hard checker GetCurrentDisplay This code looks suspicious but if the iterator was invalid before it will also be invalid now. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893191 * refactor: headers are now passed directly in extensions client Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2918906 * refactor: base::DictionaryValue::empty() has been removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2912424 * chore: add missing includes for network URLLoaderFactory Refs: unknown, probably a side effect of header changes * refactor: make convenience wrapper around AppendArg There is no converter FromV8 for base::StringPiece (apparently its not possible). So we now take in an std::string and use the construct for StringPiece to do implicit conversion. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2905544 * chore: add patch * chore: bump chromium in DEPS to 93.0.4525.0 * chore: update patches * refactor: CanResize has been de-virtualized Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2485774 * chore: update resource integrity patch * chore: add character encoding idl patch * chore: bump chromium in DEPS to 93.0.4526.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4527.0 * chore: bump chromium in DEPS to 93.0.4528.0 * chore: update patches * chore: update idl encoding patch * chore: bump chromium in DEPS to 93.0.4529.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4530.0 * chore: update patches * fix: only SetCanResize after the widget has been initialized * chore: add patch for vr on windows gn gen * spec: fix focus related tests on linux due to delay in focus swap * chore: remove new usages of base::Optional from main Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-03 08:05:04 +00:00
SetCanResize(resizable);
2013-04-12 07:04:46 +00:00
}
2013-04-18 07:38:04 +00:00
bool NativeWindowMac::IsResizable() {
return [window_ styleMask] & NSWindowStyleMaskResizable;
2013-04-18 07:38:04 +00:00
}
void NativeWindowMac::SetMovable(bool movable) {
[window_ setMovable:movable];
}
bool NativeWindowMac::IsMovable() {
return [window_ isMovable];
}
void NativeWindowMac::SetMinimizable(bool minimizable) {
SetStyleMask(minimizable, NSWindowStyleMaskMiniaturizable);
}
bool NativeWindowMac::IsMinimizable() {
return [window_ styleMask] & NSWindowStyleMaskMiniaturizable;
}
2016-01-22 21:24:33 +00:00
void NativeWindowMac::SetMaximizable(bool maximizable) {
maximizable_ = maximizable;
2016-01-22 21:24:33 +00:00
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:maximizable];
}
bool NativeWindowMac::IsMaximizable() {
return [[window_ standardWindowButton:NSWindowZoomButton] isEnabled];
}
2016-01-23 07:47:37 +00:00
void NativeWindowMac::SetFullScreenable(bool fullscreenable) {
2018-04-20 18:47:04 +00:00
SetCollectionBehavior(fullscreenable,
NSWindowCollectionBehaviorFullScreenPrimary);
2016-01-23 11:12:19 +00:00
// On EL Capitan this flag is required to hide fullscreen button.
2018-04-20 18:47:04 +00:00
SetCollectionBehavior(!fullscreenable,
NSWindowCollectionBehaviorFullScreenAuxiliary);
2016-01-22 21:24:33 +00:00
}
2016-01-23 07:47:37 +00:00
bool NativeWindowMac::IsFullScreenable() {
2016-01-23 11:12:19 +00:00
NSUInteger collectionBehavior = [window_ collectionBehavior];
return collectionBehavior & NSWindowCollectionBehaviorFullScreenPrimary;
2016-01-22 21:24:33 +00:00
}
void NativeWindowMac::SetClosable(bool closable) {
SetStyleMask(closable, NSWindowStyleMaskClosable);
}
bool NativeWindowMac::IsClosable() {
return [window_ styleMask] & NSWindowStyleMaskClosable;
}
void NativeWindowMac::SetAlwaysOnTop(ui::ZOrderLevel z_order,
const std::string& level_name,
int relative_level) {
if (z_order == ui::ZOrderLevel::kNormal) {
SetWindowLevel(NSNormalWindowLevel);
return;
2016-09-22 16:22:28 +00:00
}
int level = NSNormalWindowLevel;
if (level_name == "floating") {
level = NSFloatingWindowLevel;
} else if (level_name == "torn-off-menu") {
level = NSTornOffMenuWindowLevel;
} else if (level_name == "modal-panel") {
level = NSModalPanelWindowLevel;
} else if (level_name == "main-menu") {
level = NSMainMenuWindowLevel;
} else if (level_name == "status") {
level = NSStatusWindowLevel;
} else if (level_name == "pop-up-menu") {
level = NSPopUpMenuWindowLevel;
} else if (level_name == "screen-saver") {
level = NSScreenSaverWindowLevel;
}
SetWindowLevel(level + relative_level);
}
std::string NativeWindowMac::GetAlwaysOnTopLevel() {
std::string level_name = "normal";
int level = [window_ level];
if (level == NSFloatingWindowLevel) {
level_name = "floating";
} else if (level == NSTornOffMenuWindowLevel) {
level_name = "torn-off-menu";
} else if (level == NSModalPanelWindowLevel) {
level_name = "modal-panel";
} else if (level == NSMainMenuWindowLevel) {
level_name = "main-menu";
} else if (level == NSStatusWindowLevel) {
level_name = "status";
} else if (level == NSPopUpMenuWindowLevel) {
level_name = "pop-up-menu";
} else if (level == NSScreenSaverWindowLevel) {
level_name = "screen-saver";
}
return level_name;
}
void NativeWindowMac::SetWindowLevel(int unbounded_level) {
int level = std::min(
std::max(unbounded_level, CGWindowLevelForKey(kCGMinimumWindowLevelKey)),
CGWindowLevelForKey(kCGMaximumWindowLevelKey));
ui::ZOrderLevel z_order_level = level == NSNormalWindowLevel
? ui::ZOrderLevel::kNormal
: ui::ZOrderLevel::kFloatingWindow;
bool did_z_order_level_change = z_order_level != GetZOrderLevel();
was_maximizable_ = IsMaximizable();
// We need to explicitly keep the NativeWidget up to date, since it stores the
// window level in a local variable, rather than reading it from the NSWindow.
// Unfortunately, it results in a second setLevel call. It's not ideal, but we
// don't expect this to cause any user-visible jank.
widget()->SetZOrderLevel(z_order_level);
[window_ setLevel:level];
// Set level will make the zoom button revert to default, probably
// a bug of Cocoa or macOS.
SetMaximizable(was_maximizable_);
// This must be notified at the very end or IsAlwaysOnTop
// will not yet have been updated to reflect the new status
if (did_z_order_level_change)
NativeWindow::NotifyWindowAlwaysOnTopChanged();
2013-04-12 07:04:46 +00:00
}
ui::ZOrderLevel NativeWindowMac::GetZOrderLevel() {
return widget()->GetZOrderLevel();
2013-04-18 07:38:04 +00:00
}
void NativeWindowMac::Center() {
2014-04-11 04:45:48 +00:00
[window_ center];
2013-04-12 07:04:46 +00:00
}
void NativeWindowMac::Invalidate() {
[window_ flushWindow];
2017-02-14 19:09:15 +00:00
[[window_ contentView] setNeedsDisplay:YES];
}
2013-04-12 07:04:46 +00:00
void NativeWindowMac::SetTitle(const std::string& title) {
[window_ setTitle:base::SysUTF8ToNSString(title)];
if (buttons_proxy_)
[buttons_proxy_ redraw];
2013-04-12 07:04:46 +00:00
}
2013-04-18 06:30:05 +00:00
std::string NativeWindowMac::GetTitle() {
2018-04-20 18:47:04 +00:00
return base::SysNSStringToUTF8([window_ title]);
2013-04-18 06:30:05 +00:00
}
2013-04-12 07:04:46 +00:00
void NativeWindowMac::FlashFrame(bool flash) {
if (flash) {
attention_request_id_ = [NSApp requestUserAttention:NSInformationalRequest];
} else {
[NSApp cancelUserAttentionRequest:attention_request_id_];
attention_request_id_ = 0;
}
}
2018-04-20 18:47:04 +00:00
void NativeWindowMac::SetSkipTaskbar(bool skip) {}
bool NativeWindowMac::IsExcludedFromShownWindowsMenu() {
NSWindow* window = GetNativeWindow().GetNativeNSWindow();
return [window isExcludedFromWindowsMenu];
}
void NativeWindowMac::SetExcludedFromShownWindowsMenu(bool excluded) {
NSWindow* window = GetNativeWindow().GetNativeNSWindow();
[window setExcludedFromWindowsMenu:excluded];
}
void NativeWindowMac::OnDisplayMetricsChanged(const display::Display& display,
uint32_t changed_metrics) {
// We only want to force screen recalibration if we're in simpleFullscreen
// mode.
if (!is_simple_fullscreen_)
return;
chore: bump chromium to 103.0.5046.0 (main) (#33906) * chore: bump chromium in DEPS to 103.0.5020.0 * chore: bump chromium in DEPS to 103.0.5022.0 * chore: bump chromium in DEPS to 103.0.5024.0 * chore: update patches * 3587410: [Printing] Remove JobEventDetails Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587410 * chore: bump chromium in DEPS to 103.0.5026.0 * chore: update patches * 3577218: WebUI: Delete webui_resources.grd and related GN targets. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3577218 * chore: bump chromium in DEPS to 103.0.5028.0 * chore: update patches * 3579297: Convert UpdatePrintSettings() to use non-deprecated base::Value APIs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3579297 * 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3581708: Restore original display when moving from tab-fullscreen to browser-fullscreen. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3581708 * chore: fix authorization flags lint error * 3583363: Remove net wrappers around base/strings/escape.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * fixup! 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3587589: Reland "Propagate the MIME type from DownloadTargetDeterminer to DownloadItem" Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587589 * 3584006: Remove IsRenderViewLive from content public Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3584006 * 3596174: [api] Remove APIs for resurrecting finalizers Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3596174 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: bump chromium in DEPS to 103.0.5030.0 * chore: update patches * chore: bump chromium in DEPS to 103.0.5032.0 * chore: bump chromium in DEPS to 103.0.5034.0 * chore: bump chromium in DEPS to 103.0.5036.0 * chore: update patches * 3586363: Introduce PrintRenderFrame.PrintWithParams() for batch printing to PDF Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3586363 * 3593199: Remove content::PermissionType references and replace them with blink::PermissionType Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3593199 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: lint * chore: bump chromium in DEPS to 103.0.5038.0 * chore: update patches * fixup! 3560622: serial: Add SerialPort.forget() method * 3606495: mac screen capture: add metric Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3606495 * chore: bump chromium in DEPS to 103.0.5040.0 * chore: update patches * 3590840: Add IPs to DnsOverHttpsServerConfig https://chromium-review.googlesource.com/c/chromium/src/+/3590840 * stub functions for ElectronSerialDelegate and SerialChooserController to fix link * 3566412: [base] Remove base/android dependency on post_task.h and officially remove post_task.h! Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 3347944: [content] No longer hand-off whole MainFunctionParams to BrowserMainParts Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3347944 * fixup! 3566412: [base] Remove base/android dependency on post_task.h and off… e3ea3e1 …icially remove post_task.h! * chore: update process_singleton patches for content::GetIOThreadTaskRunner({}) Ref: 2015655: [BrowserThread] Migrate co/pub/br and co/br/scheduler to the new API | https://chromium-review.googlesource.com/c/chromium/src/+/2015655 * chore: migrate base::DeleteSoon to content::GetUIThreadTaskRunner({})->DeleteSoon Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * chore: remove duplicate functions for RevokePortPermissionWebInitiated & GetPortInfo * chore: migrate Linux/Windows methods off of post_task.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 64908: Stop building legacy SwiftShader GL in Chromium https://swiftshader-review.googlesource.com/c/SwiftShader/+/64908 * 3573245: Added Themed versions of RoundedRectBackground and RoundedRectBorder. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3573245 * chore: bump chromium in DEPS to 103.0.5042.0 * chore: update patches * 3571804: [api] Advance API deprecation for V8 version v10.2 https://chromium-review.googlesource.com/c/v8/v8/+/3571804 * fixup! 3571804: [api] Advance API deprecation for V8 version v10.2 * build: fix run-clang-format extension matching * lint * fix windows build * how is clang-format still not working for me * chore: update patches * 3623985: Replace ad-hoc SetPublicFirstPartySets calls with method in ContentBrowserClient. https://chromium-review.googlesource.com/c/chromium/src/+/3623985 * no need to implement WillProvidePublicFirstPartySets; the default is false * 3601036: [QT] Introduce ui/views/linux_ui/linux_ui_factory.* https://chromium-review.googlesource.com/c/chromium/src/+/3601036 * 3583363: Remove net wrappers around base/strings/escape.h https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * lint * chore: bump chromium in DEPS to 103.0.5044.0 * fix conflicts * chore: update patches * upgrade nan * pin version of nan in tests * replace my hacky deprecated override fix with the fix from upstream * revert runtime dcheck in v8 * pin nan version at root too * refactor: tell gyp to use c++17 when building with our node * Revert "refactor: tell gyp to use c++17 when building with our node" This reverts commit 41a03a5799a8f40f31555d73d20ea865acfcd192. * Undo the reversion of 41a03a5799a8f40f31555d73d20ea865acfcd192. This reverts commit 54440abc598153bd7e259be4a908f0ecc0b33348. * disable sequential/test-cpu-prof-kill for now * also sequential/test-diagnostic-dir-cpu-prof Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-05-17 16:48:40 +00:00
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(&NativeWindow::UpdateFrame, GetWeakPtr()));
}
void NativeWindowMac::SetSimpleFullScreen(bool simple_fullscreen) {
NSWindow* window = GetNativeWindow().GetNativeNSWindow();
if (simple_fullscreen && !is_simple_fullscreen_) {
is_simple_fullscreen_ = true;
// Take note of the current window size and level
if (IsNormal()) {
original_frame_ = [window_ frame];
original_level_ = [window_ level];
}
simple_fullscreen_options_ = [NSApp currentSystemPresentationOptions];
simple_fullscreen_mask_ = [window styleMask];
2018-04-20 18:47:04 +00:00
// We can simulate the pre-Lion fullscreen by auto-hiding the dock and menu
// bar
NSApplicationPresentationOptions options =
NSApplicationPresentationAutoHideDock |
NSApplicationPresentationAutoHideMenuBar;
[NSApp setPresentationOptions:options];
was_maximizable_ = IsMaximizable();
was_movable_ = IsMovable();
NSRect fullscreenFrame = [window.screen frame];
// If our app has dock hidden, set the window level higher so another app's
// menu bar doesn't appear on top of our fullscreen app.
if ([[NSRunningApplication currentApplication] activationPolicy] !=
NSApplicationActivationPolicyRegular) {
window.level = NSPopUpMenuWindowLevel;
}
// Always hide the titlebar in simple fullscreen mode.
//
// Note that we must remove the NSWindowStyleMaskTitled style instead of
// using the [window_ setTitleVisibility:], as the latter would leave the
// window with rounded corners.
SetStyleMask(false, NSWindowStyleMaskTitled);
if (!window_button_visibility_.has_value()) {
// Lets keep previous behaviour - hide window controls in titled
// fullscreen mode when not specified otherwise.
InternalSetWindowButtonVisibility(false);
}
2018-04-20 18:47:04 +00:00
[window setFrame:fullscreenFrame display:YES animate:YES];
// Fullscreen windows can't be resized, minimized, maximized, or moved
SetMinimizable(false);
SetResizable(false);
SetMaximizable(false);
SetMovable(false);
} else if (!simple_fullscreen && is_simple_fullscreen_) {
is_simple_fullscreen_ = false;
2018-04-20 18:47:04 +00:00
[window setFrame:original_frame_ display:YES animate:YES];
window.level = original_level_;
[NSApp setPresentationOptions:simple_fullscreen_options_];
// Restore original style mask
ScopedDisableResize disable_resize;
[window_ setStyleMask:simple_fullscreen_mask_];
// Restore window manipulation abilities
SetMaximizable(was_maximizable_);
SetMovable(was_movable_);
// Restore default window controls visibility state.
if (!window_button_visibility_.has_value()) {
bool visibility;
if (has_frame())
visibility = true;
else
visibility = title_bar_style_ != TitleBarStyle::kNormal;
InternalSetWindowButtonVisibility(visibility);
}
if (buttons_proxy_)
[buttons_proxy_ redraw];
}
}
bool NativeWindowMac::IsSimpleFullScreen() {
return is_simple_fullscreen_;
}
2013-04-12 07:04:46 +00:00
void NativeWindowMac::SetKiosk(bool kiosk) {
if (kiosk && !is_kiosk_) {
kiosk_options_ = [NSApp currentSystemPresentationOptions];
2013-04-12 07:04:46 +00:00
NSApplicationPresentationOptions options =
NSApplicationPresentationHideDock |
NSApplicationPresentationHideMenuBar |
NSApplicationPresentationDisableAppleMenu |
NSApplicationPresentationDisableProcessSwitching |
NSApplicationPresentationDisableForceQuit |
NSApplicationPresentationDisableSessionTermination |
2013-04-12 07:04:46 +00:00
NSApplicationPresentationDisableHideApplication;
[NSApp setPresentationOptions:options];
is_kiosk_ = true;
SetFullScreen(true);
} else if (!kiosk && is_kiosk_) {
[NSApp setPresentationOptions:kiosk_options_];
is_kiosk_ = false;
SetFullScreen(false);
2013-04-12 07:04:46 +00:00
}
}
bool NativeWindowMac::IsKiosk() {
return is_kiosk_;
}
void NativeWindowMac::SetBackgroundColor(SkColor color) {
2018-04-24 11:08:14 +00:00
base::ScopedCFTypeRef<CGColorRef> cgcolor(
skia::CGColorCreateFromSkColor(color));
[[[window_ contentView] layer] setBackgroundColor:cgcolor];
2015-10-23 03:35:33 +00:00
}
SkColor NativeWindowMac::GetBackgroundColor() {
CGColorRef color = [[[window_ contentView] layer] backgroundColor];
if (!color)
return SK_ColorTRANSPARENT;
return skia::CGColorRefToSkColor(color);
}
void NativeWindowMac::SetHasShadow(bool has_shadow) {
[window_ setHasShadow:has_shadow];
}
bool NativeWindowMac::HasShadow() {
return [window_ hasShadow];
}
2017-09-29 02:26:02 +00:00
void NativeWindowMac::SetOpacity(const double opacity) {
chore: bump chromium to 94.0.4590.2 (main) (#30274) * chore: bump chromium in DEPS to 94.0.4587.0 * chore: update patches * 2823155: fix GPU video decoding capabilities enumeration Ref: https://chromium-review.googlesource.com/c/chromium/src/+/2823155 * 3041383: Reduce includes in url_request_mojom_traits.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3041383 * chore: bump chromium in DEPS to 94.0.4588.0 * chore: update patches * chore: bump chromium in DEPS to 94.0.4589.0 * chore: update patches * 3050633: Rename ScaleFactor to ResourceScaleFactor Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3050633 * 3048296: Create new mojo target to prevent traits header spreading Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3048296 * 3046186: Rename base::ClampToRange Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3046186 * chore: update picture-in-picture patch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056037 * chore: bump chromium in DEPS to 94.0.4590.0 * chore: update patches * 3057495: Fix base::NoDestructor usage in Mac KeychainPassword Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3057495 * 3056134: Remove NetworkIsolationKey unused methods Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056134 * 3035091: [rab/gsab] Fix gsab maxByteLength after transferring to worker Adds a patch to v8 to disable a DCHECK that is also firing on node streams in child processes. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3035091 * chore: bump chromium in DEPS to 94.0.4590.2 * chore: fix mas_no_private_api.patch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049052 * 3049555: [views] Add CHECK to prevent fallthrough to global NativeTheme Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049555 * chore: empty commit * chore: fix whitespace for lint * chore: cherry-pick chromium woa fix * Revert "chore: cherry-pick chromium woa fix" This reverts commit 64f3082e2d5f93ef0e2ac5d98246532a105fd4a1. * chore: fix the build on Windows on ARM * chore: remove commented code in printing.patch * fixup! chore: remove commented code in printing.patch do not remove the new weak_ptr check * build: sync disable_use_lld_for_macos.patch Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <keeleymhammond@gmail.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-08-11 21:04:56 +00:00
const double boundedOpacity = base::clamp(opacity, 0.0, 1.0);
[window_ setAlphaValue:boundedOpacity];
2017-09-29 02:26:02 +00:00
}
double NativeWindowMac::GetOpacity() {
return [window_ alphaValue];
}
void NativeWindowMac::SetRepresentedFilename(const std::string& filename) {
[window_ setRepresentedFilename:base::SysUTF8ToNSString(filename)];
}
std::string NativeWindowMac::GetRepresentedFilename() {
return base::SysNSStringToUTF8([window_ representedFilename]);
}
void NativeWindowMac::SetDocumentEdited(bool edited) {
[window_ setDocumentEdited:edited];
if (buttons_proxy_)
[buttons_proxy_ redraw];
}
bool NativeWindowMac::IsDocumentEdited() {
return [window_ isDocumentEdited];
}
void NativeWindowMac::SetIgnoreMouseEvents(bool ignore, bool forward) {
[window_ setIgnoresMouseEvents:ignore];
if (!ignore) {
SetForwardMouseMessages(NO);
} else {
SetForwardMouseMessages(forward);
}
}
void NativeWindowMac::SetContentProtection(bool enable) {
2018-04-20 18:47:04 +00:00
[window_
setSharingType:enable ? NSWindowSharingNone : NSWindowSharingReadOnly];
}
void NativeWindowMac::SetFocusable(bool focusable) {
// No known way to unfocus the window if it had the focus. Here we do not
// want to call Focus(false) because it moves the window to the back, i.e.
// at the bottom in term of z-order.
[window_ setDisableKeyOrMainWindow:!focusable];
}
bool NativeWindowMac::IsFocusable() {
return ![window_ disableKeyOrMainWindow];
}
void NativeWindowMac::AddBrowserView(NativeBrowserView* view) {
[CATransaction begin];
[CATransaction setDisableActions:YES];
if (!view) {
[CATransaction commit];
Implement initial, experimental BrowserView API Right now, `<webview>` is the only way to embed additional content in a `BrowserWindow`. Unfortunately `<webview>` suffers from a [number of problems](https://github.com/electron/electron/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3Awebview%20). To make matters worse, many of these are upstream Chromium bugs instead of Electron-specific bugs. For us at [Figma](https://www.figma.com), the main issue is very slow performance. Despite the upstream improvements to `<webview>` through the OOPIF work, it is probable that there will continue to be `<webview>`-specific bugs in the future. Therefore, this introduces a `<webview>` alternative to called `BrowserView`, which... - is a thin wrapper around `api::WebContents` (so bugs in `BrowserView` will likely also be bugs in `BrowserWindow` web contents) - is instantiated in the main process like `BrowserWindow` (and unlike `<webview>`, which lives in the DOM of a `BrowserWindow` web contents) - needs to be added to a `BrowserWindow` to display something on the screen This implements the most basic API. The API is expected to evolve and change in the near future and has consequently been marked as experimental. Please do not use this API in production unless you are prepared to deal with breaking changes. In the future, we will want to change the API to support multiple `BrowserView`s per window. We will also want to consider z-ordering auto-resizing, and possibly even nested views.
2017-04-11 17:47:30 +00:00
return;
}
add_browser_view(view);
if (view->GetInspectableWebContentsView()) {
auto* native_view = view->GetInspectableWebContentsView()
->GetNativeView()
.GetNativeNSView();
[[window_ contentView] addSubview:native_view
positioned:NSWindowAbove
relativeTo:nil];
native_view.hidden = NO;
}
[CATransaction commit];
Implement initial, experimental BrowserView API Right now, `<webview>` is the only way to embed additional content in a `BrowserWindow`. Unfortunately `<webview>` suffers from a [number of problems](https://github.com/electron/electron/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3Awebview%20). To make matters worse, many of these are upstream Chromium bugs instead of Electron-specific bugs. For us at [Figma](https://www.figma.com), the main issue is very slow performance. Despite the upstream improvements to `<webview>` through the OOPIF work, it is probable that there will continue to be `<webview>`-specific bugs in the future. Therefore, this introduces a `<webview>` alternative to called `BrowserView`, which... - is a thin wrapper around `api::WebContents` (so bugs in `BrowserView` will likely also be bugs in `BrowserWindow` web contents) - is instantiated in the main process like `BrowserWindow` (and unlike `<webview>`, which lives in the DOM of a `BrowserWindow` web contents) - needs to be added to a `BrowserWindow` to display something on the screen This implements the most basic API. The API is expected to evolve and change in the near future and has consequently been marked as experimental. Please do not use this API in production unless you are prepared to deal with breaking changes. In the future, we will want to change the API to support multiple `BrowserView`s per window. We will also want to consider z-ordering auto-resizing, and possibly even nested views.
2017-04-11 17:47:30 +00:00
}
void NativeWindowMac::RemoveBrowserView(NativeBrowserView* view) {
[CATransaction begin];
[CATransaction setDisableActions:YES];
if (!view) {
[CATransaction commit];
return;
}
if (view->GetInspectableWebContentsView())
[view->GetInspectableWebContentsView()->GetNativeView().GetNativeNSView()
removeFromSuperview];
remove_browser_view(view);
[CATransaction commit];
}
void NativeWindowMac::SetTopBrowserView(NativeBrowserView* view) {
[CATransaction begin];
[CATransaction setDisableActions:YES];
if (!view) {
[CATransaction commit];
return;
}
remove_browser_view(view);
add_browser_view(view);
if (view->GetInspectableWebContentsView()) {
auto* native_view = view->GetInspectableWebContentsView()
->GetNativeView()
.GetNativeNSView();
[[window_ contentView] addSubview:native_view
positioned:NSWindowAbove
relativeTo:nil];
native_view.hidden = NO;
}
[CATransaction commit];
}
void NativeWindowMac::SetParentWindow(NativeWindow* parent) {
InternalSetParentWindow(parent, IsVisible());
}
2017-05-23 09:41:59 +00:00
gfx::NativeView NativeWindowMac::GetNativeView() const {
return [window_ contentView];
}
2017-09-14 05:43:22 +00:00
gfx::NativeWindow NativeWindowMac::GetNativeWindow() const {
2014-04-11 04:45:48 +00:00
return window_;
}
2017-05-23 09:41:59 +00:00
gfx::AcceleratedWidget NativeWindowMac::GetAcceleratedWidget() const {
return [window_ windowNumber];
}
content::DesktopMediaID NativeWindowMac::GetDesktopMediaID() const {
chore: bump chromium to 92.0.4475.0 (master) (#28462) * chore: bump chromium in DEPS to 91.0.4464.0 * chore: rebuild chromium/dcheck.patch with import-patches -3 Mechanical only; no code changes * chore: remove content_browser_main_loop.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 The function being patched (BrowserMainLoop::MainMessageLoopRun()) no longer exists. NB: if removing this introduces regressions the likely fix will be to add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop() which has similar code and was added at the same time this was removed. * chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch Mechanical only; no code changes * chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/ui_gtk_public_header.patch manually no code changes * chore: rebuild chromium/web_contents.patch with import-patches -3 Mechanical only; no code changes * chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874 This patch has been merged upstream * chore: export patches * chore: update add_trustedauthclient_to_urlloaderfactory.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969 Sync with removal of render_frame_id_ * chore: sync chromium/put_back_deleted_colors_for_autofill.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841 SkColorFromColorId() no longer takes theme, scheme args * chore: sync chromium/put_back_deleted_colors_for_autofill.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143 Change new calls to GetDarkSchemeColor to fit our patched call signature * chore: update add_trustedauthclient_to_urlloaderfactory.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969 Sync with removal of render_frame_id_ in our mojom * chore: update chromium/frame_host_manager.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008 UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool * chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314 Upstream has removed `history_list_length_` which we were comparing to 0 to calculate our `is_initial_navigation` bool when calling ShouldFork(). ShouldFork() is ours and none of the code paths actually use that param, so this commit removes it altogether. * chore: update permissions_to_register Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074 Replace all uses of APIPermission::ID enum with Mojo type * refactor: update return type of PreMainMessageLoopRun() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 Used to return void; now returns an int errorcode. Note: 2725153 also has some nice doc updates about Browser's "stages" * refactor: sync ElectronBrowserMainParts to MainParts changes Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop so `BrowserMainLoop::result_code_` is no longer available to us for our exit_code_ pointer. This variable held a dual role: (1) of course, hold the exit code, but also (2) was a nullptr before the message loop was ready, indicating to anyone calling SetExitCode() that we were still in startup and could just exit() without any extra steps. exit_code_ still fulfills these two roles but is now a base::Optional. * chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been removed; move that work to the new WillRunMainMessageLoop(). * refactor: stop using CallbackList; it has been removed. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973 * refactor: update use of threadpools. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408 The upstream code is still in flux (e.g. reverts and re-lands) but the tl;dr for this commit is (1) include thread_pool.h if you're using it and (2) don't instantiate pools directly. * refactor: remove routing_id from CreateLoaderAndStart Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858 NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart calls std::make_unique<InProgressRequest>, which needs a routing_id. This PR uses the member field `routing_id_` since there's no longer one being passed into CreateLoaderAndStart. * refactor: sync to upstream ParittionOptions churn Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318 PartitionOptions' enums have changed. * refactor: update Manifest::Location usage Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320 tldr: s/Manifest::FOO/ManifestLocation::kFoo/ * chore: bump chromium in DEPS to 91.0.4465.0 * update patches * refactor: update extensions::Manifest to upstream Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320 - extensions::Manifest::COMPONENT + extensions::mojom::ManifestLocation::kExternalComponent * refactor: sync with upstream UrlInfo ctor changes Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008 UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool * chore: update invocation of convert_protocol_to_json.py Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623 python3 is being used in parts of the upstream build, but the copy of convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol is not python3-friendly. Node has a py2+3-friendly version of it in its tools directory, so call it instead. * chore: use extensions::mojom::APIPermissionID Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122 tldr: - extensions::APIPermission::kFoo + extensions::mojom::APIPermissionID::kFoo * chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737 Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function. This is the same change made upstream at https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc * fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun * chore: Use IDType for permission change subscriptions. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431 tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to be an int; now it's the new SubscriptionId type (which is an IdType64). * chore: sync PowerMonitor code to upstream refactor Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635 tldr: PowerMonitor has been split into PowerStateObserver, PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks posted to consumers who only need notifications for one of those things instead of all of them. * chore: use PartitionOptions's new Cookies field Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318 * Revert "refactor: remove routing_id from CreateLoaderAndStart" This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245. 8c9773b was only a partial fix; reverting to start & try again. * update patches * chore: bump chromium in DEPS to 91.0.4466.0 * chore: update chromium/accelerator.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472 tldr: sync patch with upstream renamed variable & macro names. * chore: update chromium/gtk_visibility.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200 tldr: no code changes; just updating the diff to apply cleanly. note: ooh upstream Wayland hacking! * chore: update chromium/picture-in-picture.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023 tldr: no code changes; just updating the diff to apply cleanly. * chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573 tldr: no code changes; just updating the diff to apply cleanly. * chore: export_all_patches * chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511 tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated, so update the invocation in our patch. * chore: update ElectronBrowserClient w/upstream API Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454 tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer. Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>. * chore: handle new content::PermissionType::FILE_HANDLING in toV8() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201 `file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc * refactor: remove routing_id from CreateLoaderAndStart pt 1 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858 Part 1: the easiest ones * 2796724: Support Python3 https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724 * chore: bump chromium in DEPS to 91.0.4468.0 * 2668974: WebShare: Implement SharingServicePicker https://chromium-review.googlesource.com/c/chromium/src/+/2668974 * 2802766: Apply modernize-make-unique to media/ https://chromium-review.googlesource.com/c/chromium/src/+/2802766 * 2802823: Apply modernize-make-unique to gpu/ https://chromium-review.googlesource.com/c/chromium/src/+/2802823 * 2803041: Apply modernize-make-unique to remaining files https://chromium-review.googlesource.com/c/chromium/src/+/2803041 * 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks https://chromium-review.googlesource.com/c/chromium/src/+/2798873 * 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed https://chromium-review.googlesource.com/c/chromium/src/+/2733595 * chore: update patch indices * 2795107: Remove unused PermissionRequest IDs. https://chromium-review.googlesource.com/c/chromium/src/+/2795107 * chore: bump chromium in DEPS to 91.0.4469.0 * chore: fixup patch indices * chore: bump chromium in DEPS to 91.0.4469.5 * PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window https://chromium-review.googlesource.com/c/chromium/src/+/2710023 * fixup! refactor: remove routing_id from CreateLoaderAndStart * refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader * fixup! chore: fixup patch indices * 2724817: Expand scope of wasm-eval to all URLs https://chromium-review.googlesource.com/c/chromium/src/+/2724817 * Fixup patch after rebase * chore: bump chromium in DEPS to 91.0.4472.0 * 2797341: [ozone/x11] Enabled the global shortcut listener. https://chromium-review.googlesource.com/c/chromium/src/+/2797341 * 2805553: Reland Add GTK ColorMixers to ColorPipeline P1 https://chromium-review.googlesource.com/c/chromium/src/+/2805553 * 2804366: PiP 1.5: Label back to tab button with origin and center it https://chromium-review.googlesource.com/c/chromium/src/+/2804366 * 2784730: Fix crash on AX mode change in NativeViewHost without a Widget https://chromium-review.googlesource.com/c/chromium/src/+/2784730 * chore: update patch indices * 2810174: Add PdfAnnotationsEnabled policy. https://chromium-review.googlesource.com/c/chromium/src/+/2810174 * 2807829: Allow capturers to indicate if they want a WakeLock or not. https://chromium-review.googlesource.com/c/chromium/src/+/2807829 * chore: bump chromium in DEPS to 92.0.4473.0 * chore: bump chromium in DEPS to 92.0.4474.0 * chore: bump chromium in DEPS to 92.0.4475.0 * chore: update patches * chore: updates patches * chore: update is_media_key patch to handle new ozone impl Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341 * fix: ExecuteJavascript requests now need to be flagged as non-bf-aware Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195 * chore: icon_util_x11 is now icon_util_linux Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362 * build: update sysroots Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496 * build: fix missing symbols on linux build * use_ozone and use_x11 are not exclusive * new button view to build for pip Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366 * chore: fix broken gtk_util color patch * chore: remove patch conflict * build: update linux manifests * chore: build bttlb on all platforms for pip * chore: add thread_pool include for views delegate win * chore: fix lint * chore: add node patches for V8 changes * build: add missing base include on windows * fix: update frame host manager patch for new state transitions Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464 * chore: update windows zip manifests * chore: update mac zip manifests * chore: fix patch linting * refactor: implement missing URLLoaderNetworkServiceObserver methods It is against The Mojo Rules to leave hanging callbacks. These always have to be called. Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda * spec: fix locale test on local linux * fix: pass the exit code correctly in new PreMainMessageLoopRun Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475 * fix: ensure we early-exit when request_handler_ is not provided Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5 * fix: strongly set result_code in the BrowserMainLoop * fix: invalid usage of non-targetted PostTask You must always either use a host threadpool or specify a target thread. In this case we did neither after this refactor. Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f * chore: fix gn check * chore: remove stray .rej files in patch * chore: add mojo error code to url loader failure * build: ensure CI is truthy in arm test env * fix: handle windowCaptureMacV2 being enabled when fetching media source id Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931 Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
auto desktop_media_id = content::DesktopMediaID(
content::DesktopMediaID::TYPE_WINDOW, GetAcceleratedWidget());
// c.f.
// https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/media/webrtc/native_desktop_media_list.cc;l=372?q=kWindowCaptureMacV2&ss=chromium
chore: bump chromium to 95.0.4612.5 (main) (#30503) * chore: bump chromium in DEPS to 94.0.4604.0 * build: 3-way merge of chromium patches * chore: bump chromium in DEPS to 94.0.4605.0 * build: 3-way merge of chromium patches * 3076040: Reland Remove delete_children RemoveAllChildViews arg Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3076040 * 3069287: Remove the remaining uses and delete the deprecated API Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3069287 * 2297212: Replace RemoveWithoutPathExpansion(.*, nullptr) with Value::RemoveKey() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2297212 Also: https://chromium-review.googlesource.com/c/chromium/src/+/3060296 * 3082756: Change transport_security_persister_path param to be a path to a file. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3082756 > this CL intentionally changes the name of the parameter > in the network context parameters and the order of the constructor > parameters to ensure all callers update their code to pass a full > file path rather than a path to a directory. The 'path' in this diff is already an absolute path, coming from `CHECK(base::PathService::Get(chrome::DIR_USER_DATA, &path_));` at https://github.com/electron/electron/blob/08ff1c2cbf73c8cfe6bca7976e3eddc3626678db/shell/browser/electron_browser_context.cc#L126 * iwyu: network::mojom::HttpRawHeaderPair * fixup! 3076040: Reland Remove delete_children RemoveAllChildViews arg Missed one. * 2999884: CodeHealth: Remove DictionaryValue::GetStringWithoutPathExpansion Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2999884 (example of replacing GetStringWithoutPathExpansion() w/FindStringKey()) Also: https://chromium-review.googlesource.com/c/chromium/src/+/3060296 (removal of DictionaryValue::GetStringWithoutPathExpansion) * 3059260: Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3059260 We had both of these in a 'disable_features' list. Since these feature have been removed upstream, remove them from our disable list, too. IMPORTANT: this commit should not be backported to older branches that still have these features, because doing so would un-disable them. * 2920890: Load reroute_info from download in-progress and history db back into DownloadItem. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2920890 * 3039323: [Clipboard API] Clipboard Custom Formats implementation Part 5. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3039323 * chore: bump chromium in DEPS to 94.0.4606.0 * 3084502: Add a new PrintRasterizePdfDpi policy. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3084502 * chore: update patches * chore: bump chromium in DEPS to 94.0.4606.3 * chore: bump chromium in DEPS to 95.0.4608.0 * chore: bump chromium in DEPS to 95.0.4609.0 * [DevTools] Remove report_raw_headers from network::ResourceRequest https://chromium-review.googlesource.com/c/chromium/src/+/2856099 * Remove content::WebContentsObserver::OnInterfaceRequestFromFrame https://chromium-review.googlesource.com/c/chromium/src/+/3092665 * Disable kDesktopCaptureMacV2 https://chromium-review.googlesource.com/c/chromium/src/+/3069272 * Add a new PrintRasterizePdfDpi policy. https://chromium-review.googlesource.com/c/chromium/src/+/3084502 * chore: update patches * chore: bump chromium in DEPS to 95.0.4609.3 * disable `use_lld` for macos * chore: update patches * Linux: use chrome_crashpad_handler instead of crashpad_handler https://chromium-review.googlesource.com/c/chromium/src/+/3054290 * chore: fix lint * Revert "[DevTools] Remove report_raw_headers from network::ResourceRequest" This reverts commit 28f4da1582d046e96cb58f3cbb590503e89dfd0d. * [DevTools] Remove report_raw_headers from network::ResourceRequest (Attempt #2) https://chromium-review.googlesource.com/c/chromium/src/+/2856099 * DCHECK that predictor always has a non-empty NetworkIsolationKey. https://chromium-review.googlesource.com/c/chromium/src/+/3067698 * Remove --no-untrusted-code-mitigations from //content and //gin https://chromium-review.googlesource.com/c/chromium/src/+/3096585 * fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure https://chromium-review.googlesource.com/c/chromium/src/+/3059260 * fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure * Convert PrintManager to RenderFrameHostReceiverSet. https://chromium-review.googlesource.com/c/chromium/src/+/3072019 * chore: bump chromium in DEPS to 95.0.4612.5 * chore: disable v8 oilpan * [Compiler] Remove untrusted code mitigations. https://chromium-review.googlesource.com/c/v8/v8/+/3045704 * Remove most FTP logic from services/network. https://chromium-review.googlesource.com/c/chromium/src/+/3076119 * Rename scale_factor.h -> resource_scale_factor.h https://chromium-review.googlesource.com/c/chromium/src/+/3057113 * [GURL -> SiteForCookies] extensions/ https://chromium-review.googlesource.com/c/chromium/src/+/3100825 * breadcrumbs: add desktop entry point https://chromium-review.googlesource.com/c/chromium/src/+/3021746 * Move args_ to private in ExtensionFunction https://chromium-review.googlesource.com/c/chromium/src/+/3076261 * chore: iwyu * fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure * Disable kDesktopCaptureMacV2 https://chromium-review.googlesource.com/c/chromium/src/+/3069272 * fixup! [Compiler] Remove untrusted code mitigations. * fixup! Disable kDesktopCaptureMacV2 * Revert "chore: disable v8 oilpan" This reverts commit 5d255cf1d8e8efbb906047937a713279e5f800d0. * Reland "chore: disable v8 oilpan" This reverts commit 1c252765b07a205560e7b5eed06de2605336e2d8. The previous revert was to test on which platforms did the heapsnapshot test actually fail. * [Clipboard API] Clipboard Custom Formats implementation Part 5. https://chromium-review.googlesource.com/c/chromium/src/+/3039323 * Convert ExtensionFrameHost to RenderFrameHostReceiverSet. https://chromium-review.googlesource.com/c/chromium/src/+/3063358 * Convert PDFWebContentsHelper to RenderFrameHostReceiverSet. https://chromium-review.googlesource.com/c/chromium/src/+/3049751 * [Underscore Migration] Migrate ui/legacy https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3093160 * chore: remove unknown permission error * chore: fix lint * chore: ignore -Wunreachable-code-return for node deps/ * fixup! chore: ignore -Wunreachable-code-return for node deps/ * fix: windows build * fix: build dependency Dependency was missed in cbeae20438be8baf03ce0e32a73563a80aeccb37 * 3108669: arm,dsp: Fix 8bpp Dct64_NEON(). https://chromium-review.googlesource.com/c/codecs/libgav1/+/3108669 * chore: revert libgav1 roll * Revert "3108669: arm,dsp: Fix 8bpp Dct64_NEON()." This reverts commit 7ed31323127aac8ba2eaff9cae6c9be9a4954f33. * Revert "chore: revert libgav1 roll" This reverts commit 084a490d298811267316c786762fe7aa91b6318d. * chore: revert clang roll * chore: Fix -Wunreachable-code-aggressive warnings in arm and arm64 code Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: mlaurencin <mlaurencin@electronjs.org> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-24 00:52:17 +00:00
// Refs https://github.com/electron/electron/pull/30507
// TODO(deepak1556): Match upstream for `kWindowCaptureMacV2`
#if 0
chore: bump chromium to 92.0.4475.0 (master) (#28462) * chore: bump chromium in DEPS to 91.0.4464.0 * chore: rebuild chromium/dcheck.patch with import-patches -3 Mechanical only; no code changes * chore: remove content_browser_main_loop.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 The function being patched (BrowserMainLoop::MainMessageLoopRun()) no longer exists. NB: if removing this introduces regressions the likely fix will be to add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop() which has similar code and was added at the same time this was removed. * chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch Mechanical only; no code changes * chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/ui_gtk_public_header.patch manually no code changes * chore: rebuild chromium/web_contents.patch with import-patches -3 Mechanical only; no code changes * chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874 This patch has been merged upstream * chore: export patches * chore: update add_trustedauthclient_to_urlloaderfactory.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969 Sync with removal of render_frame_id_ * chore: sync chromium/put_back_deleted_colors_for_autofill.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841 SkColorFromColorId() no longer takes theme, scheme args * chore: sync chromium/put_back_deleted_colors_for_autofill.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143 Change new calls to GetDarkSchemeColor to fit our patched call signature * chore: update add_trustedauthclient_to_urlloaderfactory.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969 Sync with removal of render_frame_id_ in our mojom * chore: update chromium/frame_host_manager.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008 UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool * chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314 Upstream has removed `history_list_length_` which we were comparing to 0 to calculate our `is_initial_navigation` bool when calling ShouldFork(). ShouldFork() is ours and none of the code paths actually use that param, so this commit removes it altogether. * chore: update permissions_to_register Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074 Replace all uses of APIPermission::ID enum with Mojo type * refactor: update return type of PreMainMessageLoopRun() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 Used to return void; now returns an int errorcode. Note: 2725153 also has some nice doc updates about Browser's "stages" * refactor: sync ElectronBrowserMainParts to MainParts changes Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop so `BrowserMainLoop::result_code_` is no longer available to us for our exit_code_ pointer. This variable held a dual role: (1) of course, hold the exit code, but also (2) was a nullptr before the message loop was ready, indicating to anyone calling SetExitCode() that we were still in startup and could just exit() without any extra steps. exit_code_ still fulfills these two roles but is now a base::Optional. * chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been removed; move that work to the new WillRunMainMessageLoop(). * refactor: stop using CallbackList; it has been removed. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973 * refactor: update use of threadpools. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408 The upstream code is still in flux (e.g. reverts and re-lands) but the tl;dr for this commit is (1) include thread_pool.h if you're using it and (2) don't instantiate pools directly. * refactor: remove routing_id from CreateLoaderAndStart Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858 NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart calls std::make_unique<InProgressRequest>, which needs a routing_id. This PR uses the member field `routing_id_` since there's no longer one being passed into CreateLoaderAndStart. * refactor: sync to upstream ParittionOptions churn Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318 PartitionOptions' enums have changed. * refactor: update Manifest::Location usage Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320 tldr: s/Manifest::FOO/ManifestLocation::kFoo/ * chore: bump chromium in DEPS to 91.0.4465.0 * update patches * refactor: update extensions::Manifest to upstream Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320 - extensions::Manifest::COMPONENT + extensions::mojom::ManifestLocation::kExternalComponent * refactor: sync with upstream UrlInfo ctor changes Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008 UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool * chore: update invocation of convert_protocol_to_json.py Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623 python3 is being used in parts of the upstream build, but the copy of convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol is not python3-friendly. Node has a py2+3-friendly version of it in its tools directory, so call it instead. * chore: use extensions::mojom::APIPermissionID Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122 tldr: - extensions::APIPermission::kFoo + extensions::mojom::APIPermissionID::kFoo * chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737 Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function. This is the same change made upstream at https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc * fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun * chore: Use IDType for permission change subscriptions. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431 tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to be an int; now it's the new SubscriptionId type (which is an IdType64). * chore: sync PowerMonitor code to upstream refactor Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635 tldr: PowerMonitor has been split into PowerStateObserver, PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks posted to consumers who only need notifications for one of those things instead of all of them. * chore: use PartitionOptions's new Cookies field Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318 * Revert "refactor: remove routing_id from CreateLoaderAndStart" This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245. 8c9773b was only a partial fix; reverting to start & try again. * update patches * chore: bump chromium in DEPS to 91.0.4466.0 * chore: update chromium/accelerator.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472 tldr: sync patch with upstream renamed variable & macro names. * chore: update chromium/gtk_visibility.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200 tldr: no code changes; just updating the diff to apply cleanly. note: ooh upstream Wayland hacking! * chore: update chromium/picture-in-picture.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023 tldr: no code changes; just updating the diff to apply cleanly. * chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573 tldr: no code changes; just updating the diff to apply cleanly. * chore: export_all_patches * chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511 tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated, so update the invocation in our patch. * chore: update ElectronBrowserClient w/upstream API Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454 tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer. Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>. * chore: handle new content::PermissionType::FILE_HANDLING in toV8() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201 `file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc * refactor: remove routing_id from CreateLoaderAndStart pt 1 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858 Part 1: the easiest ones * 2796724: Support Python3 https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724 * chore: bump chromium in DEPS to 91.0.4468.0 * 2668974: WebShare: Implement SharingServicePicker https://chromium-review.googlesource.com/c/chromium/src/+/2668974 * 2802766: Apply modernize-make-unique to media/ https://chromium-review.googlesource.com/c/chromium/src/+/2802766 * 2802823: Apply modernize-make-unique to gpu/ https://chromium-review.googlesource.com/c/chromium/src/+/2802823 * 2803041: Apply modernize-make-unique to remaining files https://chromium-review.googlesource.com/c/chromium/src/+/2803041 * 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks https://chromium-review.googlesource.com/c/chromium/src/+/2798873 * 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed https://chromium-review.googlesource.com/c/chromium/src/+/2733595 * chore: update patch indices * 2795107: Remove unused PermissionRequest IDs. https://chromium-review.googlesource.com/c/chromium/src/+/2795107 * chore: bump chromium in DEPS to 91.0.4469.0 * chore: fixup patch indices * chore: bump chromium in DEPS to 91.0.4469.5 * PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window https://chromium-review.googlesource.com/c/chromium/src/+/2710023 * fixup! refactor: remove routing_id from CreateLoaderAndStart * refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader * fixup! chore: fixup patch indices * 2724817: Expand scope of wasm-eval to all URLs https://chromium-review.googlesource.com/c/chromium/src/+/2724817 * Fixup patch after rebase * chore: bump chromium in DEPS to 91.0.4472.0 * 2797341: [ozone/x11] Enabled the global shortcut listener. https://chromium-review.googlesource.com/c/chromium/src/+/2797341 * 2805553: Reland Add GTK ColorMixers to ColorPipeline P1 https://chromium-review.googlesource.com/c/chromium/src/+/2805553 * 2804366: PiP 1.5: Label back to tab button with origin and center it https://chromium-review.googlesource.com/c/chromium/src/+/2804366 * 2784730: Fix crash on AX mode change in NativeViewHost without a Widget https://chromium-review.googlesource.com/c/chromium/src/+/2784730 * chore: update patch indices * 2810174: Add PdfAnnotationsEnabled policy. https://chromium-review.googlesource.com/c/chromium/src/+/2810174 * 2807829: Allow capturers to indicate if they want a WakeLock or not. https://chromium-review.googlesource.com/c/chromium/src/+/2807829 * chore: bump chromium in DEPS to 92.0.4473.0 * chore: bump chromium in DEPS to 92.0.4474.0 * chore: bump chromium in DEPS to 92.0.4475.0 * chore: update patches * chore: updates patches * chore: update is_media_key patch to handle new ozone impl Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341 * fix: ExecuteJavascript requests now need to be flagged as non-bf-aware Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195 * chore: icon_util_x11 is now icon_util_linux Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362 * build: update sysroots Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496 * build: fix missing symbols on linux build * use_ozone and use_x11 are not exclusive * new button view to build for pip Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366 * chore: fix broken gtk_util color patch * chore: remove patch conflict * build: update linux manifests * chore: build bttlb on all platforms for pip * chore: add thread_pool include for views delegate win * chore: fix lint * chore: add node patches for V8 changes * build: add missing base include on windows * fix: update frame host manager patch for new state transitions Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464 * chore: update windows zip manifests * chore: update mac zip manifests * chore: fix patch linting * refactor: implement missing URLLoaderNetworkServiceObserver methods It is against The Mojo Rules to leave hanging callbacks. These always have to be called. Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda * spec: fix locale test on local linux * fix: pass the exit code correctly in new PreMainMessageLoopRun Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475 * fix: ensure we early-exit when request_handler_ is not provided Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5 * fix: strongly set result_code in the BrowserMainLoop * fix: invalid usage of non-targetted PostTask You must always either use a host threadpool or specify a target thread. In this case we did neither after this refactor. Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f * chore: fix gn check * chore: remove stray .rej files in patch * chore: add mojo error code to url loader failure * build: ensure CI is truthy in arm test env * fix: handle windowCaptureMacV2 being enabled when fetching media source id Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931 Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
if (remote_cocoa::ScopedCGWindowID::Get(desktop_media_id.id)) {
desktop_media_id.window_id = desktop_media_id.id;
}
chore: bump chromium to 95.0.4612.5 (main) (#30503) * chore: bump chromium in DEPS to 94.0.4604.0 * build: 3-way merge of chromium patches * chore: bump chromium in DEPS to 94.0.4605.0 * build: 3-way merge of chromium patches * 3076040: Reland Remove delete_children RemoveAllChildViews arg Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3076040 * 3069287: Remove the remaining uses and delete the deprecated API Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3069287 * 2297212: Replace RemoveWithoutPathExpansion(.*, nullptr) with Value::RemoveKey() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2297212 Also: https://chromium-review.googlesource.com/c/chromium/src/+/3060296 * 3082756: Change transport_security_persister_path param to be a path to a file. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3082756 > this CL intentionally changes the name of the parameter > in the network context parameters and the order of the constructor > parameters to ensure all callers update their code to pass a full > file path rather than a path to a directory. The 'path' in this diff is already an absolute path, coming from `CHECK(base::PathService::Get(chrome::DIR_USER_DATA, &path_));` at https://github.com/electron/electron/blob/08ff1c2cbf73c8cfe6bca7976e3eddc3626678db/shell/browser/electron_browser_context.cc#L126 * iwyu: network::mojom::HttpRawHeaderPair * fixup! 3076040: Reland Remove delete_children RemoveAllChildViews arg Missed one. * 2999884: CodeHealth: Remove DictionaryValue::GetStringWithoutPathExpansion Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2999884 (example of replacing GetStringWithoutPathExpansion() w/FindStringKey()) Also: https://chromium-review.googlesource.com/c/chromium/src/+/3060296 (removal of DictionaryValue::GetStringWithoutPathExpansion) * 3059260: Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3059260 We had both of these in a 'disable_features' list. Since these feature have been removed upstream, remove them from our disable list, too. IMPORTANT: this commit should not be backported to older branches that still have these features, because doing so would un-disable them. * 2920890: Load reroute_info from download in-progress and history db back into DownloadItem. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2920890 * 3039323: [Clipboard API] Clipboard Custom Formats implementation Part 5. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3039323 * chore: bump chromium in DEPS to 94.0.4606.0 * 3084502: Add a new PrintRasterizePdfDpi policy. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3084502 * chore: update patches * chore: bump chromium in DEPS to 94.0.4606.3 * chore: bump chromium in DEPS to 95.0.4608.0 * chore: bump chromium in DEPS to 95.0.4609.0 * [DevTools] Remove report_raw_headers from network::ResourceRequest https://chromium-review.googlesource.com/c/chromium/src/+/2856099 * Remove content::WebContentsObserver::OnInterfaceRequestFromFrame https://chromium-review.googlesource.com/c/chromium/src/+/3092665 * Disable kDesktopCaptureMacV2 https://chromium-review.googlesource.com/c/chromium/src/+/3069272 * Add a new PrintRasterizePdfDpi policy. https://chromium-review.googlesource.com/c/chromium/src/+/3084502 * chore: update patches * chore: bump chromium in DEPS to 95.0.4609.3 * disable `use_lld` for macos * chore: update patches * Linux: use chrome_crashpad_handler instead of crashpad_handler https://chromium-review.googlesource.com/c/chromium/src/+/3054290 * chore: fix lint * Revert "[DevTools] Remove report_raw_headers from network::ResourceRequest" This reverts commit 28f4da1582d046e96cb58f3cbb590503e89dfd0d. * [DevTools] Remove report_raw_headers from network::ResourceRequest (Attempt #2) https://chromium-review.googlesource.com/c/chromium/src/+/2856099 * DCHECK that predictor always has a non-empty NetworkIsolationKey. https://chromium-review.googlesource.com/c/chromium/src/+/3067698 * Remove --no-untrusted-code-mitigations from //content and //gin https://chromium-review.googlesource.com/c/chromium/src/+/3096585 * fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure https://chromium-review.googlesource.com/c/chromium/src/+/3059260 * fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure * Convert PrintManager to RenderFrameHostReceiverSet. https://chromium-review.googlesource.com/c/chromium/src/+/3072019 * chore: bump chromium in DEPS to 95.0.4612.5 * chore: disable v8 oilpan * [Compiler] Remove untrusted code mitigations. https://chromium-review.googlesource.com/c/v8/v8/+/3045704 * Remove most FTP logic from services/network. https://chromium-review.googlesource.com/c/chromium/src/+/3076119 * Rename scale_factor.h -> resource_scale_factor.h https://chromium-review.googlesource.com/c/chromium/src/+/3057113 * [GURL -> SiteForCookies] extensions/ https://chromium-review.googlesource.com/c/chromium/src/+/3100825 * breadcrumbs: add desktop entry point https://chromium-review.googlesource.com/c/chromium/src/+/3021746 * Move args_ to private in ExtensionFunction https://chromium-review.googlesource.com/c/chromium/src/+/3076261 * chore: iwyu * fixup! Remove kSameSiteByDefaultCookies and kCookiesWithoutSameSiteMustBeSecure * Disable kDesktopCaptureMacV2 https://chromium-review.googlesource.com/c/chromium/src/+/3069272 * fixup! [Compiler] Remove untrusted code mitigations. * fixup! Disable kDesktopCaptureMacV2 * Revert "chore: disable v8 oilpan" This reverts commit 5d255cf1d8e8efbb906047937a713279e5f800d0. * Reland "chore: disable v8 oilpan" This reverts commit 1c252765b07a205560e7b5eed06de2605336e2d8. The previous revert was to test on which platforms did the heapsnapshot test actually fail. * [Clipboard API] Clipboard Custom Formats implementation Part 5. https://chromium-review.googlesource.com/c/chromium/src/+/3039323 * Convert ExtensionFrameHost to RenderFrameHostReceiverSet. https://chromium-review.googlesource.com/c/chromium/src/+/3063358 * Convert PDFWebContentsHelper to RenderFrameHostReceiverSet. https://chromium-review.googlesource.com/c/chromium/src/+/3049751 * [Underscore Migration] Migrate ui/legacy https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3093160 * chore: remove unknown permission error * chore: fix lint * chore: ignore -Wunreachable-code-return for node deps/ * fixup! chore: ignore -Wunreachable-code-return for node deps/ * fix: windows build * fix: build dependency Dependency was missed in cbeae20438be8baf03ce0e32a73563a80aeccb37 * 3108669: arm,dsp: Fix 8bpp Dct64_NEON(). https://chromium-review.googlesource.com/c/codecs/libgav1/+/3108669 * chore: revert libgav1 roll * Revert "3108669: arm,dsp: Fix 8bpp Dct64_NEON()." This reverts commit 7ed31323127aac8ba2eaff9cae6c9be9a4954f33. * Revert "chore: revert libgav1 roll" This reverts commit 084a490d298811267316c786762fe7aa91b6318d. * chore: revert clang roll * chore: Fix -Wunreachable-code-aggressive warnings in arm and arm64 code Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: mlaurencin <mlaurencin@electronjs.org> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-08-24 00:52:17 +00:00
#endif
chore: bump chromium to 92.0.4475.0 (master) (#28462) * chore: bump chromium in DEPS to 91.0.4464.0 * chore: rebuild chromium/dcheck.patch with import-patches -3 Mechanical only; no code changes * chore: remove content_browser_main_loop.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 The function being patched (BrowserMainLoop::MainMessageLoopRun()) no longer exists. NB: if removing this introduces regressions the likely fix will be to add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop() which has similar code and was added at the same time this was removed. * chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch Mechanical only; no code changes * chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3 Mechanical only; no code changes * chore: rebuild chromium/ui_gtk_public_header.patch manually no code changes * chore: rebuild chromium/web_contents.patch with import-patches -3 Mechanical only; no code changes * chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874 This patch has been merged upstream * chore: export patches * chore: update add_trustedauthclient_to_urlloaderfactory.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969 Sync with removal of render_frame_id_ * chore: sync chromium/put_back_deleted_colors_for_autofill.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841 SkColorFromColorId() no longer takes theme, scheme args * chore: sync chromium/put_back_deleted_colors_for_autofill.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143 Change new calls to GetDarkSchemeColor to fit our patched call signature * chore: update add_trustedauthclient_to_urlloaderfactory.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969 Sync with removal of render_frame_id_ in our mojom * chore: update chromium/frame_host_manager.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008 UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool * chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314 Upstream has removed `history_list_length_` which we were comparing to 0 to calculate our `is_initial_navigation` bool when calling ShouldFork(). ShouldFork() is ours and none of the code paths actually use that param, so this commit removes it altogether. * chore: update permissions_to_register Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074 Replace all uses of APIPermission::ID enum with Mojo type * refactor: update return type of PreMainMessageLoopRun() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 Used to return void; now returns an int errorcode. Note: 2725153 also has some nice doc updates about Browser's "stages" * refactor: sync ElectronBrowserMainParts to MainParts changes Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop so `BrowserMainLoop::result_code_` is no longer available to us for our exit_code_ pointer. This variable held a dual role: (1) of course, hold the exit code, but also (2) was a nullptr before the message loop was ready, indicating to anyone calling SetExitCode() that we were still in startup and could just exit() without any extra steps. exit_code_ still fulfills these two roles but is now a base::Optional. * chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153 BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been removed; move that work to the new WillRunMainMessageLoop(). * refactor: stop using CallbackList; it has been removed. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973 * refactor: update use of threadpools. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408 The upstream code is still in flux (e.g. reverts and re-lands) but the tl;dr for this commit is (1) include thread_pool.h if you're using it and (2) don't instantiate pools directly. * refactor: remove routing_id from CreateLoaderAndStart Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858 NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart calls std::make_unique<InProgressRequest>, which needs a routing_id. This PR uses the member field `routing_id_` since there's no longer one being passed into CreateLoaderAndStart. * refactor: sync to upstream ParittionOptions churn Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318 PartitionOptions' enums have changed. * refactor: update Manifest::Location usage Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320 tldr: s/Manifest::FOO/ManifestLocation::kFoo/ * chore: bump chromium in DEPS to 91.0.4465.0 * update patches * refactor: update extensions::Manifest to upstream Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320 - extensions::Manifest::COMPONENT + extensions::mojom::ManifestLocation::kExternalComponent * refactor: sync with upstream UrlInfo ctor changes Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008 UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool * chore: update invocation of convert_protocol_to_json.py Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623 python3 is being used in parts of the upstream build, but the copy of convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol is not python3-friendly. Node has a py2+3-friendly version of it in its tools directory, so call it instead. * chore: use extensions::mojom::APIPermissionID Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122 tldr: - extensions::APIPermission::kFoo + extensions::mojom::APIPermissionID::kFoo * chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737 Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function. This is the same change made upstream at https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc * fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun * chore: Use IDType for permission change subscriptions. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431 tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to be an int; now it's the new SubscriptionId type (which is an IdType64). * chore: sync PowerMonitor code to upstream refactor Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635 tldr: PowerMonitor has been split into PowerStateObserver, PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks posted to consumers who only need notifications for one of those things instead of all of them. * chore: use PartitionOptions's new Cookies field Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318 * Revert "refactor: remove routing_id from CreateLoaderAndStart" This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245. 8c9773b was only a partial fix; reverting to start & try again. * update patches * chore: bump chromium in DEPS to 91.0.4466.0 * chore: update chromium/accelerator.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472 tldr: sync patch with upstream renamed variable & macro names. * chore: update chromium/gtk_visibility.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200 tldr: no code changes; just updating the diff to apply cleanly. note: ooh upstream Wayland hacking! * chore: update chromium/picture-in-picture.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023 tldr: no code changes; just updating the diff to apply cleanly. * chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573 tldr: no code changes; just updating the diff to apply cleanly. * chore: export_all_patches * chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511 tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated, so update the invocation in our patch. * chore: update ElectronBrowserClient w/upstream API Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454 tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer. Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>. * chore: handle new content::PermissionType::FILE_HANDLING in toV8() Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201 `file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc * refactor: remove routing_id from CreateLoaderAndStart pt 1 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858 Part 1: the easiest ones * 2796724: Support Python3 https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724 * chore: bump chromium in DEPS to 91.0.4468.0 * 2668974: WebShare: Implement SharingServicePicker https://chromium-review.googlesource.com/c/chromium/src/+/2668974 * 2802766: Apply modernize-make-unique to media/ https://chromium-review.googlesource.com/c/chromium/src/+/2802766 * 2802823: Apply modernize-make-unique to gpu/ https://chromium-review.googlesource.com/c/chromium/src/+/2802823 * 2803041: Apply modernize-make-unique to remaining files https://chromium-review.googlesource.com/c/chromium/src/+/2803041 * 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks https://chromium-review.googlesource.com/c/chromium/src/+/2798873 * 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed https://chromium-review.googlesource.com/c/chromium/src/+/2733595 * chore: update patch indices * 2795107: Remove unused PermissionRequest IDs. https://chromium-review.googlesource.com/c/chromium/src/+/2795107 * chore: bump chromium in DEPS to 91.0.4469.0 * chore: fixup patch indices * chore: bump chromium in DEPS to 91.0.4469.5 * PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window https://chromium-review.googlesource.com/c/chromium/src/+/2710023 * fixup! refactor: remove routing_id from CreateLoaderAndStart * refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader * fixup! chore: fixup patch indices * 2724817: Expand scope of wasm-eval to all URLs https://chromium-review.googlesource.com/c/chromium/src/+/2724817 * Fixup patch after rebase * chore: bump chromium in DEPS to 91.0.4472.0 * 2797341: [ozone/x11] Enabled the global shortcut listener. https://chromium-review.googlesource.com/c/chromium/src/+/2797341 * 2805553: Reland Add GTK ColorMixers to ColorPipeline P1 https://chromium-review.googlesource.com/c/chromium/src/+/2805553 * 2804366: PiP 1.5: Label back to tab button with origin and center it https://chromium-review.googlesource.com/c/chromium/src/+/2804366 * 2784730: Fix crash on AX mode change in NativeViewHost without a Widget https://chromium-review.googlesource.com/c/chromium/src/+/2784730 * chore: update patch indices * 2810174: Add PdfAnnotationsEnabled policy. https://chromium-review.googlesource.com/c/chromium/src/+/2810174 * 2807829: Allow capturers to indicate if they want a WakeLock or not. https://chromium-review.googlesource.com/c/chromium/src/+/2807829 * chore: bump chromium in DEPS to 92.0.4473.0 * chore: bump chromium in DEPS to 92.0.4474.0 * chore: bump chromium in DEPS to 92.0.4475.0 * chore: update patches * chore: updates patches * chore: update is_media_key patch to handle new ozone impl Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341 * fix: ExecuteJavascript requests now need to be flagged as non-bf-aware Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195 * chore: icon_util_x11 is now icon_util_linux Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362 * build: update sysroots Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496 * build: fix missing symbols on linux build * use_ozone and use_x11 are not exclusive * new button view to build for pip Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366 * chore: fix broken gtk_util color patch * chore: remove patch conflict * build: update linux manifests * chore: build bttlb on all platforms for pip * chore: add thread_pool include for views delegate win * chore: fix lint * chore: add node patches for V8 changes * build: add missing base include on windows * fix: update frame host manager patch for new state transitions Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464 * chore: update windows zip manifests * chore: update mac zip manifests * chore: fix patch linting * refactor: implement missing URLLoaderNetworkServiceObserver methods It is against The Mojo Rules to leave hanging callbacks. These always have to be called. Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda * spec: fix locale test on local linux * fix: pass the exit code correctly in new PreMainMessageLoopRun Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475 * fix: ensure we early-exit when request_handler_ is not provided Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5 * fix: strongly set result_code in the BrowserMainLoop * fix: invalid usage of non-targetted PostTask You must always either use a host threadpool or specify a target thread. In this case we did neither after this refactor. Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f * chore: fix gn check * chore: remove stray .rej files in patch * chore: add mojo error code to url loader failure * build: ensure CI is truthy in arm test env * fix: handle windowCaptureMacV2 being enabled when fetching media source id Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931 Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
return desktop_media_id;
2016-01-07 20:38:35 +00:00
}
NativeWindowHandle NativeWindowMac::GetNativeWindowHandle() const {
return [window_ contentView];
}
2018-04-20 18:47:04 +00:00
void NativeWindowMac::SetProgressBar(double progress,
const NativeWindow::ProgressState state) {
2014-09-17 07:58:08 +00:00
NSDockTile* dock_tile = [NSApp dockTile];
// Sometimes macOS would install a default contentView for dock, we must
// verify whether NSProgressIndicator has been installed.
bool first_time = !dock_tile.contentView ||
[[dock_tile.contentView subviews] count] == 0 ||
![[[dock_tile.contentView subviews] lastObject]
isKindOfClass:[NSProgressIndicator class]];
2018-04-20 18:47:04 +00:00
// For the first time API invoked, we need to create a ContentView in
// DockTile.
if (first_time) {
NSImageView* image_view = [[[NSImageView alloc] init] autorelease];
2014-09-17 07:58:08 +00:00
[image_view setImage:[NSApp applicationIconImage]];
[dock_tile setContentView:image_view];
NSRect frame = NSMakeRect(0.0f, 0.0f, dock_tile.size.width, 15.0);
NSProgressIndicator* progress_indicator =
[[[ElectronProgressBar alloc] initWithFrame:frame] autorelease];
2014-09-17 07:58:08 +00:00
[progress_indicator setStyle:NSProgressIndicatorBarStyle];
[progress_indicator setIndeterminate:NO];
[progress_indicator setBezeled:YES];
[progress_indicator setMinValue:0];
[progress_indicator setMaxValue:1];
[progress_indicator setHidden:NO];
[dock_tile.contentView addSubview:progress_indicator];
2014-09-17 07:58:08 +00:00
}
2018-04-20 18:47:04 +00:00
NSProgressIndicator* progress_indicator = static_cast<NSProgressIndicator*>(
[[[dock_tile contentView] subviews] lastObject]);
2014-09-17 07:58:08 +00:00
if (progress < 0) {
[progress_indicator setHidden:YES];
} else if (progress > 1) {
[progress_indicator setHidden:NO];
2014-09-17 07:58:08 +00:00
[progress_indicator setIndeterminate:YES];
[progress_indicator setDoubleValue:1];
2014-09-17 07:58:08 +00:00
} else {
[progress_indicator setHidden:NO];
2014-09-17 07:58:08 +00:00
[progress_indicator setDoubleValue:progress];
}
[dock_tile display];
}
2015-02-11 01:14:26 +00:00
void NativeWindowMac::SetOverlayIcon(const gfx::Image& overlay,
2018-04-20 18:47:04 +00:00
const std::string& description) {}
2015-02-07 19:56:03 +00:00
void NativeWindowMac::SetVisibleOnAllWorkspaces(bool visible,
bool visibleOnFullScreen,
bool skipTransformProcessType) {
// In order for NSWindows to be visible on fullscreen we need to functionally
// mimic app.dock.hide() since Apple changed the underlying functionality of
// NSWindows starting with 10.14 to disallow NSWindows from floating on top of
// fullscreen apps.
if (!skipTransformProcessType) {
ProcessSerialNumber psn = {0, kCurrentProcess};
if (visibleOnFullScreen) {
[window_ setCanHide:NO];
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
} else {
[window_ setCanHide:YES];
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
}
}
2016-01-23 11:12:19 +00:00
SetCollectionBehavior(visible, NSWindowCollectionBehaviorCanJoinAllSpaces);
SetCollectionBehavior(visibleOnFullScreen,
NSWindowCollectionBehaviorFullScreenAuxiliary);
}
bool NativeWindowMac::IsVisibleOnAllWorkspaces() {
2015-03-27 11:41:07 +00:00
NSUInteger collectionBehavior = [window_ collectionBehavior];
return collectionBehavior & NSWindowCollectionBehaviorCanJoinAllSpaces;
}
void NativeWindowMac::SetAutoHideCursor(bool auto_hide) {
[window_ setDisableAutoHideCursor:!auto_hide];
}
void NativeWindowMac::UpdateVibrancyRadii(bool fullscreen) {
NSVisualEffectView* vibrantView = [window_ vibrantView];
if (vibrantView != nil && !vibrancy_type_.empty()) {
const bool no_rounded_corner =
!([window_ styleMask] & NSWindowStyleMaskTitled);
if (!has_frame() && !is_modal() && !no_rounded_corner) {
CGFloat radius;
if (fullscreen) {
radius = 0.0f;
} else if (@available(macOS 11.0, *)) {
radius = 9.0f;
} else {
// Smaller corner radius on versions prior to Big Sur.
radius = 5.0f;
}
CGFloat dimension = 2 * radius + 1;
NSSize size = NSMakeSize(dimension, dimension);
NSImage* maskImage = [NSImage imageWithSize:size
flipped:NO
drawingHandler:^BOOL(NSRect rect) {
NSBezierPath* bezierPath = [NSBezierPath
bezierPathWithRoundedRect:rect
xRadius:radius
yRadius:radius];
[[NSColor blackColor] set];
[bezierPath fill];
return YES;
}];
[maskImage setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)];
[maskImage setResizingMode:NSImageResizingModeStretch];
[vibrantView setMaskImage:maskImage];
[window_ setCornerMask:maskImage];
}
}
}
2016-11-07 20:22:41 +00:00
void NativeWindowMac::SetVibrancy(const std::string& type) {
NSVisualEffectView* vibrantView = [window_ vibrantView];
if (type.empty()) {
if (vibrantView == nil)
return;
[vibrantView removeFromSuperview];
[window_ setVibrantView:nil];
return;
}
std::string dep_warn = " has been deprecated and removed as of macOS 10.15.";
node::Environment* env =
node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate());
NSVisualEffectMaterial vibrancyType{};
if (type == "appearance-based") {
EmitWarning(env, "NSVisualEffectMaterialAppearanceBased" + dep_warn,
"electron");
vibrancyType = NSVisualEffectMaterialAppearanceBased;
} else if (type == "light") {
EmitWarning(env, "NSVisualEffectMaterialLight" + dep_warn, "electron");
vibrancyType = NSVisualEffectMaterialLight;
} else if (type == "dark") {
EmitWarning(env, "NSVisualEffectMaterialDark" + dep_warn, "electron");
vibrancyType = NSVisualEffectMaterialDark;
} else if (type == "titlebar") {
vibrancyType = NSVisualEffectMaterialTitlebar;
}
if (type == "selection") {
vibrancyType = NSVisualEffectMaterialSelection;
} else if (type == "menu") {
vibrancyType = NSVisualEffectMaterialMenu;
} else if (type == "popover") {
vibrancyType = NSVisualEffectMaterialPopover;
} else if (type == "sidebar") {
vibrancyType = NSVisualEffectMaterialSidebar;
} else if (type == "medium-light") {
EmitWarning(env, "NSVisualEffectMaterialMediumLight" + dep_warn,
"electron");
vibrancyType = NSVisualEffectMaterialMediumLight;
} else if (type == "ultra-dark") {
EmitWarning(env, "NSVisualEffectMaterialUltraDark" + dep_warn, "electron");
vibrancyType = NSVisualEffectMaterialUltraDark;
}
if (@available(macOS 10.14, *)) {
if (type == "header") {
vibrancyType = NSVisualEffectMaterialHeaderView;
} else if (type == "sheet") {
vibrancyType = NSVisualEffectMaterialSheet;
} else if (type == "window") {
vibrancyType = NSVisualEffectMaterialWindowBackground;
} else if (type == "hud") {
vibrancyType = NSVisualEffectMaterialHUDWindow;
} else if (type == "fullscreen-ui") {
vibrancyType = NSVisualEffectMaterialFullScreenUI;
} else if (type == "tooltip") {
vibrancyType = NSVisualEffectMaterialToolTip;
} else if (type == "content") {
vibrancyType = NSVisualEffectMaterialContentBackground;
} else if (type == "under-window") {
vibrancyType = NSVisualEffectMaterialUnderWindowBackground;
} else if (type == "under-page") {
vibrancyType = NSVisualEffectMaterialUnderPageBackground;
}
}
if (vibrancyType) {
vibrancy_type_ = type;
if (vibrantView == nil) {
vibrantView = [[[NSVisualEffectView alloc]
initWithFrame:[[window_ contentView] bounds]] autorelease];
[window_ setVibrantView:vibrantView];
[vibrantView
setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[vibrantView setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
if (visual_effect_state_ == VisualEffectState::kActive) {
[vibrantView setState:NSVisualEffectStateActive];
} else if (visual_effect_state_ == VisualEffectState::kInactive) {
[vibrantView setState:NSVisualEffectStateInactive];
} else {
[vibrantView setState:NSVisualEffectStateFollowsWindowActiveState];
}
[[window_ contentView] addSubview:vibrantView
positioned:NSWindowBelow
relativeTo:nil];
UpdateVibrancyRadii(IsFullscreen());
}
[vibrantView setMaterial:vibrancyType];
}
2016-11-07 20:22:41 +00:00
}
void NativeWindowMac::SetWindowButtonVisibility(bool visible) {
window_button_visibility_ = visible;
// The visibility of window buttons are managed by |buttons_proxy_| if the
// style is customButtonsOnHover.
if (title_bar_style_ == TitleBarStyle::kCustomButtonsOnHover)
[buttons_proxy_ setVisible:visible];
else
InternalSetWindowButtonVisibility(visible);
NotifyLayoutWindowControlsOverlay();
}
bool NativeWindowMac::GetWindowButtonVisibility() const {
return ![window_ standardWindowButton:NSWindowZoomButton].hidden ||
![window_ standardWindowButton:NSWindowMiniaturizeButton].hidden ||
![window_ standardWindowButton:NSWindowCloseButton].hidden;
}
void NativeWindowMac::SetTrafficLightPosition(
chore: bump chromium to 93.0.4530.0 (master) (#29256) * chore: bump chromium in DEPS to 92.0.4512.6 * 2887336: [CaptureHandle][#2] Propagate CaptureHandleConfig in browser process https://chromium-review.googlesource.com/c/chromium/src/+/2887336 * refactor: base::Optional -> absl::optional * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4514.0 * 2899417: Make build work when enable_pdf is set to false. https://chromium-review.googlesource.com/c/chromium/src/+/2899417 * 2904731: use BrowserContext instead of Profile in PreconnectManager https://chromium-review.googlesource.com/c/chromium/src/+/2904731 * 2295749: fix: check IsSecureEventInputEnabled in constructor before setting SetPasswordInputEnabled to true https://chromium-review.googlesource.com/c/chromium/src/+/2295749 * 2893803: Add a GetWebView to RenderFrame. https://chromium-review.googlesource.com/c/chromium/src/+/2893803 * 2892345: Implement WebContents::ForEachRenderFrameHost https://chromium-review.googlesource.com/c/chromium/src/+/2892345 * chore: fixup patch indices * 2892048: Real instance methods for BrowserContext: remaining 5 methods. https://chromium-review.googlesource.com/c/chromium/src/+/2892048 * 2902821: [mojo] Don't require full header includes for referenced interfaces https://chromium-review.googlesource.com/c/chromium/src/+/2902821 * 2496500: Remove last deprecated extension Event ctor. https://chromium-review.googlesource.com/c/chromium/src/+/2496500 * chore: fixup malformed pepper support patch * chore: bump chromium in DEPS to 92.0.4515.0 * 2908461: Add CreateEmptyPrintPagesParamsPtr() inside print_view_manager_base.cc. https://chromium-review.googlesource.com/c/chromium/src/+/2908461 * 2880838: viz: add optional HDRMetadata to TransferableResource https://chromium-review.googlesource.com/c/chromium/src/+/2880838 * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4515.5 * chore: update patches * chore: bump chromium in DEPS to 92.0.4515.7 * chore: bump chromium in DEPS to 92.0.4515.9 * chore: bump chromium in DEPS to 93.0.4522.0 * chore: bump chromium in DEPS to 93.0.4523.0 * chore: bump chromium in DEPS to 93.0.4524.0 * chore: update patches * chore: enable_pak_file_integrity_checks was reverted * chore: update patches * refactor: base/optional was replaced with absl::optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::nullopt with absl::nullopt Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::make_optional with absl::make_optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace WorldScriptContext() with GetScriptContextFromWorldId Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893213 * chore: clean up left over opening namespace Refs: https://github.com/electron/electron/commit/95bfe6d08f65471394fb3005dbfa177cdf71210a * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace GetCurrentDisplayIterator with the hard checker GetCurrentDisplay This code looks suspicious but if the iterator was invalid before it will also be invalid now. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893191 * refactor: headers are now passed directly in extensions client Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2918906 * refactor: base::DictionaryValue::empty() has been removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2912424 * chore: add missing includes for network URLLoaderFactory Refs: unknown, probably a side effect of header changes * refactor: make convenience wrapper around AppendArg There is no converter FromV8 for base::StringPiece (apparently its not possible). So we now take in an std::string and use the construct for StringPiece to do implicit conversion. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2905544 * chore: add patch * chore: bump chromium in DEPS to 93.0.4525.0 * chore: update patches * refactor: CanResize has been de-virtualized Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2485774 * chore: update resource integrity patch * chore: add character encoding idl patch * chore: bump chromium in DEPS to 93.0.4526.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4527.0 * chore: bump chromium in DEPS to 93.0.4528.0 * chore: update patches * chore: update idl encoding patch * chore: bump chromium in DEPS to 93.0.4529.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4530.0 * chore: update patches * fix: only SetCanResize after the widget has been initialized * chore: add patch for vr on windows gn gen * spec: fix focus related tests on linux due to delay in focus swap * chore: remove new usages of base::Optional from main Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-03 08:05:04 +00:00
absl::optional<gfx::Point> position) {
traffic_light_position_ = std::move(position);
if (buttons_proxy_) {
[buttons_proxy_ setMargin:traffic_light_position_];
NotifyLayoutWindowControlsOverlay();
}
}
chore: bump chromium to 93.0.4530.0 (master) (#29256) * chore: bump chromium in DEPS to 92.0.4512.6 * 2887336: [CaptureHandle][#2] Propagate CaptureHandleConfig in browser process https://chromium-review.googlesource.com/c/chromium/src/+/2887336 * refactor: base::Optional -> absl::optional * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4514.0 * 2899417: Make build work when enable_pdf is set to false. https://chromium-review.googlesource.com/c/chromium/src/+/2899417 * 2904731: use BrowserContext instead of Profile in PreconnectManager https://chromium-review.googlesource.com/c/chromium/src/+/2904731 * 2295749: fix: check IsSecureEventInputEnabled in constructor before setting SetPasswordInputEnabled to true https://chromium-review.googlesource.com/c/chromium/src/+/2295749 * 2893803: Add a GetWebView to RenderFrame. https://chromium-review.googlesource.com/c/chromium/src/+/2893803 * 2892345: Implement WebContents::ForEachRenderFrameHost https://chromium-review.googlesource.com/c/chromium/src/+/2892345 * chore: fixup patch indices * 2892048: Real instance methods for BrowserContext: remaining 5 methods. https://chromium-review.googlesource.com/c/chromium/src/+/2892048 * 2902821: [mojo] Don't require full header includes for referenced interfaces https://chromium-review.googlesource.com/c/chromium/src/+/2902821 * 2496500: Remove last deprecated extension Event ctor. https://chromium-review.googlesource.com/c/chromium/src/+/2496500 * chore: fixup malformed pepper support patch * chore: bump chromium in DEPS to 92.0.4515.0 * 2908461: Add CreateEmptyPrintPagesParamsPtr() inside print_view_manager_base.cc. https://chromium-review.googlesource.com/c/chromium/src/+/2908461 * 2880838: viz: add optional HDRMetadata to TransferableResource https://chromium-review.googlesource.com/c/chromium/src/+/2880838 * chore: fixup patch indices * chore: bump chromium in DEPS to 92.0.4515.5 * chore: update patches * chore: bump chromium in DEPS to 92.0.4515.7 * chore: bump chromium in DEPS to 92.0.4515.9 * chore: bump chromium in DEPS to 93.0.4522.0 * chore: bump chromium in DEPS to 93.0.4523.0 * chore: bump chromium in DEPS to 93.0.4524.0 * chore: update patches * chore: enable_pak_file_integrity_checks was reverted * chore: update patches * refactor: base/optional was replaced with absl::optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::nullopt with absl::nullopt Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace all usages of base::make_optional with absl::make_optional Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace WorldScriptContext() with GetScriptContextFromWorldId Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893213 * chore: clean up left over opening namespace Refs: https://github.com/electron/electron/commit/95bfe6d08f65471394fb3005dbfa177cdf71210a * chore: add missing base::Contains include Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202 * refactor: replace GetCurrentDisplayIterator with the hard checker GetCurrentDisplay This code looks suspicious but if the iterator was invalid before it will also be invalid now. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893191 * refactor: headers are now passed directly in extensions client Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2918906 * refactor: base::DictionaryValue::empty() has been removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2912424 * chore: add missing includes for network URLLoaderFactory Refs: unknown, probably a side effect of header changes * refactor: make convenience wrapper around AppendArg There is no converter FromV8 for base::StringPiece (apparently its not possible). So we now take in an std::string and use the construct for StringPiece to do implicit conversion. Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2905544 * chore: add patch * chore: bump chromium in DEPS to 93.0.4525.0 * chore: update patches * refactor: CanResize has been de-virtualized Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2485774 * chore: update resource integrity patch * chore: add character encoding idl patch * chore: bump chromium in DEPS to 93.0.4526.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4527.0 * chore: bump chromium in DEPS to 93.0.4528.0 * chore: update patches * chore: update idl encoding patch * chore: bump chromium in DEPS to 93.0.4529.0 * chore: update patches * chore: bump chromium in DEPS to 93.0.4530.0 * chore: update patches * fix: only SetCanResize after the widget has been initialized * chore: add patch for vr on windows gn gen * spec: fix focus related tests on linux due to delay in focus swap * chore: remove new usages of base::Optional from main Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2021-06-03 08:05:04 +00:00
absl::optional<gfx::Point> NativeWindowMac::GetTrafficLightPosition() const {
return traffic_light_position_;
}
void NativeWindowMac::RedrawTrafficLights() {
if (buttons_proxy_ && !IsFullscreen())
[buttons_proxy_ redraw];
}
// In simpleFullScreen mode, update the frame for new bounds.
void NativeWindowMac::UpdateFrame() {
NSWindow* window = GetNativeWindow().GetNativeNSWindow();
NSRect fullscreenFrame = [window.screen frame];
[window setFrame:fullscreenFrame display:YES animate:YES];
}
void NativeWindowMac::SetTouchBar(
std::vector<gin_helper::PersistentDictionary> items) {
touch_bar_.reset([[ElectronTouchBar alloc]
initWithDelegate:window_delegate_.get()
window:this
settings:std::move(items)]);
[window_ setTouchBar:nil];
}
2017-03-01 00:08:12 +00:00
void NativeWindowMac::RefreshTouchBarItem(const std::string& item_id) {
if (touch_bar_ && [window_ touchBar])
[touch_bar_ refreshTouchBarItem:[window_ touchBar] id:item_id];
}
void NativeWindowMac::SetEscapeTouchBarItem(
gin_helper::PersistentDictionary item) {
if (touch_bar_ && [window_ touchBar])
[touch_bar_ setEscapeTouchBarItem:std::move(item)
forTouchBar:[window_ touchBar]];
}
void NativeWindowMac::SelectPreviousTab() {
[window_ selectPreviousTab:nil];
}
void NativeWindowMac::SelectNextTab() {
[window_ selectNextTab:nil];
}
void NativeWindowMac::MergeAllWindows() {
[window_ mergeAllWindows:nil];
}
void NativeWindowMac::MoveTabToNewWindow() {
[window_ moveTabToNewWindow:nil];
}
void NativeWindowMac::ToggleTabBar() {
[window_ toggleTabBar:nil];
}
bool NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
if (window_ == window->GetNativeWindow().GetNativeNSWindow()) {
return false;
} else {
[window_ addTabbedWindow:window->GetNativeWindow().GetNativeNSWindow()
ordered:NSWindowAbove];
}
return true;
}
void NativeWindowMac::SetAspectRatio(double aspect_ratio,
const gfx::Size& extra_size) {
NativeWindow::SetAspectRatio(aspect_ratio, extra_size);
// Reset the behaviour to default if aspect_ratio is set to 0 or less.
if (aspect_ratio > 0.0) {
NSSize aspect_ratio_size = NSMakeSize(aspect_ratio, 1.0);
if (has_frame())
[window_ setContentAspectRatio:aspect_ratio_size];
else
[window_ setAspectRatio:aspect_ratio_size];
} else {
[window_ setResizeIncrements:NSMakeSize(1.0, 1.0)];
}
}
void NativeWindowMac::PreviewFile(const std::string& path,
const std::string& display_name) {
preview_item_.reset([[ElectronPreviewItem alloc]
initWithURL:[NSURL fileURLWithPath:base::SysUTF8ToNSString(path)]
title:base::SysUTF8ToNSString(display_name)]);
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil];
}
void NativeWindowMac::CloseFilePreview() {
if ([QLPreviewPanel sharedPreviewPanelExists]) {
[[QLPreviewPanel sharedPreviewPanel] close];
}
}
gfx::Rect NativeWindowMac::ContentBoundsToWindowBounds(
const gfx::Rect& bounds) const {
if (has_frame()) {
gfx::Rect window_bounds(
[window_ frameRectForContentRect:bounds.ToCGRect()]);
int frame_height = window_bounds.height() - bounds.height();
window_bounds.set_y(window_bounds.y() - frame_height);
return window_bounds;
} else {
return bounds;
}
}
gfx::Rect NativeWindowMac::WindowBoundsToContentBounds(
const gfx::Rect& bounds) const {
if (has_frame()) {
gfx::Rect content_bounds(
[window_ contentRectForFrameRect:bounds.ToCGRect()]);
int frame_height = bounds.height() - content_bounds.height();
content_bounds.set_y(content_bounds.y() + frame_height);
return content_bounds;
} else {
return bounds;
}
}
void NativeWindowMac::NotifyWindowEnterFullScreen() {
NativeWindow::NotifyWindowEnterFullScreen();
// Restore the window title under fullscreen mode.
if (buttons_proxy_)
[window_ setTitleVisibility:NSWindowTitleVisible];
}
void NativeWindowMac::NotifyWindowLeaveFullScreen() {
NativeWindow::NotifyWindowLeaveFullScreen();
// Restore window buttons.
if (buttons_proxy_ && window_button_visibility_.value_or(true)) {
[buttons_proxy_ redraw];
[buttons_proxy_ setVisible:YES];
}
}
void NativeWindowMac::NotifyWindowWillEnterFullScreen() {
UpdateVibrancyRadii(true);
}
void NativeWindowMac::NotifyWindowWillLeaveFullScreen() {
if (buttons_proxy_) {
// Hide window title when leaving fullscreen.
[window_ setTitleVisibility:NSWindowTitleHidden];
// Hide the container otherwise traffic light buttons jump.
[buttons_proxy_ setVisible:NO];
}
UpdateVibrancyRadii(false);
}
void NativeWindowMac::SetActive(bool is_key) {
is_active_ = is_key;
}
bool NativeWindowMac::IsActive() const {
return is_active_;
}
void NativeWindowMac::Cleanup() {
DCHECK(!IsClosed());
ui::NativeTheme::GetInstanceForNativeUi()->RemoveObserver(this);
display::Screen::GetScreen()->RemoveObserver(this);
if (wheel_event_monitor_) {
[NSEvent removeMonitor:wheel_event_monitor_];
wheel_event_monitor_ = nil;
}
}
void NativeWindowMac::OverrideNSWindowContentView() {
// When using `views::Widget` to hold WebContents, Chromium would use
// `BridgedContentView` as content view, which does not support draggable
// regions. In order to make draggable regions work, we have to replace the
// content view with a simple NSView.
if (has_frame()) {
container_view_.reset(
[[ElectronAdaptedContentView alloc] initWithShell:this]);
} else {
container_view_.reset([[FullSizeContentView alloc] init]);
[container_view_ setFrame:[[[window_ contentView] superview] bounds]];
}
[container_view_
setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[window_ setContentView:container_view_];
AddContentViewLayers();
}
void NativeWindowMac::SetStyleMask(bool on, NSUInteger flag) {
// Changing the styleMask of a frameless windows causes it to change size so
// we explicitly disable resizing while setting it.
ScopedDisableResize disable_resize;
if (on)
[window_ setStyleMask:[window_ styleMask] | flag];
else
[window_ setStyleMask:[window_ styleMask] & (~flag)];
// Change style mask will make the zoom button revert to default, probably
// a bug of Cocoa or macOS.
SetMaximizable(maximizable_);
}
void NativeWindowMac::SetCollectionBehavior(bool on, NSUInteger flag) {
if (on)
[window_ setCollectionBehavior:[window_ collectionBehavior] | flag];
else
[window_ setCollectionBehavior:[window_ collectionBehavior] & (~flag)];
// Change collectionBehavior will make the zoom button revert to default,
// probably a bug of Cocoa or macOS.
SetMaximizable(maximizable_);
}
views::View* NativeWindowMac::GetContentsView() {
return root_view_.get();
}
bool NativeWindowMac::CanMaximize() const {
return maximizable_;
}
void NativeWindowMac::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) {
chore: bump chromium to 103.0.5046.0 (main) (#33906) * chore: bump chromium in DEPS to 103.0.5020.0 * chore: bump chromium in DEPS to 103.0.5022.0 * chore: bump chromium in DEPS to 103.0.5024.0 * chore: update patches * 3587410: [Printing] Remove JobEventDetails Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587410 * chore: bump chromium in DEPS to 103.0.5026.0 * chore: update patches * 3577218: WebUI: Delete webui_resources.grd and related GN targets. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3577218 * chore: bump chromium in DEPS to 103.0.5028.0 * chore: update patches * 3579297: Convert UpdatePrintSettings() to use non-deprecated base::Value APIs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3579297 * 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3581708: Restore original display when moving from tab-fullscreen to browser-fullscreen. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3581708 * chore: fix authorization flags lint error * 3583363: Remove net wrappers around base/strings/escape.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * fixup! 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3587589: Reland "Propagate the MIME type from DownloadTargetDeterminer to DownloadItem" Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587589 * 3584006: Remove IsRenderViewLive from content public Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3584006 * 3596174: [api] Remove APIs for resurrecting finalizers Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3596174 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: bump chromium in DEPS to 103.0.5030.0 * chore: update patches * chore: bump chromium in DEPS to 103.0.5032.0 * chore: bump chromium in DEPS to 103.0.5034.0 * chore: bump chromium in DEPS to 103.0.5036.0 * chore: update patches * 3586363: Introduce PrintRenderFrame.PrintWithParams() for batch printing to PDF Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3586363 * 3593199: Remove content::PermissionType references and replace them with blink::PermissionType Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3593199 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: lint * chore: bump chromium in DEPS to 103.0.5038.0 * chore: update patches * fixup! 3560622: serial: Add SerialPort.forget() method * 3606495: mac screen capture: add metric Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3606495 * chore: bump chromium in DEPS to 103.0.5040.0 * chore: update patches * 3590840: Add IPs to DnsOverHttpsServerConfig https://chromium-review.googlesource.com/c/chromium/src/+/3590840 * stub functions for ElectronSerialDelegate and SerialChooserController to fix link * 3566412: [base] Remove base/android dependency on post_task.h and officially remove post_task.h! Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 3347944: [content] No longer hand-off whole MainFunctionParams to BrowserMainParts Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3347944 * fixup! 3566412: [base] Remove base/android dependency on post_task.h and off… e3ea3e1 …icially remove post_task.h! * chore: update process_singleton patches for content::GetIOThreadTaskRunner({}) Ref: 2015655: [BrowserThread] Migrate co/pub/br and co/br/scheduler to the new API | https://chromium-review.googlesource.com/c/chromium/src/+/2015655 * chore: migrate base::DeleteSoon to content::GetUIThreadTaskRunner({})->DeleteSoon Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * chore: remove duplicate functions for RevokePortPermissionWebInitiated & GetPortInfo * chore: migrate Linux/Windows methods off of post_task.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 64908: Stop building legacy SwiftShader GL in Chromium https://swiftshader-review.googlesource.com/c/SwiftShader/+/64908 * 3573245: Added Themed versions of RoundedRectBackground and RoundedRectBorder. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3573245 * chore: bump chromium in DEPS to 103.0.5042.0 * chore: update patches * 3571804: [api] Advance API deprecation for V8 version v10.2 https://chromium-review.googlesource.com/c/v8/v8/+/3571804 * fixup! 3571804: [api] Advance API deprecation for V8 version v10.2 * build: fix run-clang-format extension matching * lint * fix windows build * how is clang-format still not working for me * chore: update patches * 3623985: Replace ad-hoc SetPublicFirstPartySets calls with method in ContentBrowserClient. https://chromium-review.googlesource.com/c/chromium/src/+/3623985 * no need to implement WillProvidePublicFirstPartySets; the default is false * 3601036: [QT] Introduce ui/views/linux_ui/linux_ui_factory.* https://chromium-review.googlesource.com/c/chromium/src/+/3601036 * 3583363: Remove net wrappers around base/strings/escape.h https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * lint * chore: bump chromium in DEPS to 103.0.5044.0 * fix conflicts * chore: update patches * upgrade nan * pin version of nan in tests * replace my hacky deprecated override fix with the fix from upstream * revert runtime dcheck in v8 * pin nan version at root too * refactor: tell gyp to use c++17 when building with our node * Revert "refactor: tell gyp to use c++17 when building with our node" This reverts commit 41a03a5799a8f40f31555d73d20ea865acfcd192. * Undo the reversion of 41a03a5799a8f40f31555d73d20ea865acfcd192. This reverts commit 54440abc598153bd7e259be4a908f0ecc0b33348. * disable sequential/test-cpu-prof-kill for now * also sequential/test-diagnostic-dir-cpu-prof Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-05-17 16:48:40 +00:00
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce(&NativeWindow::RedrawTrafficLights, GetWeakPtr()));
}
void NativeWindowMac::AddContentViewLayers() {
// Make sure the bottom corner is rounded for non-modal windows:
// http://crbug.com/396264.
if (!is_modal()) {
// For normal window, we need to explicitly set layer for contentView to
// make setBackgroundColor work correctly.
// There is no need to do so for frameless window, and doing so would make
// titleBarStyle stop working.
if (has_frame()) {
base::scoped_nsobject<CALayer> background_layer([[CALayer alloc] init]);
[background_layer
setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable];
[[window_ contentView] setLayer:background_layer];
}
[[window_ contentView] setWantsLayer:YES];
}
if (!has_frame()) {
// In OSX 10.10, adding subviews to the root view for the NSView hierarchy
// produces warnings. To eliminate the warnings, we resize the contentView
// to fill the window, and add subviews to that.
// http://crbug.com/380412
if (!original_set_frame_size) {
Class cl = [[window_ contentView] class];
original_set_frame_size = class_replaceMethod(
cl, @selector(setFrameSize:), (IMP)SetFrameSize, "v@:{_NSSize=ff}");
original_view_did_move_to_superview =
class_replaceMethod(cl, @selector(viewDidMoveToSuperview),
(IMP)ViewDidMoveToSuperview, "v@:");
[[window_ contentView] viewDidMoveToWindow];
}
}
}
void NativeWindowMac::InternalSetWindowButtonVisibility(bool visible) {
[[window_ standardWindowButton:NSWindowCloseButton] setHidden:!visible];
[[window_ standardWindowButton:NSWindowMiniaturizeButton] setHidden:!visible];
[[window_ standardWindowButton:NSWindowZoomButton] setHidden:!visible];
}
2018-04-20 18:47:04 +00:00
void NativeWindowMac::InternalSetParentWindow(NativeWindow* parent,
bool attach) {
2017-09-14 05:43:22 +00:00
if (is_modal())
return;
NativeWindow::SetParentWindow(parent);
// Do not remove/add if we are already properly attached.
if (attach && parent &&
[window_ parentWindow] == parent->GetNativeWindow().GetNativeNSWindow())
2017-09-14 05:43:22 +00:00
return;
// Remove current parent window.
if ([window_ parentWindow])
[[window_ parentWindow] removeChildWindow:window_];
// Set new parent window.
// Note that this method will force the window to become visible.
if (parent && attach) {
// Attaching a window as a child window resets its window level, so
// save and restore it afterwards.
NSInteger level = window_.level;
[parent->GetNativeWindow().GetNativeNSWindow()
addChildWindow:window_
ordered:NSWindowAbove];
[window_ setLevel:level];
}
2017-09-14 05:43:22 +00:00
}
void NativeWindowMac::SetForwardMouseMessages(bool forward) {
[window_ setAcceptsMouseMovedEvents:forward];
}
gfx::Rect NativeWindowMac::GetWindowControlsOverlayRect() {
if (titlebar_overlay_ && buttons_proxy_ &&
window_button_visibility_.value_or(true)) {
NSRect buttons = [buttons_proxy_ getButtonsContainerBounds];
gfx::Rect overlay;
overlay.set_width(GetContentSize().width() - NSWidth(buttons));
if ([buttons_proxy_ useCustomHeight]) {
overlay.set_height(titlebar_overlay_height());
} else {
overlay.set_height(NSHeight(buttons));
}
if (!base::i18n::IsRTL())
overlay.set_x(NSMaxX(buttons));
return overlay;
}
return gfx::Rect();
}
2013-04-12 07:04:46 +00:00
// static
NativeWindow* NativeWindow::Create(const gin_helper::Dictionary& options,
2018-04-08 11:20:43 +00:00
NativeWindow* parent) {
return new NativeWindowMac(options, parent);
2013-04-12 07:04:46 +00:00
}
} // namespace electron