#include "chrome/browser/ui/browser_finder.h"
#include <stdint.h>
#include "base/containers/contains.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "components/tab_groups/tab_group_id.h"
#include "content/public/browser/navigation_controller.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/public/cpp/multi_user_window_manager.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h"
#include "components/account_id/account_id.h"
#endif
WebContents;
namespace {
bool IsBrowserClosing(Browser* browser) { … }
const uint32_t kMatchAny = …;
const uint32_t kMatchOriginalProfile = …;
const uint32_t kMatchCanSupportWindowFeature = …;
const uint32_t kMatchNormal = …;
const uint32_t kMatchDisplayId = …;
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS)
const uint32_t kMatchCurrentWorkspace = 1 << 4;
#endif
const uint32_t kMatchNotClosing = …;
const uint32_t kIncludeBrowsersScheduledForDeletion = …;
bool DoesBrowserMatchProfile(Browser& browser,
Profile* profile,
uint32_t match_types) { … }
bool BrowserMatches(Browser* browser,
Profile* profile,
Browser::WindowFeature window_feature,
uint32_t match_types,
int64_t display_id) { … }
template <class T>
Browser* FindBrowserMatching(const T& begin,
const T& end,
Profile* profile,
Browser::WindowFeature window_feature,
uint32_t match_types,
int64_t display_id = display::kInvalidDisplayId) { … }
Browser* FindBrowserWithTabbedOrAnyType(
Profile* profile,
bool match_tabbed,
bool match_original_profiles,
bool match_current_workspace,
bool match_not_closing,
int64_t display_id = display::kInvalidDisplayId) { … }
size_t GetBrowserCountImpl(Profile* profile,
uint32_t match_types,
int64_t display_id = display::kInvalidDisplayId) { … }
}
namespace chrome {
Browser* FindTabbedBrowser(Profile* profile,
bool match_original_profiles,
int64_t display_id,
bool ignore_closing_browsers) { … }
Browser* FindAnyBrowser(Profile* profile, bool match_original_profiles) { … }
Browser* FindBrowserWithProfile(Profile* profile) { … }
std::vector<Browser*> FindAllTabbedBrowsersWithProfile(Profile* profile) { … }
std::vector<Browser*> FindAllBrowsersWithProfile(Profile* profile) { … }
Browser* FindBrowserWithID(SessionID desired_id) { … }
Browser* FindBrowserWithWindow(gfx::NativeWindow window) { … }
Browser* FindBrowserWithActiveWindow() { … }
Browser* FindBrowserWithTab(const WebContents* web_contents) { … }
Browser* FindBrowserWithGroup(tab_groups::TabGroupId group, Profile* profile) { … }
Browser* FindBrowserWithUiElementContext(ui::ElementContext context) { … }
Browser* FindLastActiveWithProfile(Profile* profile) { … }
Browser* FindLastActive() { … }
size_t GetTotalBrowserCount() { … }
size_t GetBrowserCount(Profile* profile) { … }
size_t GetTabbedBrowserCount(Profile* profile) { … }
}