Skip to content

Add API to discover and update browser components #4087

@nik-sp

Description

@nik-sp

Is your feature request related to a problem? Please describe.

There is currently no CEF API to programmatically interact with browser components. Chrome provides chrome://components to view registered components and trigger on-demand updates, but this functionality is not exposed to CEF clients.

This makes it difficult to:

  • Check if a required component is installed and what version it has
  • Programmatically trigger component updates when needed
  • Build diagnostic or troubleshooting UI that displays component status

Describe the solution you'd like

Expose a CEF API that allows clients to:

  1. Discover available components - Retrieve a list of all registered components with their metadata (ID, name, version, installation status)
  2. Query component information - Check if a specific component is installed and get its version
  3. Trigger on-demand updates - Request updates for specific components, similar to clicking "Check for update" in chrome://components
  4. Receive callbacks - Get notified when update operations complete with success/error status

The API should follow the CefMediaRouter pattern where wrapper objects (CefComponent) hold component info and provide methods directly on the object (e.g., component->RequestUpdate()) rather than requiring clients to pass component IDs to a central updater.

Example usage:

// List all components
CefRefPtr<CefComponentUpdater> updater = CefComponentUpdater::GetComponentUpdater();
std::vector<CefRefPtr<CefComponent>> components = updater->GetComponents();

for (const auto& component : components) {
  LOG(INFO) << component->GetName() << ": " << component->GetVersion()
            << " (installed: " << component->IsInstalled() << ")";
}

// Update a specific component
CefRefPtr<CefComponent> component = updater->GetComponentByID(component_id);
if (component && !component->IsInstalled()) {
  component->RequestUpdate(CEF_COMPONENT_UPDATE_PRIORITY_FOREGROUND, callback);
}

Describe alternatives you've considered

  1. Instruct users to use chrome://components - Requires manual user intervention and is not user-friendly for end users of CEF-based applications.

  2. Wait for automatic component updates - The component updater runs on its own schedule, which may not align with application needs. Some components may take hours to update or may fail silently.

Additional context

  • The implementation requires a small Chromium patch to add CEF classes as friends to OnDemandUpdater (similar to existing friends like ComponentsHandler)

Proposed API surface:

// CefComponentUpdater (static factory)
static CefRefPtr<CefComponentUpdater> GetComponentUpdater();
std::vector<CefRefPtr<CefComponent>> GetComponents();
CefRefPtr<CefComponent> GetComponentByID(const CefString& component_id);

// CefComponent
CefString GetID();
CefString GetName();
CefString GetVersion();
bool IsInstalled();
void RequestUpdate(cef_component_update_priority_t priority,
                   CefRefPtr<CefComponentUpdateCallback> callback);

// CefComponentUpdateCallback
void OnComplete(cef_component_update_error_t error);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions