Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
# 3.24 for FetchContent's DOWNLOAD_EXTRACT_TIMESTAMP, used by the Sparkle fetch
# below. On 3.21-3.23 that keyword is unknown and configuring fails outright.
cmake_minimum_required(VERSION 3.24)

# Liquid Glass is an SDK-linked behavior as well as a runtime API. Resolve and
# freeze the active macOS 26 SDK before project() performs its compiler checks;
# silently falling back to an older SDK would compile out the native surface
# types even when the app later runs on macOS 26. Keep the deployment target at
# 12 so every use of the new API remains weak-linked behind @available.
execute_process(
COMMAND /usr/bin/xcrun --sdk macosx --show-sdk-path
OUTPUT_VARIABLE BRO_MACOS_SDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE BRO_MACOS_SDK_RESULT
)
execute_process(
COMMAND /usr/bin/xcrun --sdk macosx --show-sdk-version
OUTPUT_VARIABLE BRO_MACOS_SDK_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE BRO_MACOS_SDK_VERSION_RESULT
)
if(NOT BRO_MACOS_SDK_RESULT EQUAL 0 OR
NOT BRO_MACOS_SDK_VERSION_RESULT EQUAL 0 OR
BRO_MACOS_SDK_PATH STREQUAL "")
message(FATAL_ERROR "A macOS 26 SDK is required to build Bro Computer")
endif()
if(BRO_MACOS_SDK_VERSION VERSION_LESS 26 OR
NOT BRO_MACOS_SDK_VERSION VERSION_LESS 27)
message(FATAL_ERROR
"Bro Computer must link the macOS 26 SDK for Liquid Glass; xcrun resolved ${BRO_MACOS_SDK_VERSION}")
endif()
set(CMAKE_OSX_SYSROOT "${BRO_MACOS_SDK_PATH}" CACHE PATH
"Pinned macOS 26 SDK used for native Liquid Glass" FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" CACHE STRING
"Oldest supported macOS version" FORCE)

project(Bro)

include(CTest)

# Default to Release build if not specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
Expand Down Expand Up @@ -219,6 +254,28 @@ set_target_properties(${EXECUTABLE_NAME} PROPERTIES
INSTALL_RPATH "@executable_path/../Frameworks"
)

if(BUILD_TESTING)
add_executable(bro_persist_tests
tests/bro_persist_tests.mm
src/bro_persist.mm)
target_include_directories(bro_persist_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src)
target_compile_options(bro_persist_tests PRIVATE -fobjc-arc)
target_link_libraries(bro_persist_tests "-framework Foundation")
add_test(NAME appearance_persistence COMMAND bro_persist_tests)

add_executable(bro_glass_surface_tests
tests/bro_glass_surface_tests.mm
src/bro_motion.mm)
target_include_directories(bro_glass_surface_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src)
target_compile_options(bro_glass_surface_tests PRIVATE -fobjc-arc)
target_link_libraries(bro_glass_surface_tests
"-framework AppKit"
"-framework QuartzCore")
add_test(NAME native_glass_surfaces COMMAND bro_glass_surface_tests)
endif()

# Helper apps. Chromium on macOS launches subprocesses from helper bundles with
# exact names derived from the app name: "Bro Computer Helper.app",
# "Bro Computer Helper (Alerts).app", "(GPU)", "(Plugin)", "(Renderer)". CEF_HELPER_APP_SUFFIXES
Expand Down
6 changes: 6 additions & 0 deletions src/bro_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "bro_app.h"

#include <cstdlib>
#include <string>

#include "include/cef_command_line.h"
Expand All @@ -29,6 +30,11 @@ void BroApp::OnBeforeCommandLineProcessing(
command_line->AppendSwitch("enable-gpu");
command_line->AppendSwitchWithValue("use-angle", "metal");
command_line->AppendSwitch("ignore-gpu-blocklist");
// Isolated UI smoke tests must never ask for the user's login-keychain
// password. Production launches leave Chromium's secure storage untouched.
if (std::getenv("BRO_USE_MOCK_KEYCHAIN")) {
command_line->AppendSwitch("use-mock-keychain");
}

// Chrome's Reading Mode ships in CEF without the profile plumbing it
// expects: its page-load-metrics observer dereferences a null side-panel
Expand Down
12 changes: 12 additions & 0 deletions src/bro_downloads.mm
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ - (BOOL)resignFirstResponder {
return ok;
}

- (void)viewDidChangeEffectiveAppearance {
[super viewDidChangeEffectiveAppearance];
if (focused_) {
self.layer.borderColor = BroControlBorderColor().CGColor;
}
}

- (void)keyDown:(NSEvent*)event {
NSString* characters = event.charactersIgnoringModifiers;
unichar key = characters.length > 0 ? [characters characterAtIndex:0] : 0;
Expand Down Expand Up @@ -182,6 +189,11 @@ @implementation BroDownloadsPopover {
__weak BroHoverButton* hoveredRevealButton_;
}

- (void)viewDidChangeEffectiveAppearance {
[super viewDidChangeEffectiveAppearance];
separator_.layer.backgroundColor = [NSColor separatorColor].CGColor;
}

static NSAttributedString* BroDownloadsButtonTitle(NSString* text,
NSFont* font,
CGFloat whiteAlpha,
Expand Down
Loading
Loading