#include "chrome/browser/ui/views/tabs/tab_strip_layout_helper.h"
#include <memory>
#include <set>
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_style.h"
#include "chrome/browser/ui/tabs/tab_types.h"
#include "chrome/browser/ui/views/tabs/tab.h"
#include "chrome/browser/ui/views/tabs/tab_group_header.h"
#include "chrome/browser/ui/views/tabs/tab_layout_state.h"
#include "chrome/browser/ui/views/tabs/tab_slot_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip_layout_types.h"
#include "chrome/browser/ui/views/tabs/tab_style_views.h"
#include "tab_container_controller.h"
#include "ui/gfx/range/range.h"
#include "ui/views/view_model.h"
namespace {
enum class ViewType { … };
}
struct TabStripLayoutHelper::TabSlot { … };
TabStripLayoutHelper::TabStripLayoutHelper(
const TabContainerController& controller,
GetTabsCallback get_tabs_callback)
: … { … }
TabStripLayoutHelper::~TabStripLayoutHelper() = default;
std::vector<Tab*> TabStripLayoutHelper::GetTabs() const { … }
std::vector<TabSlotView*> TabStripLayoutHelper::GetTabSlotViews() const { … }
size_t TabStripLayoutHelper::GetPinnedTabCount() const { … }
void TabStripLayoutHelper::InsertTabAt(int model_index,
Tab* tab,
TabPinned pinned) { … }
void TabStripLayoutHelper::MarkTabAsClosing(int model_index, Tab* tab) { … }
void TabStripLayoutHelper::RemoveTab(Tab* tab) { … }
void TabStripLayoutHelper::MoveTab(
std::optional<tab_groups::TabGroupId> moving_tab_group,
int prev_index,
int new_index) { … }
void TabStripLayoutHelper::SetTabPinned(int model_index, TabPinned pinned) { … }
void TabStripLayoutHelper::InsertGroupHeader(tab_groups::TabGroupId group,
TabGroupHeader* header) { … }
void TabStripLayoutHelper::RemoveGroupHeader(tab_groups::TabGroupId group) { … }
void TabStripLayoutHelper::UpdateGroupHeaderIndex(
tab_groups::TabGroupId group) { … }
void TabStripLayoutHelper::SetActiveTab(
std::optional<size_t> prev_active_index,
std::optional<size_t> new_active_index) { … }
int TabStripLayoutHelper::CalculateMinimumWidth() { … }
int TabStripLayoutHelper::CalculatePreferredWidth() { … }
int TabStripLayoutHelper::UpdateIdealBounds(int available_width) { … }
std::vector<gfx::Rect> TabStripLayoutHelper::CalculateIdealBounds(
std::optional<int> available_width) { … }
int TabStripLayoutHelper::GetSlotIndexForExistingTab(int model_index) const { … }
int TabStripLayoutHelper::GetSlotInsertionIndexForNewTab(
int new_model_index,
std::optional<tab_groups::TabGroupId> group) const { … }
std::optional<int> TabStripLayoutHelper::GetFirstTabSlotForGroup(
tab_groups::TabGroupId group) const { … }
int TabStripLayoutHelper::GetFirstSlotIndexForTabModelIndex(
int model_index) const { … }
int TabStripLayoutHelper::GetSlotIndexForGroupHeader(
tab_groups::TabGroupId group) const { … }
void TabStripLayoutHelper::UpdateCachedTabWidth(int tab_index,
int tab_width,
bool active) { … }
bool TabStripLayoutHelper::SlotIsCollapsedTab(int i) const { … }