diff --git a/shell/browser/electron_web_ui_controller_factory.cc b/shell/browser/electron_web_ui_controller_factory.cc index 07955829b54f..385a1c0ef59c 100644 --- a/shell/browser/electron_web_ui_controller_factory.cc +++ b/shell/browser/electron_web_ui_controller_factory.cc @@ -6,18 +6,13 @@ #include +#include "chrome/common/webui_url_constants.h" #include "content/public/browser/web_contents.h" #include "electron/buildflags/buildflags.h" #include "shell/browser/ui/devtools_ui.h" namespace electron { -namespace { - -const char kChromeUIDevToolsBundledHost[] = "devtools"; - -} // namespace - // static ElectronWebUIControllerFactory* ElectronWebUIControllerFactory::GetInstance() { return base::Singleton::get(); @@ -30,7 +25,7 @@ ElectronWebUIControllerFactory::~ElectronWebUIControllerFactory() = default; content::WebUI::TypeID ElectronWebUIControllerFactory::GetWebUIType( content::BrowserContext* browser_context, const GURL& url) { - if (url.host() == kChromeUIDevToolsBundledHost) { + if (url.host() == chrome::kChromeUIDevToolsHost) { return const_cast(this); } @@ -53,7 +48,7 @@ std::unique_ptr ElectronWebUIControllerFactory::CreateWebUIControllerForURL( content::WebUI* web_ui, const GURL& url) { - if (url.host() == kChromeUIDevToolsBundledHost) { + if (url.host() == chrome::kChromeUIDevToolsHost) { auto* browser_context = web_ui->GetWebContents()->GetBrowserContext(); return std::make_unique(browser_context, web_ui); } diff --git a/shell/browser/ui/devtools_ui.cc b/shell/browser/ui/devtools_ui.cc index 3361ad018639..201c43f51e9a 100644 --- a/shell/browser/ui/devtools_ui.cc +++ b/shell/browser/ui/devtools_ui.cc @@ -11,6 +11,7 @@ #include "base/memory/ref_counted_memory.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "chrome/common/webui_url_constants.h" #include "content/public/browser/devtools_frontend_host.h" #include "content/public/browser/url_data_source.h" #include "content/public/browser/web_contents.h" @@ -20,9 +21,6 @@ namespace electron { namespace { -const char kChromeUIDevToolsHost[] = "devtools"; -const char kChromeUIDevToolsBundledPath[] = "bundled"; - std::string PathWithoutParams(const std::string& path) { return GURL(std::string("devtools://devtools/") + path).path().substr(1); } @@ -59,14 +57,14 @@ class BundledDataSource : public content::URLDataSource { ~BundledDataSource() override = default; // content::URLDataSource implementation. - std::string GetSource() override { return kChromeUIDevToolsHost; } + std::string GetSource() override { return chrome::kChromeUIDevToolsHost; } void StartDataRequest(const GURL& url, const content::WebContents::Getter& wc_getter, GotDataCallback callback) override { const std::string path = content::URLDataSource::URLToRequestPath(url); // Serve request from local bundle. - std::string bundled_path_prefix(kChromeUIDevToolsBundledPath); + std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); bundled_path_prefix += "/"; if (base::StartsWith(path, bundled_path_prefix, base::CompareCase::INSENSITIVE_ASCII)) {