fix: chrome://accessibility not loading (#24437)

This commit is contained in:
Shelley Vohr 2020-07-16 10:14:54 -07:00 committed by GitHub
parent 24fb498fd3
commit 3f37ff87d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 668 additions and 1 deletions

View file

@ -10,6 +10,7 @@
#include "content/public/browser/web_contents.h"
#include "electron/buildflags/buildflags.h"
#include "shell/browser/ui/devtools_ui.h"
#include "shell/browser/ui/webui/accessibility_ui.h"
namespace electron {
@ -25,7 +26,8 @@ ElectronWebUIControllerFactory::~ElectronWebUIControllerFactory() = default;
content::WebUI::TypeID ElectronWebUIControllerFactory::GetWebUIType(
content::BrowserContext* browser_context,
const GURL& url) {
if (url.host() == chrome::kChromeUIDevToolsHost) {
if (url.host() == chrome::kChromeUIDevToolsHost ||
url.host() == chrome::kChromeUIAccessibilityHost) {
return const_cast<ElectronWebUIControllerFactory*>(this);
}
@ -51,7 +53,10 @@ ElectronWebUIControllerFactory::CreateWebUIControllerForURL(
if (url.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);
}
return std::unique_ptr<content::WebUIController>();
}