#include "chrome/browser/browsing_data/navigation_entry_remover.h"
#include <functional>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/common/buildflags.h"
#include "components/sessions/core/serialized_navigation_entry.h"
#include "components/sessions/core/tab_restore_service.h"
#include "components/sessions/core/tab_restore_service_observer.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/android/tab_android.h"
#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/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#endif
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_service_factory.h"
#endif
namespace {
bool ShouldDeleteUrl(base::Time begin,
base::Time end,
const std::optional<std::set<GURL>>& restrict_urls,
const GURL& url,
base::Time time_stamp) { … }
bool ShouldDeleteNavigationEntry(
base::Time begin,
base::Time end,
const std::optional<std::set<GURL>>& restrict_urls,
content::NavigationEntry* entry) { … }
bool ShouldDeleteSerializedNavigationEntry(
base::Time begin,
base::Time end,
const std::optional<std::set<GURL>>& restrict_urls,
const sessions::SerializedNavigationEntry& entry) { … }
bool UrlMatcherForNavigationEntry(const base::flat_set<GURL>& urls,
content::NavigationEntry* entry) { … }
bool UrlMatcherForSerializedNavigationEntry(
const base::flat_set<GURL>& urls,
const sessions::SerializedNavigationEntry& entry) { … }
base::flat_set<GURL> CreateUrlSet(const history::URLRows& deleted_rows) { … }
void DeleteNavigationEntries(
content::WebContents* web_contents,
const content::NavigationController::DeletionPredicate& predicate) { … }
void DeleteTabNavigationEntries(
Profile* profile,
const history::DeletionTimeRange& time_range,
const std::optional<std::set<GURL>>& restrict_urls,
const base::flat_set<GURL>& url_set) { … }
void PerformTabRestoreDeletion(
sessions::TabRestoreService* service,
const sessions::TabRestoreService::DeletionPredicate& predicate) { … }
class TabRestoreDeletionHelper : public sessions::TabRestoreServiceObserver { … };
void DeleteTabRestoreEntries(Profile* profile,
const history::DeletionTimeRange& time_range,
const std::optional<std::set<GURL>>& restrict_urls,
const base::flat_set<GURL>& url_set) { … }
void DeleteLastSessionFromSessionService(Profile* profile) { … }
}
namespace browsing_data {
void RemoveNavigationEntries(Profile* profile,
const history::DeletionInfo& deletion_info) { … }
}