#include "chrome/browser/sessions/session_service_log.h"
#include <string>
#include <utility>
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
namespace {
constexpr char kEventPrefKey[] = …;
constexpr char kEventTypeKey[] = …;
constexpr char kEventTimeKey[] = …;
constexpr char kStartEventDidLastSessionCrashKey[] = …;
constexpr char kRestoreEventWindowCountKey[] = …;
constexpr char kRestoreEventTabCountKey[] = …;
constexpr char kRestoreEventErroredReadingKey[] = …;
constexpr char kRestoreInitiatedEventRestoreBrowserKey[] = …;
constexpr char kRestoreInitiatedEventSynchronousKey[] = …;
constexpr char kExitEventWindowCountKey[] = …;
constexpr char kExitEventTabCountKey[] = …;
constexpr char kExitEventIsFirstSessionServiceKey[] = …;
constexpr char kExitEventDidScheduleCommandKey[] = …;
constexpr char kWriteErrorEventErrorCountKey[] = …;
constexpr char kWriteErrorEventUnrecoverableErrorCountKey[] = …;
constexpr size_t kMaxEventCount = …;
base::Value::Dict SerializeEvent(const SessionServiceEvent& event) { … }
bool DeserializeEvent(const base::Value::Dict& serialized_event,
SessionServiceEvent& event) { … }
void SaveEventsToPrefs(Profile* profile,
const std::list<SessionServiceEvent>& events) { … }
}
std::list<SessionServiceEvent> GetSessionServiceEvents(Profile* profile) { … }
void LogSessionServiceStartEvent(Profile* profile, bool after_crash) { … }
void LogSessionServiceExitEvent(Profile* profile,
int window_count,
int tab_count,
bool is_first_session_service,
bool did_schedule_command) { … }
void LogSessionServiceRestoreInitiatedEvent(Profile* profile,
bool synchronous,
bool restore_browser) { … }
void LogSessionServiceRestoreEvent(Profile* profile,
int window_count,
int tab_count,
bool encountered_error_reading) { … }
void LogSessionServiceRestoreCanceledEvent(Profile* profile) { … }
void LogSessionServiceWriteErrorEvent(Profile* profile,
bool unrecoverable_write_error) { … }
void RemoveLastSessionServiceEventOfType(Profile* profile,
SessionServiceEventLogType type) { … }
void RegisterSessionServiceLogProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { … }
void LogSessionServiceEvent(Profile* profile,
const SessionServiceEvent& event) { … }