#include "components/browser_sync/sync_internals_message_handler.h"
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "components/signin/public/base/consent_level.h"
#include "components/signin/public/base/signin_metrics.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/primary_account_mutator.h"
#include "components/sync/base/command_line_switches.h"
#include "components/sync/base/data_type.h"
#include "components/sync/engine/events/protocol_event.h"
#include "components/sync/invalidations/sync_invalidations_service.h"
#include "components/sync/model/type_entities_count.h"
#include "components/sync/protocol/sync_invalidations_payload.pb.h"
#include "components/sync/protocol/user_event_specifics.pb.h"
#include "components/sync/service/sync_internals_util.h"
#include "components/sync/service/sync_service.h"
#include "components/sync/service/sync_user_settings.h"
#include "components/sync_user_events/user_event_service.h"
namespace browser_sync {
namespace {
int64_t StringAtIndexToInt64(const base::Value::List& list, size_t index) { … }
bool HasSomethingAtIndex(const base::Value::List& list, size_t index) { … }
bool GetIncludeSpecificsInitialState() { … }
}
SyncInternalsMessageHandler::SyncInternalsMessageHandler(
Delegate* delegate,
signin::IdentityManager* identity_manager,
syncer::SyncService* sync_service,
syncer::SyncInvalidationsService* sync_invalidations_service,
syncer::UserEventService* user_event_service,
const std::string& channel)
: … { … }
SyncInternalsMessageHandler::SyncInternalsMessageHandler(
Delegate* delegate,
GetAboutSyncDataCb get_about_sync_data_cb,
signin::IdentityManager* identity_manager,
syncer::SyncService* sync_service,
syncer::SyncInvalidationsService* sync_invalidations_service,
syncer::UserEventService* user_event_service,
const std::string& channel)
: … { … }
SyncInternalsMessageHandler::~SyncInternalsMessageHandler() = default;
void SyncInternalsMessageHandler::DisableMessagesToPage() { … }
base::flat_map<std::string, SyncInternalsMessageHandler::PageMessageHandler>
SyncInternalsMessageHandler::GetMessageHandlerMap() { … }
void SyncInternalsMessageHandler::HandleRequestDataAndRegisterForUpdates(
const base::Value::List& args) { … }
void SyncInternalsMessageHandler::HandleRequestListOfTypes(
const base::Value::List& args) { … }
void SyncInternalsMessageHandler::HandleRequestIncludeSpecificsInitialState(
const base::Value::List& args) { … }
void SyncInternalsMessageHandler::HandleGetAllNodes(
const base::Value::List& args) { … }
void SyncInternalsMessageHandler::HandleSetIncludeSpecifics(
const base::Value::List& args) { … }
void SyncInternalsMessageHandler::HandleWriteUserEvent(
const base::Value::List& args) { … }
void SyncInternalsMessageHandler::HandleRequestStart(
const base::Value::List& args) { … }
void SyncInternalsMessageHandler::HandleTriggerRefresh(
const base::Value::List& args) { … }
void SyncInternalsMessageHandler::OnReceivedAllNodes(
const std::string& callback_id,
base::Value::List nodes) { … }
void SyncInternalsMessageHandler::OnStateChanged(syncer::SyncService* sync) { … }
void SyncInternalsMessageHandler::OnProtocolEvent(
const syncer::ProtocolEvent& event) { … }
void SyncInternalsMessageHandler::OnInvalidationReceived(
const std::string& payload) { … }
void SyncInternalsMessageHandler::SendAboutInfoAndEntityCounts() { … }
void SyncInternalsMessageHandler::OnGotEntityCounts(
const syncer::TypeEntitiesCount& entity_counts) { … }
}