Commit 1f2e6b2d authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert crostini_upgrader::mojom::PageHandlerFactory client to BrowserInterfaceBroker

This CL converts crostini_upgrader::mojom::PageHandlerFactory
mojom interface clients for chrome os in chrome to use
BrowserInterfaceBroker.

Bug: 936482, 1002647
Change-Id: I9ccea33e088a8496f548a464e20bf2a29cde9cf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1969128
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarcalamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726263}
parent 09ff463e
......@@ -20,7 +20,6 @@
#include "services/service_manager/public/cpp/manifest_builder.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader.mojom.h"
#include "chromeos/services/media_perception/public/mojom/media_perception.mojom.h"
#include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
#include "chromeos/services/network_config/public/mojom/constants.mojom.h" // nogncheck
......@@ -88,7 +87,6 @@ const service_manager::Manifest& GetChromeContentBrowserOverlayManifest() {
"navigation:frame", "renderer",
service_manager::Manifest::InterfaceList<
#if defined(OS_CHROMEOS)
chromeos::crostini_upgrader::mojom::PageHandlerFactory,
chromeos::multidevice_setup::mojom::MultiDeviceSetup,
chromeos::multidevice_setup::mojom::PrivilegedHostDeviceSetter,
chromeos::network_config::mojom::CrosNetworkConfig,
......
......@@ -118,6 +118,8 @@
#include "chrome/browser/ui/webui/chromeos/cellular_setup/cellular_setup_dialog.h"
#include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom.h"
#include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.h"
#include "chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader.mojom.h"
#include "chrome/browser/ui/webui/chromeos/crostini_upgrader/crostini_upgrader_ui.h"
#include "chromeos/services/cellular_setup/public/mojom/cellular_setup.mojom.h"
#endif
......@@ -445,9 +447,15 @@ void PopulateChromeWebUIFrameBinders(
RegisterWebUIControllerInterfaceBinder<
chromeos::cellular_setup::CellularSetupDialogUI,
chromeos::cellular_setup::mojom::CellularSetup>(map);
RegisterWebUIControllerInterfaceBinder<
chromeos::CrostiniInstallerUI,
chromeos::crostini_installer::mojom::PageHandlerFactory>(map);
RegisterWebUIControllerInterfaceBinder<
chromeos::CrostiniUpgraderUI,
chromeos::crostini_upgrader::mojom::PageHandlerFactory>(map);
RegisterWebUIControllerInterfaceBinder<
chromeos::machine_learning::MachineLearningInternalsUI,
chromeos::machine_learning::mojom::PageHandler>(map);
......
......@@ -17,7 +17,8 @@ export class BrowserProxy {
this.handler = new chromeos.crostiniUpgrader.mojom.PageHandlerRemote();
const factory =
chromeos.crostiniUpgrader.mojom.PageHandlerFactory.getRemote();
chromeos.crostiniUpgrader.mojom.PageHandlerFactory.getRemote(
/*useBrowserInterfaceBroker=*/ true);
factory.createPageHandler(
this.callbackRouter.$.bindNewPipeAndPassRemote(),
this.handler.$.bindNewPipeAndPassReceiver());
......
......@@ -96,14 +96,11 @@ CrostiniUpgraderUI::CrostiniUpgraderUI(content::WebUI* web_ui)
source->UseStringsJs();
source->EnableReplaceI18nInJS();
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
AddHandlerToRegistry(base::BindRepeating(
&CrostiniUpgraderUI::BindPageHandlerFactory, base::Unretained(this)));
}
CrostiniUpgraderUI::~CrostiniUpgraderUI() = default;
void CrostiniUpgraderUI::BindPageHandlerFactory(
void CrostiniUpgraderUI::BindInterface(
mojo::PendingReceiver<
chromeos::crostini_upgrader::mojom::PageHandlerFactory>
pending_receiver) {
......@@ -137,4 +134,6 @@ void CrostiniUpgraderUI::OnWebUICloseDialog() {
ui::MojoWebDialogUI::CloseDialog(nullptr);
}
WEB_UI_CONTROLLER_TYPE_IMPL(CrostiniUpgraderUI)
} // namespace chromeos
......@@ -31,12 +31,14 @@ class CrostiniUpgraderUI
launch_closure_ = std::move(launch_closure);
}
private:
void BindPageHandlerFactory(
mojo::PendingReceiver<
// Instantiates implementor of the
// chromeos::crostini_upgrader::mojom::PageHandlerFactory mojo interface
// passing the pending receiver that will be internally bound.
void BindInterface(mojo::PendingReceiver<
chromeos::crostini_upgrader::mojom::PageHandlerFactory>
pending_receiver);
private:
// chromeos::crostini_upgrader::mojom::PageHandlerFactory:
void CreatePageHandler(
mojo::PendingRemote<chromeos::crostini_upgrader::mojom::Page>
......@@ -55,6 +57,8 @@ class CrostiniUpgraderUI
bool can_close_ = false;
WEB_UI_CONTROLLER_TYPE_DECL();
DISALLOW_COPY_AND_ASSIGN(CrostiniUpgraderUI);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment