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

Code before:
}

void WebContents::OnFirstNonEmptyLayout(
    content::RenderFrameHost* render_frame_host) {
  if (render_frame_host == web_contents()->GetPrimaryMainFrame()) {
    Emit("ready-to-show");
  }
}

void WebContents::DraggableRegionsChanged(
    const std::vector<blink::mojom::DraggableRegionPtr>& regions,
    content::WebContents* contents) {
  if (owner_window() && owner_window()->has_frame()) {
    return;
  }

  draggable_region_ = DraggableRegionsToSkRegion(regions);
}

void WebContents::PrintCrossProcessSubframe(
    content::WebContents* web_contents,
    const gfx::Rect& rect,
    int document_cookie,
    content::RenderFrameHost* subframe_host) const {
  auto* client = printing::PrintCompositeClient::FromWebContents(web_contents);
  if (client) {
    client->PrintCrossProcessSubframe(rect, document_cookie, subframe_host);
  }
}

SkRegion* WebContents::draggable_region() {
  return g_disable_draggable_regions ? nullptr : draggable_region_.get();
}

void WebContents::DidStartNavigation(
    content::NavigationHandle* navigation_handle) {
  EmitNavigationEvent("did-start-navigation", navigation_handle);
}

void WebContents::DidRedirectNavigation(
    content::NavigationHandle* navigation_handle) {
  EmitNavigationEvent("did-redirect-navigation", navigation_handle);
}

void WebContents::ReadyToCommitNavigation(
    content::NavigationHandle* navigation_handle) {
  // Don't focus content in an inactive window.
  if (!owner_window())
    return;
#if BUILDFLAG(IS_MAC)
  if (!owner_window()->IsActive())

Review comment (suggestion):
_(nit, style)_

This can be shortened:

```suggestion
  if (auto* client = printing::PrintCompositeClient::FromWebContents(web_contents)) {
```

Code after:
}

void WebContents::OnFirstNonEmptyLayout(
    content::RenderFrameHost* render_frame_host) {
  if (render_frame_host == web_contents()->GetPrimaryMainFrame()) {
    Emit("ready-to-show");
  }
}

void WebContents::DraggableRegionsChanged(
    const std::vector<blink::mojom::DraggableRegionPtr>& regions,
    content::WebContents* contents) {
  if (owner_window() && owner_window()->has_frame()) {
    return;
  }

  draggable_region_ = DraggableRegionsToSkRegion(regions);
}

void WebContents::PrintCrossProcessSubframe(
    content::WebContents* web_contents,
    const gfx::Rect& rect,
    int document_cookie,
    content::RenderFrameHost* subframe_host) const {
  if (auto* client =
          printing::PrintCompositeClient::FromWebContents(web_contents)) {
    client->PrintCrossProcessSubframe(rect, document_cookie, subframe_host);
  }
}

SkRegion* WebContents::draggable_region() {
  return g_disable_draggable_regions ? nullptr : draggable_region_.get();
}

void WebContents::DidStartNavigation(
    content::NavigationHandle* navigation_handle) {
  EmitNavigationEvent("did-start-navigation", navigation_handle);
}

void WebContents::DidRedirectNavigation(
    content::NavigationHandle* navigation_handle) {
  EmitNavigationEvent("did-redirect-navigation", navigation_handle);
}

void WebContents::ReadyToCommitNavigation(
    content::NavigationHandle* navigation_handle) {
  // Don't focus content in an inactive window.
  if (!owner_window())
    return;
#if BUILDFLAG(IS_MAC)
  if (!owner_window()->IsActive())