|
@@ -25,8 +25,9 @@ ElectronWebUIControllerFactory::~ElectronWebUIControllerFactory() = default;
|
|
|
content::WebUI::TypeID ElectronWebUIControllerFactory::GetWebUIType(
|
|
|
content::BrowserContext* browser_context,
|
|
|
const GURL& url) {
|
|
|
- if (url.host() == chrome::kChromeUIDevToolsHost ||
|
|
|
- url.host() == chrome::kChromeUIAccessibilityHost) {
|
|
|
+ if (const std::string_view host = url.host_piece();
|
|
|
+ host == chrome::kChromeUIDevToolsHost ||
|
|
|
+ host == chrome::kChromeUIAccessibilityHost) {
|
|
|
return const_cast<ElectronWebUIControllerFactory*>(this);
|
|
|
}
|
|
|
|
|
@@ -43,13 +44,16 @@ std::unique_ptr<content::WebUIController>
|
|
|
ElectronWebUIControllerFactory::CreateWebUIControllerForURL(
|
|
|
content::WebUI* web_ui,
|
|
|
const GURL& url) {
|
|
|
- if (url.host() == chrome::kChromeUIDevToolsHost) {
|
|
|
+ const std::string_view host = url.host_piece();
|
|
|
+
|
|
|
+ if (host == chrome::kChromeUIDevToolsHost) {
|
|
|
auto* browser_context = web_ui->GetWebContents()->GetBrowserContext();
|
|
|
return std::make_unique<DevToolsUI>(browser_context, web_ui);
|
|
|
- } else if (url.host() == chrome::kChromeUIAccessibilityHost) {
|
|
|
- return std::make_unique<ElectronAccessibilityUI>(web_ui);
|
|
|
}
|
|
|
|
|
|
+ if (host == chrome::kChromeUIAccessibilityHost)
|
|
|
+ return std::make_unique<ElectronAccessibilityUI>(web_ui);
|
|
|
+
|
|
|
return std::unique_ptr<content::WebUIController>();
|
|
|
}
|
|
|
|