#include "chrome/browser/ui/tabs/tab_group_deletion_dialog_controller.h"
#include <memory>
#include <string>
#include "base/functional/callback.h"
#include "base/i18n/message_formatter.h"
#include "base/no_destructor.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_pref_names.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_service_factory.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_utils.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/base/consent_level.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/dialog_model.h"
namespace tab_groups {
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
namespace {
constexpr int kDontAskId = …;
constexpr int kDeleteBodySyncedId = …;
constexpr int kDeleteBodyNotSyncedId = …;
constexpr int kDeleteTitleId = …;
constexpr int kDeleteOkTextId = …;
constexpr int kUngroupTitleId = …;
constexpr int kUngroupBodySyncedId = …;
constexpr int kUngroupBodyNotSyncedId = …;
constexpr int kUngroupOkTextId = …;
constexpr int kCloseTabAndDeleteTitleId = …;
constexpr int kRemoveTabAndDeleteTitleId = …;
struct DialogText { … };
DialogText GetDialogText(Profile* profile,
DeletionDialogController::DialogType type,
int tab_count,
int group_count) { … }
bool IsDialogSkippedByUserSettings(Profile* profile,
DeletionDialogController::DialogType type) { … }
void SetSkipDialogForType(Profile* profile,
DeletionDialogController::DialogType type,
bool new_value) { … }
}
DeletionDialogController::DialogState::DialogState(
DialogType type_,
ui::DialogModel* dialog_model_,
base::OnceCallback<void()> on_ok_button_pressed_,
base::OnceCallback<void()> on_cancel_button_pressed_)
: … { … }
DeletionDialogController::DialogState::~DialogState() = default;
DeletionDialogController::DeletionDialogController(Browser* browser)
: … { … }
DeletionDialogController::~DeletionDialogController() = default;
bool DeletionDialogController::CanShowDialog() { … }
bool DeletionDialogController::IsShowingDialog() { … }
bool DeletionDialogController::MaybeShowDialog(
DialogType type,
base::OnceCallback<void()> on_ok_callback,
int tab_count,
int group_count) { … }
void DeletionDialogController::SetPrefsPreventShowingDialogForTesting(
bool should_prevent_dialog) { … }
void DeletionDialogController::OnDialogOk() { … }
void DeletionDialogController::OnDialogCancel() { … }
std::unique_ptr<ui::DialogModel> DeletionDialogController::BuildDialogModel(
DialogType type,
int tab_count,
int group_count) { … }
}