New issue
Advanced search Search tips

Issue 893719 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 18
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 859152



Sign in to add a comment

RemoteMacViews: Make gfx::NativeView and gfx::NativeWindow not be NSView and NSWindow

Project Member Reported by ccameron@chromium.org, Oct 9

Issue description

In RemoteMacViews (issue 859152), NSWindows and NSViews are in the "viewer" (app shim) process.

We currently pass around handles referring to views and windows using the gfx::NativeView and gfx::NativeWindow types.

RemoteMacViews creates doppelgänger NSView or NSWindow objects for this tracking. These NSViews and NSWindows are never to be actually shown, but can be used to look up the original NativeWidgetMac, WebContentsView, or RenderWidgetHostView that they came from.

Problems arise when functions call Cocoa methods on these objects, and expect them to behave as normal NSViews and NSWindows (see, e.g, crrev.com/597664).

This bug tracks re-defining these objects in such a way that we
- always explicitly know when we're casting to an NSView or an NSWindow
- provide an interface to simple functionality (e.g, as provided by crrev.com/597664)
- may remove the doppelgänger objects and the confusion that they may cause

 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 18

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/359c61e2a6ba3835600437cabb939608413f9f59

commit 359c61e2a6ba3835600437cabb939608413f9f59
Author: Christopher Cameron <ccameron@chromium.org>
Date: Thu Oct 18 08:06:20 2018

Make gfx::NativeView and gfx::NativeWindow not be NSView and NSWindow

It is no longer the case that a gfx::NativeView/Window refers to an
NSView/Window in the same process. Because of RemoteMacViews, they
may refer to an NSView/Window that is in another process.

Make gfx::NativeView/Window be a pass-by-value struct, and make
converting from a gfx::NativeView/Window to an NSView/Window require
an explicit conversion function.

Mechanically add this conversion as needed. Also define a
gfx::kNullNativeView/Window to match other types.

Allow some temporary sloppiness to keep the patch size manageable:
- Provide a non-explicit constructor that takes a NSView/Window. This
  will be removed in a follow-on patch (which will mechanically add
  constructors).
- Provide a bool-cast operator to allow if-statements to still compile.
  These statements can later be changed to comparison with the
  gfx::kNullNativeView/Window.

R=avi, ellyjones
TBR=jochen (OWNER of remaining files)

Bug:  893719 
Change-Id: I39ccac1fd117fe0660fcc21bcb276c8d90dbe550
Reviewed-on: https://chromium-review.googlesource.com/c/1270343
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600685}
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/app_controller_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/app_controller_mac_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/download/download_file_picker.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/download/drag_download_item_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/global_keyboard_shortcuts_mac_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/native_window_notification_source.h
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/platform_util_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/printing/print_error_dialog.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/renderer_host/pepper/monitor_finder_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/spellchecker/spellcheck_mac_view_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/autofill/autofill_popup_controller_impl_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/applescript/window_applescript.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/browser_window_mac_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller_views.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_cocoa.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/native_window_tracker_cocoa.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/permission_bubble/permission_bubble_cocoa_interactive_uitest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac_cocoa_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/share_menu_controller.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/share_menu_controller_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/single_web_contents_dialog_manager_cocoa.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/tab_contents/chrome_web_contents_view_delegate_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/touchbar/browser_window_touch_bar_controller_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/cocoa/web_contents_modal_dialog_host_cocoa.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/test/test_browser_dialog.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/certificate_viewer_mac_browsertest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/certificate_viewer_mac_views.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/frame/browser_frame_mac.h
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/frame/browser_frame_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/permission_bubble/permission_bubble_views_interactive_uitest_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/policy/enterprise_startup_dialog_mac_util.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/status_bubble_views_browsertest_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/views/toolbar/browser_action_test_util_views_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/web_contents_sizer.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/browser/ui/window_sizer/window_sizer_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/chrome/test/base/interactive_test_utils_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/components/constrained_window/native_web_contents_modal_dialog_manager_views_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/components/web_modal/web_contents_modal_dialog_manager_unittest.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/content/browser/media/capture/mouse_cursor_overlay_controller_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/content/browser/renderer_host/native_web_keyboard_event_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/content/browser/web_contents/web_contents_view_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/content/browser/web_contents/web_contents_view_mac_unittest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/content/public/test/content_browser_test_utils_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/content/shell/browser/shell_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/content/shell/browser/shell_web_contents_view_delegate_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/extensions/shell/browser/shell_native_app_window_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/headless/lib/browser/headless_browser_impl_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/printing/printing_context_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/accessibility/platform/ax_platform_node_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/base/cocoa/bubble_closer.h
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/base/cocoa/bubble_closer.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/base/cocoa/focus_window_set.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/base/test/ui_controls_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/display/mac/screen_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/gfx/BUILD.gn
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/gfx/native_widget_types.h
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/shell_dialogs/select_file_dialog_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/snapshot/snapshot_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/BUILD.gn
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/accessibility/view_ax_platform_node_delegate_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/bubble/bubble_dialog_delegate_view.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/cocoa/bridged_native_widget_host_impl.h
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/cocoa/bridged_native_widget_host_impl.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/cocoa/bridged_native_widget_interactive_uitest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/cocoa/bridged_native_widget_unittest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/cocoa/drag_drop_client_mac_unittest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/menu/menu_closure_animation_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/menu/menu_host.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/menu/menu_pre_target_handler_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/menu/menu_runner_cocoa_unittest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/menu/menu_runner_impl_cocoa.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/menu/menu_runner_unittest.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/native/native_view_host_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/native/native_view_host_mac_unittest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/tabbed_pane/tabbed_pane_accessibility_mac_unittest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/controls/views_text_services_context_menu_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/event_monitor_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/focus/focus_manager_unittest.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/test/event_generator_delegate_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/test/platform_test_helper_cocoa.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/test/widget_test_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/view_unittest_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/widget/ax_native_widget_mac_unittest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/widget/native_widget_mac.h
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/widget/native_widget_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/widget/native_widget_mac_interactive_uitest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/widget/native_widget_mac_unittest.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/widget/native_widget_unittest.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/widget/widget_interactive_uitest.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/widget/widget_unittest.cc
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views/widget/widget_utils_mac.mm
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views_bridge_mac/bridged_native_widget_impl.h
[modify] https://crrev.com/359c61e2a6ba3835600437cabb939608413f9f59/ui/views_bridge_mac/bridged_native_widget_impl.mm

Status: Fixed (was: Untriaged)

Sign in to add a comment