2017-01-17 14:23:13 +00:00
|
|
|
// Copyright (c) 2017 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-02-04 20:19:40 +00:00
|
|
|
#ifndef SHELL_BROWSER_ELECTRON_WEB_UI_CONTROLLER_FACTORY_H_
|
|
|
|
#define SHELL_BROWSER_ELECTRON_WEB_UI_CONTROLLER_FACTORY_H_
|
2017-01-17 14:23:13 +00:00
|
|
|
|
2018-10-02 19:11:56 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2017-01-17 14:23:13 +00:00
|
|
|
#include "base/memory/singleton.h"
|
|
|
|
#include "content/public/browser/web_ui_controller_factory.h"
|
|
|
|
|
2021-07-02 00:51:37 +00:00
|
|
|
namespace content {
|
|
|
|
class WebUIController;
|
|
|
|
}
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
namespace electron {
|
2017-01-17 14:23:13 +00:00
|
|
|
|
2020-02-04 20:19:40 +00:00
|
|
|
class ElectronWebUIControllerFactory : public content::WebUIControllerFactory {
|
2017-01-17 14:23:13 +00:00
|
|
|
public:
|
2020-02-04 20:19:40 +00:00
|
|
|
static ElectronWebUIControllerFactory* GetInstance();
|
2017-01-17 14:23:13 +00:00
|
|
|
|
2020-02-04 20:19:40 +00:00
|
|
|
ElectronWebUIControllerFactory();
|
|
|
|
~ElectronWebUIControllerFactory() override;
|
2017-01-17 14:23:13 +00:00
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
ElectronWebUIControllerFactory(const ElectronWebUIControllerFactory&) =
|
|
|
|
delete;
|
|
|
|
ElectronWebUIControllerFactory& operator=(
|
|
|
|
const ElectronWebUIControllerFactory&) = delete;
|
|
|
|
|
2017-01-18 13:58:20 +00:00
|
|
|
// content::WebUIControllerFactory:
|
2017-01-17 14:23:13 +00:00
|
|
|
content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
|
2019-07-03 01:22:09 +00:00
|
|
|
const GURL& url) override;
|
2017-01-17 14:23:13 +00:00
|
|
|
bool UseWebUIForURL(content::BrowserContext* browser_context,
|
2019-07-03 01:22:09 +00:00
|
|
|
const GURL& url) override;
|
2018-10-02 19:11:56 +00:00
|
|
|
std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
|
2017-01-17 14:23:13 +00:00
|
|
|
content::WebUI* web_ui,
|
2019-07-03 01:22:09 +00:00
|
|
|
const GURL& url) override;
|
2017-01-17 14:23:13 +00:00
|
|
|
|
|
|
|
private:
|
2020-02-04 20:19:40 +00:00
|
|
|
friend struct base::DefaultSingletonTraits<ElectronWebUIControllerFactory>;
|
2017-01-17 14:23:13 +00:00
|
|
|
};
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
} // namespace electron
|
2017-01-17 14:23:13 +00:00
|
|
|
|
2020-02-04 20:19:40 +00:00
|
|
|
#endif // SHELL_BROWSER_ELECTRON_WEB_UI_CONTROLLER_FACTORY_H_
|