sample_system_web_app_untrusted_ui.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_WEBUI_SAMPLE_SYSTEM_WEB_APP_UI_SAMPLE_SYSTEM_WEB_APP_UNTRUSTED_UI_H_
  5. #define ASH_WEBUI_SAMPLE_SYSTEM_WEB_APP_UI_SAMPLE_SYSTEM_WEB_APP_UNTRUSTED_UI_H_
  6. #include "ash/webui/sample_system_web_app_ui/mojom/sample_system_web_app_untrusted_ui.mojom.h"
  7. #include "ash/webui/sample_system_web_app_ui/url_constants.h"
  8. #include "ash/webui/system_apps/public/system_web_app_ui_config.h"
  9. #include "content/public/browser/webui_config.h"
  10. #include "ui/webui/untrusted_web_ui_controller.h"
  11. #if defined(OFFICIAL_BUILD)
  12. #error Sample System Web App should only be included in unofficial builds.
  13. #endif
  14. namespace content {
  15. class WebUI;
  16. } // namespace content
  17. namespace ash {
  18. class SampleSystemWebAppUntrustedUI;
  19. class SampleSystemWebAppUntrustedUIConfig
  20. : public SystemWebAppUntrustedUIConfig<SampleSystemWebAppUntrustedUI> {
  21. public:
  22. SampleSystemWebAppUntrustedUIConfig()
  23. : SystemWebAppUntrustedUIConfig(kChromeUISampleSystemWebAppUntrustedHost,
  24. SystemWebAppType::SAMPLE) {}
  25. };
  26. class SampleSystemWebAppUntrustedUI
  27. : public ui::UntrustedWebUIController,
  28. public mojom::sample_swa::UntrustedPageInterfacesFactory {
  29. public:
  30. explicit SampleSystemWebAppUntrustedUI(content::WebUI* web_ui);
  31. SampleSystemWebAppUntrustedUI(const SampleSystemWebAppUntrustedUI&) = delete;
  32. SampleSystemWebAppUntrustedUI& operator=(
  33. const SampleSystemWebAppUntrustedUI&) = delete;
  34. ~SampleSystemWebAppUntrustedUI() override;
  35. void BindInterface(
  36. mojo::PendingReceiver<mojom::sample_swa::UntrustedPageInterfacesFactory>
  37. factory);
  38. private:
  39. // mojom::sample_swa::UntrustedPageInterfacesFactory
  40. void CreateParentPage(
  41. mojo::PendingRemote<mojom::sample_swa::ChildUntrustedPage>
  42. child_untrusted_page,
  43. mojo::PendingReceiver<mojom::sample_swa::ParentTrustedPage>
  44. parent_trusted_page) override;
  45. mojo::Receiver<mojom::sample_swa::UntrustedPageInterfacesFactory>
  46. untrusted_page_factory_{this};
  47. WEB_UI_CONTROLLER_TYPE_DECL();
  48. };
  49. } // namespace ash
  50. #endif // ASH_WEBUI_SAMPLE_SYSTEM_WEB_APP_UI_SAMPLE_SYSTEM_WEB_APP_UNTRUSTED_UI_H_