chromium/chrome/browser/ui/webui/internals/internals_ui.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#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  // BUILDFLAG(IS_ANDROID)

#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) {}

}  // namespace

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   // BUILDFLAG(IS_ANDROID)

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  // BUILDFLAG(IS_ANDROID)

WEB_UI_CONTROLLER_TYPE_IMPL(InternalsUI)