#include "chrome/browser/enterprise/idle/action.h"
#include <cstring>
#include <utility>
#include "base/callback_list.h"
#include "base/check_is_test.h"
#include "base/containers/flat_map.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/ranges/algorithm.h"
#include "base/scoped_observation.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_constants.h"
#include "chrome/browser/enterprise/idle/action_runner.h"
#include "chrome/browser/enterprise/idle/idle_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/enterprise/idle/idle_pref_names.h"
#include "components/enterprise/idle/metrics.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browsing_data_remover.h"
#include "content/public/browser/web_contents.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/android/tab_model/tab_model.h"
#include "chrome/browser/ui/android/tab_model/tab_model_list.h"
#else
#include "chrome/browser/enterprise/idle/dialog_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/idle_bubble.h"
#include "chrome/browser/ui/profiles/profile_picker.h"
#endif
namespace enterprise_idle {
namespace {
#if !BUILDFLAG(IS_ANDROID)
bool ProfileHasBrowsers(const Profile* profile) { … }
class ShowDialogAction : public Action { … };
class CloseBrowsersAction : public Action { … };
class ShowProfilePickerAction : public Action { … };
#endif
class ClearBrowsingDataAction : public Action,
content::BrowsingDataRemover::Observer { … };
class ReloadPagesAction : public Action { … };
#if !BUILDFLAG(IS_ANDROID)
class ShowBubbleAction : public Action { … };
#endif
}
Action::Action(int priority) : … { … }
Action::~Action() = default;
bool ActionFactory::CompareActionsByPriority::operator()(
const std::unique_ptr<Action>& a,
const std::unique_ptr<Action>& b) const { … }
ActionFactory* ActionFactory::GetInstance() { … }
ActionFactory::ActionQueue ActionFactory::Build(
Profile* profile,
const std::vector<ActionType>& action_types) { … }
ActionFactory::ActionFactory() = default;
ActionFactory::~ActionFactory() = default;
void ActionFactory::SetBrowsingDataRemoverForTesting(
content::BrowsingDataRemover* remover) { … }
#if !BUILDFLAG(IS_ANDROID)
IdleDialog::ActionSet ActionsToActionSet(
const base::flat_set<ActionType>& action_types) { … }
#endif
}