#include "chrome/browser/ui/webui/history/foreign_session_handler.h"
#include <stddef.h>
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/i18n/time_formatting.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/sync/session_sync_service_factory.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync_sessions/session_sync_service.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "ui/base/l10n/time_format.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/base/window_open_disposition_utils.h"
namespace browser_sync {
namespace {
const size_t kMaxSessionsToShow = …;
std::optional<base::Value::Dict> SessionTabToValue(
const ::sessions::SessionTab& tab) { … }
base::Value::Dict BuildWindowData(base::Time modification_time,
SessionID window_id) { … }
std::optional<base::Value::Dict> SessionWindowToValue(
const ::sessions::SessionWindow& window) { … }
}
ForeignSessionHandler::ForeignSessionHandler() = default;
ForeignSessionHandler::~ForeignSessionHandler() = default;
void ForeignSessionHandler::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { … }
void ForeignSessionHandler::OpenForeignSessionTab(
content::WebUI* web_ui,
const std::string& session_string_value,
SessionID tab_id,
const WindowOpenDisposition& disposition) { … }
void ForeignSessionHandler::OpenForeignSessionWindows(
content::WebUI* web_ui,
const std::string& session_string_value) { … }
sync_sessions::OpenTabsUIDelegate* ForeignSessionHandler::GetOpenTabsUIDelegate(
content::WebUI* web_ui) { … }
void ForeignSessionHandler::RegisterMessages() { … }
void ForeignSessionHandler::OnJavascriptAllowed() { … }
void ForeignSessionHandler::OnJavascriptDisallowed() { … }
void ForeignSessionHandler::OnForeignSessionUpdated() { … }
void ForeignSessionHandler::InitializeForeignSessions() { … }
std::u16string ForeignSessionHandler::FormatSessionTime(
const base::Time& time) { … }
void ForeignSessionHandler::HandleGetForeignSessions(
const base::Value::List& args) { … }
base::Value::List ForeignSessionHandler::GetForeignSessions() { … }
void ForeignSessionHandler::HandleOpenForeignSessionAllTabs(
const base::Value::List& args) { … }
void ForeignSessionHandler::HandleOpenForeignSessionTab(
const base::Value::List& args) { … }
void ForeignSessionHandler::HandleDeleteForeignSession(
const base::Value::List& args) { … }
void ForeignSessionHandler::HandleSetForeignSessionCollapsed(
const base::Value::List& args) { … }
}