#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/webui/internals/internals_ui.h"
#include <vector>
#include "build/build_config.h"
#include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/dev_ui_browser_resources.h"
#include "chrome/grit/internals_resources.h"
#include "chrome/grit/internals_resources_map.h"
#include "components/user_education/common/user_education_features.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/webui/internals/lens/lens_internals_ui_message_handler.h"
#include "chrome/browser/ui/webui/internals/notifications/notifications_internals_ui_message_handler.h"
#else
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "ui/base/interaction/element_identifier.h"
#endif
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
#include "chrome/browser/ui/webui/internals/sessions/session_service_internals_handler.h"
#endif
namespace {
bool ShouldHandleWebUIRequestCallback(const std::string& path) { … }
void HandleWebUIRequestCallback(
Profile* profile,
const std::string& path,
content::WebUIDataSource::GotDataCallback callback) { … }
}
InternalsUI::InternalsUI(content::WebUI* web_ui)
: … { … }
InternalsUI::~InternalsUI() = default;
#if BUILDFLAG(IS_ANDROID)
void InternalsUI::AddLensInternals(content::WebUI* web_ui) {
source_->AddResourcePath("lens", IDR_LENS_INTERNALS_LENS_INTERNALS_HTML);
web_ui->AddMessageHandler(
std::make_unique<LensInternalsUIMessageHandler>(profile_));
}
#else
void InternalsUI::BindInterface(
mojo::PendingReceiver<
mojom::user_education_internals::UserEducationInternalsPageHandler>
receiver) { … }
void InternalsUI::BindInterface(
mojo::PendingReceiver<help_bubble::mojom::HelpBubbleHandlerFactory>
pending_receiver) { … }
void InternalsUI::CreateHelpBubbleHandler(
mojo::PendingRemote<help_bubble::mojom::HelpBubbleClient> pending_client,
mojo::PendingReceiver<help_bubble::mojom::HelpBubbleHandler>
pending_handler) { … }
void InternalsUI::BindInterface(
mojo::PendingReceiver<color_change_listener::mojom::PageHandler>
pending_receiver) { … }
#endif
WEB_UI_CONTROLLER_TYPE_IMPL(InternalsUI)