#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/webui/system/system_info_ui.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/escape.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/feedback/system_logs/about_system_logs_fetcher.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/about_sys_resources.h"
#include "chrome/grit/about_sys_resources_map.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/key_value_pair_viewer_shared_resources.h"
#include "chrome/grit/key_value_pair_viewer_shared_resources_map.h"
#include "components/feedback/system_logs/system_logs_fetcher.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "net/base/directory_lister.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
#include "ui/base/webui/web_ui_util.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/crosapi/browser_manager.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/common/webui_url_constants.h"
#endif
WebContents;
WebUIMessageHandler;
SystemLogsResponse;
namespace {
void CreateAndAddSystemInfoUIDataSource(Profile* profile) { … }
}
class SystemInfoUIHandler : public WebUIMessageHandler { … };
SystemInfoUIHandler::SystemInfoUIHandler() { … }
SystemInfoUIHandler::~SystemInfoUIHandler() { … }
void SystemInfoUIHandler::OnJavascriptDisallowed() { … }
void SystemInfoUIHandler::RegisterMessages() { … }
void SystemInfoUIHandler::HandleRequestSystemInfo(
const base::Value::List& args) { … }
void SystemInfoUIHandler::OnSystemInfo(
std::unique_ptr<SystemLogsResponse> sys_info) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void SystemInfoUIHandler::IsLacrosEnabled(const base::Value::List& args) {
CHECK_EQ(1U, args.size());
AllowJavascript();
const bool is_lacros_enabled = crosapi::browser_util::IsLacrosEnabled();
std::string callback_id = args[0].GetString();
ResolveJavascriptCallback(base::Value(callback_id),
base::Value(is_lacros_enabled));
}
void SystemInfoUIHandler::OpenLacrosSystemPage(const base::Value::List& args) {
CHECK(crosapi::BrowserManager::Get());
crosapi::BrowserManager::Get()->SwitchToTab(
GURL(chrome::kChromeUISystemURL),
NavigateParams::RESPECT);
}
#endif
SystemInfoUI::SystemInfoUI(content::WebUI* web_ui) : … { … }