How Chromium Blends Views with Native macOS Window Controls
Chromium uses a custom, cross-platform C++ toolkit called Views to render its user interface, allowing it to share the vast majority of its UI code across Windows, Linux, ChromeOS, and macOS. However, macOS users expect applications to support deeply integrated system features, such as the "traffic light" window controls and native fullscreen Spaces. This article explains how Chromium bridges its custom Views layout engine with Apple’s native AppKit framework to deliver a browser that looks and behaves like a native Mac application while rendering its own custom interface.
The Bridge Between Views and AppKit
Unlike traditional macOS applications that build interfaces using
Apple's native NSView hierarchy, Chromium constructs its
interface using a tree of views::View objects rendered via
the Skia graphics library.
To display this custom-drawn UI on a Mac, Chromium uses an
architectural layer called NativeWidgetMac. This class acts
as a bridge, wrapping a cross-platform views::Widget around
a real macOS NSWindow and a single root NSView
(known as BridgedContentView). The
BridgedContentView takes up the entire window, receives
native macOS mouse, keyboard, and trackpad events from AppKit, and
translates them into events that the cross-platform Views toolkit can
understand.
Extending Content into the Titlebar
Standard macOS windows have a dedicated titlebar at the top, separated from the application content below it. Chromium places its tab strip directly inside this titlebar area to save vertical screen space.
To achieve this without losing native window behaviors, Chromium
subclasses NSWindow and applies the
NSWindowStyleMaskFullSizeContentView style mask alongside
the titlebarAppearsTransparent property. These native
AppKit configurations instruct macOS to make the standard titlebar
invisible and extend Chromium's BridgedContentView all the
way to the top edge of the window. The Views toolkit then draws the
custom tab strip background and tabs directly into that top region.
Repositioning the Native Traffic Light Buttons
Even though Chromium draws its own tab strip, the red, yellow, and
green window control buttons (close, minimize, and zoom/fullscreen) are
genuine AppKit NSButton instances. Chromium cannot simply
draw fake buttons using Skia; doing so would break system-level
features, such as the simultaneous hover state across all three buttons
and the native macOS window-tiling menu that appears when hovering over
the green fullscreen button.
To integrate these native buttons into the custom Views layout, Chromium does the following:
- It retrieves the native button references from the window using the
[NSWindow standardWindowButton:]API. - It embeds these buttons into a specialized container view.
- Whenever the window resizes or the UI scale changes, the Views layout engine calculates the exact space needed for the controls and manually overrides the native AppKit frame coordinates of the buttons, ensuring they stay vertically centered alongside the custom-drawn tabs.
Handling Native Fullscreen Spaces
When a user clicks the green traffic light button on macOS, the
operating system moves the window into its own dedicated virtual desktop
(Space) and hides the menu bar and window controls. Chromium supports
this by implementing standard NSWindowDelegate fullscreen
transition methods.
When macOS initiates a transition to fullscreen, it sends a
windowWillEnterFullScreen: notification to Chromium's
window delegate. The NativeWidgetMac bridge intercepts this
notification and informs the cross-platform Views toolkit. Views then
dynamically updates the tab strip layout, removing the empty padding on
the left side of the tab strip that was previously reserved for the
traffic light buttons.
Coordinating the Fullscreen Toolbar Reveal
In a native macOS fullscreen Space, moving the cursor to the very top of the screen causes the system menu bar and the window's titlebar (containing the traffic light buttons) to slide down over the content.
Because Chromium’s tab strip and address bar are rendered inside the
custom BridgedContentView rather than a native titlebar,
Chromium must synchronize its UI with the operating system's slide-down
animation. It accomplishes this by attaching an invisible
NSToolbar to the NSWindow and monitoring
AppKit's titlebar reveal progress. When the user moves their mouse to
the top of the screen in fullscreen mode, macOS lowers the transparent
native titlebar frame to reveal the traffic light buttons.
Simultaneously, Chromium reads this animation offset and shifts its
Views-rendered tab strip and toolbar downward, maintaining the illusion
of a unified, native macOS toolbar.