From 5a99579b1a903d3738bb82450ec40c52f1ea5594 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Mon, 30 Mar 2026 08:50:13 -0400 Subject: This reverts commit 7228ba0b889765bc3474fbd5475870e24efc79ca. --- ui/containeropenrequest.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 ui/containeropenrequest.h (limited to 'ui/containeropenrequest.h') diff --git a/ui/containeropenrequest.h b/ui/containeropenrequest.h new file mode 100644 index 00000000..5067534d --- /dev/null +++ b/ui/containeropenrequest.h @@ -0,0 +1,47 @@ +#pragma once + +#include "uitypes.h" + +#include +#include +#include + + +// Captures user settings and intent for opening a container file, and provides +// policy decisions (e.g. whether to show the container browser) after processing. +class BINARYNINJAUIAPI ContainerOpenRequest +{ +public: + enum Action { + Cancel, + AutoOpen, + BrowseContainer, + SelectArchitecture, + }; + + explicit ContainerOpenRequest(const std::string& path, bool forceContainerBrowser = false); + + TransformSessionRef session() const { return m_session; } + + // Create the session, process it, and determine what action the caller + // should take. Returns Cancel if the session could not be created. + Action resolve(); + + // Get the default selection from a processed session. If no selection has + // been made (e.g. because the session auto-opened), selects the current leaf. + std::vector selectedContexts(); + + // When the container is a universal binary, the available architectures and the + // index of the preferred one (if any). + const std::vector& architectureContexts() const { return m_archContexts; } + std::optional preferredArchitectureIndex() const { return m_preferredArch; } + +private: + Action resolveUniversal(TransformContextRef universalCtx); + + TransformSessionRef m_session; + std::vector m_archContexts; + std::optional m_preferredArch; + bool m_forceContainerBrowser = false; + bool m_autoOpen = false; +}; -- cgit v1.3.1