#include "chrome/browser/ui/webui/on_device_internals/on_device_internals_page_handler.h"
#include "base/files/file_util.h"
#include "base/task/thread_pool.h"
#include "components/optimization_guide/core/optimization_guide_constants.h"
#include "content/public/browser/service_process_host.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
#include "services/on_device_model/public/cpp/buildflags.h"
#include "services/on_device_model/public/cpp/model_assets.h"
#if BUILDFLAG(USE_CHROMEOS_MODEL_SERVICE)
#include "chromeos/ash/components/mojo_service_manager/connection.h"
#include "third_party/cros_system_api/mojo/service_constants.h"
#endif
namespace {
#if !BUILDFLAG(USE_CHROMEOS_MODEL_SERVICE)
on_device_model::ModelAssets LoadModelAssets(const base::FilePath& model_path) { … }
#endif
}
OnDeviceInternalsPageHandler::OnDeviceInternalsPageHandler(
mojo::PendingReceiver<mojom::OnDeviceInternalsPageHandler> receiver,
mojo::PendingRemote<mojom::OnDeviceInternalsPage> page,
OptimizationGuideLogger* optimization_guide_logger)
: … { … }
OnDeviceInternalsPageHandler::~OnDeviceInternalsPageHandler() { … }
void OnDeviceInternalsPageHandler::LoadModel(
const base::FilePath& model_path,
mojo::PendingReceiver<on_device_model::mojom::OnDeviceModel> model,
LoadModelCallback callback) { … }
OnDeviceInternalsPageHandler::Service&
OnDeviceInternalsPageHandler::GetService() { … }
#if !BUILDFLAG(USE_CHROMEOS_MODEL_SERVICE)
void OnDeviceInternalsPageHandler::OnModelAssetsLoaded(
mojo::PendingReceiver<on_device_model::mojom::OnDeviceModel> model,
LoadModelCallback callback,
on_device_model::ModelAssets assets) { … }
#endif
void OnDeviceInternalsPageHandler::GetEstimatedPerformanceClass(
GetEstimatedPerformanceClassCallback callback) { … }
void OnDeviceInternalsPageHandler::OnLogMessageAdded(
base::Time event_time,
optimization_guide_common::mojom::LogSource log_source,
const std::string& source_file,
int source_line,
const std::string& message) { … }