Repository: electron/electron
File: shell/browser/native_window_views.cc (C++)

Code before:
  // property is the window handle whereas the window_id property is an id
  // given by a map containing all aura instances.
  result.window_id = aura_id;
  return result;
}

gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() const {
  if (GetNativeWindow() && GetNativeWindow()->GetHost())
    return GetNativeWindow()->GetHost()->GetAcceleratedWidget();
  else
    return gfx::kNullAcceleratedWidget;
}

NativeWindowHandle NativeWindowViews::GetNativeWindowHandle() const {
  return GetAcceleratedWidget();
}

gfx::Rect NativeWindowViews::LogicalToWidgetBounds(
    const gfx::Rect& bounds) const {
  gfx::Rect widget_bounds(bounds);
  const gfx::Insets frame_insets = GetRestoredFrameBorderInsets();
  if (!frame_insets.IsEmpty()) {
    widget_bounds.Outset(
        gfx::Outsets::TLBR(frame_insets.top(), frame_insets.left(),
                           frame_insets.bottom(), frame_insets.right()));
  }
  return widget_bounds;
}

gfx::Rect NativeWindowViews::WidgetToLogicalBounds(
    const gfx::Rect& bounds) const {
  gfx::Rect logical_bounds(bounds);
  logical_bounds.Inset(GetRestoredFrameBorderInsets());
  return logical_bounds;
}

gfx::Rect NativeWindowViews::ContentBoundsToWindowBounds(
    const gfx::Rect& bounds) const {
  if (!has_frame() && !has_client_frame())
    return bounds;

  gfx::Rect window_bounds(bounds);
  if (widget()->non_client_view()) {
#if BUILDFLAG(IS_WIN)
    HWND hwnd = GetAcceleratedWidget();
    gfx::Rect dpi_bounds = DIPToScreenRect(hwnd, bounds);
    window_bounds = ScreenToDIPRect(
        hwnd, widget()->non_client_view()->GetWindowBoundsForClientBounds(
                  dpi_bounds));
#else
    window_bounds = WidgetToLogicalBounds(

Review comment (suggestion):
_(nit)_ we check for `frame_insets.IsEmpty()` here but not in the reverse method `WidgetToLogicalBounds()`. Whether we keep the check or not, both methods should do the same thing so that it doesn't give a misleading impression that there's some subtle difference between the two.

I'm fine which either choice but have a slight preference for just removing the check on the rationale that it's one less logic branch to think about in our code. 

Code after:
  // Confusing but this is how content::DesktopMediaID is designed. The id
  // property is the window handle whereas the window_id property is an id
  // given by a map containing all aura instances.
  result.window_id = aura_id;
  return result;
}

gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() const {
  if (GetNativeWindow() && GetNativeWindow()->GetHost())
    return GetNativeWindow()->GetHost()->GetAcceleratedWidget();
  else
    return gfx::kNullAcceleratedWidget;
}

NativeWindowHandle NativeWindowViews::GetNativeWindowHandle() const {
  return GetAcceleratedWidget();
}

gfx::Rect NativeWindowViews::LogicalToWidgetBounds(
    const gfx::Rect& bounds) const {
  gfx::Rect widget_bounds(bounds);
  const gfx::Insets frame_insets = GetRestoredFrameBorderInsets();
  widget_bounds.Outset(
      gfx::Outsets::TLBR(frame_insets.top(), frame_insets.left(),
                         frame_insets.bottom(), frame_insets.right()));

  return widget_bounds;
}

gfx::Rect NativeWindowViews::WidgetToLogicalBounds(
    const gfx::Rect& bounds) const {
  gfx::Rect logical_bounds(bounds);
  logical_bounds.Inset(GetRestoredFrameBorderInsets());
  return logical_bounds;
}

gfx::Rect NativeWindowViews::ContentBoundsToWindowBounds(
    const gfx::Rect& bounds) const {
  if (!has_frame())
    return bounds;

  gfx::Rect window_bounds(bounds);

  if (auto* ncv = widget()->non_client_view()) {
#if BUILDFLAG(IS_WIN)
    HWND hwnd = GetAcceleratedWidget();
    gfx::Rect dpi_bounds = DIPToScreenRect(hwnd, bounds);
    window_bounds =
        ScreenToDIPRect(hwnd, ncv->GetWindowBoundsForClientBounds(dpi_bounds));
#else
    window_bounds = WidgetToLogicalBounds(