Skip to content

Commit

Permalink
refactor: remove InspectableWebContentsViewMac in favor of the Views …
Browse files Browse the repository at this point in the history
…version
  • Loading branch information
nornagon committed Feb 13, 2024
1 parent 5dfa9e3 commit da25562
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 609 deletions.
3 changes: 1 addition & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ source_set("electron_lib") {
"//ui/native_theme",
"//ui/shell_dialogs",
"//ui/views",
"//ui/views/controls/webview",
"//v8",
"//v8:v8_libplatform",
]
Expand Down Expand Up @@ -637,7 +638,6 @@ source_set("electron_lib") {
"//ui/gtk:gtk_config",
"//ui/linux:linux_ui",
"//ui/linux:linux_ui_factory",
"//ui/views/controls/webview",
"//ui/wm",
]
if (ozone_platform_x11) {
Expand Down Expand Up @@ -666,7 +666,6 @@ source_set("electron_lib") {
deps += [
"//components/crash/core/app:crash_export_thunks",
"//ui/native_theme:native_theme_browser",
"//ui/views/controls/webview",
"//ui/wm",
"//ui/wm/public",
]
Expand Down
8 changes: 2 additions & 6 deletions filenames.gni
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,8 @@ filenames = {
"shell/browser/osr/osr_web_contents_view_mac.mm",
"shell/browser/relauncher_mac.cc",
"shell/browser/ui/certificate_trust_mac.mm",
"shell/browser/ui/cocoa/delayed_native_view_host.h",
"shell/browser/ui/cocoa/delayed_native_view_host.mm",
"shell/browser/ui/cocoa/electron_bundle_mover.h",
"shell/browser/ui/cocoa/electron_bundle_mover.mm",
"shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h",
"shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm",
"shell/browser/ui/cocoa/electron_menu_controller.h",
"shell/browser/ui/cocoa/electron_menu_controller.mm",
"shell/browser/ui/cocoa/electron_native_widget_mac.h",
Expand All @@ -187,8 +183,6 @@ filenames = {
"shell/browser/ui/cocoa/window_buttons_proxy.mm",
"shell/browser/ui/drag_util_mac.mm",
"shell/browser/ui/file_dialog_mac.mm",
"shell/browser/ui/inspectable_web_contents_view_mac.h",
"shell/browser/ui/inspectable_web_contents_view_mac.mm",
"shell/browser/ui/message_box_mac.mm",
"shell/browser/ui/tray_icon_cocoa.h",
"shell/browser/ui/tray_icon_cocoa.mm",
Expand All @@ -204,6 +198,8 @@ filenames = {
"shell/common/node_bindings_mac.cc",
"shell/common/node_bindings_mac.h",
"shell/common/platform_util_mac.mm",
"shell/browser/ui/views/inspectable_web_contents_view_views.cc",
"shell/browser/ui/views/inspectable_web_contents_view_views.h",
]

lib_sources_views = [
Expand Down
15 changes: 0 additions & 15 deletions shell/browser/api/electron_api_web_contents_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,14 @@
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"

#if BUILDFLAG(IS_MAC)
#include "shell/browser/ui/cocoa/delayed_native_view_host.h"
#endif

namespace electron::api {

WebContentsView::WebContentsView(v8::Isolate* isolate,
gin::Handle<WebContents> web_contents)
#if BUILDFLAG(IS_MAC)
: View(new DelayedNativeViewHost(web_contents->inspectable_web_contents()
->GetView()
->GetNativeView())),
#else
: View(web_contents->inspectable_web_contents()->GetView()->GetView()),
#endif
web_contents_(isolate, web_contents.ToV8()),
api_web_contents_(web_contents.get()) {
#if !BUILDFLAG(IS_MAC)
// On macOS the View is a newly-created |DelayedNativeViewHost| and it is our
// responsibility to delete it. On other platforms the View is created and
// managed by InspectableWebContents.
set_delete_view(false);
#endif
view()->SetProperty(
views::kFlexBehaviorKey,
views::FlexSpecification(views::MinimumFlexSizeRule::kScaleToMinimum,
Expand Down
34 changes: 0 additions & 34 deletions shell/browser/ui/cocoa/delayed_native_view_host.h

This file was deleted.

44 changes: 0 additions & 44 deletions shell/browser/ui/cocoa/delayed_native_view_host.mm

This file was deleted.

55 changes: 0 additions & 55 deletions shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h

This file was deleted.

0 comments on commit da25562

Please sign in to comment.