#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/webui/crashes_ui.h"
#include <stddef.h>
#include <memory>
#include <string>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/crash_upload_list/crash_upload_list.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/metrics/metrics_reporting_state.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/branded_strings.h"
#include "components/crash/core/browser/crashes_ui_util.h"
#include "components/grit/components_scaled_resources.h"
#include "components/grit/dev_ui_components_resources.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/version_info/version_info.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 "google_apis/gaia/gaia_auth_util.h"
#include "ui/base/resource/resource_bundle.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chromeos/ash/components/dbus/debug_daemon/debug_daemon_client.h"
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include "components/crash/core/app/crashpad.h"
#endif
WebContents;
WebUIMessageHandler;
namespace {
void CreateAndAddCrashesUIHTMLSource(Profile* profile) { … }
class CrashesDOMHandler : public WebUIMessageHandler { … };
CrashesDOMHandler::CrashesDOMHandler()
: … { … }
CrashesDOMHandler::~CrashesDOMHandler() { … }
void CrashesDOMHandler::RegisterMessages() { … }
void CrashesDOMHandler::OnJavascriptDisallowed() { … }
void CrashesDOMHandler::HandleRequestCrashes(const base::Value::List& args) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void CrashesDOMHandler::HandleRequestUploads(const base::Value::List& args) {
ash::DebugDaemonClient* debugd_client = ash::DebugDaemonClient::Get();
DCHECK(debugd_client);
debugd_client->UploadCrashes(base::BindOnce([](bool success) {
if (!success) {
LOG(WARNING) << "crash_sender failed or timed out";
}
}));
}
#endif
void CrashesDOMHandler::OnUploadListAvailable() { … }
void CrashesDOMHandler::UpdateUI() { … }
void CrashesDOMHandler::HandleRequestSingleCrashUpload(
const base::Value::List& args) { … }
}
CrashesUI::CrashesUI(content::WebUI* web_ui) : … { … }
base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes(
ui::ResourceScaleFactor scale_factor) { … }