help_app_ui.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2019 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_HELP_APP_UI_HELP_APP_UI_H_
  5. #define ASH_WEBUI_HELP_APP_UI_HELP_APP_UI_H_
  6. #include <memory>
  7. #include "ash/webui/help_app_ui/help_app_ui.mojom.h"
  8. #include "ash/webui/help_app_ui/help_app_ui_delegate.h"
  9. #include "ash/webui/help_app_ui/search/search.mojom.h"
  10. #include "chromeos/ash/components/local_search_service/public/mojom/index.mojom.h"
  11. #include "mojo/public/cpp/bindings/receiver.h"
  12. #include "ui/webui/mojo_web_ui_controller.h"
  13. namespace ash {
  14. class HelpAppPageHandler;
  15. // The WebUI controller for chrome://help-app.
  16. class HelpAppUI : public ui::MojoWebUIController,
  17. public help_app::mojom::PageHandlerFactory {
  18. public:
  19. HelpAppUI(content::WebUI* web_ui,
  20. std::unique_ptr<HelpAppUIDelegate> delegate);
  21. ~HelpAppUI() override;
  22. HelpAppUI(const HelpAppUI&) = delete;
  23. HelpAppUI& operator=(const HelpAppUI&) = delete;
  24. void BindInterface(
  25. mojo::PendingReceiver<help_app::mojom::PageHandlerFactory> receiver);
  26. void BindInterface(
  27. mojo::PendingReceiver<chromeos::local_search_service::mojom::Index>
  28. index_receiver);
  29. // The search handler is used to update the search index for launcher search.
  30. void BindInterface(
  31. mojo::PendingReceiver<help_app::mojom::SearchHandler> receiver);
  32. HelpAppUIDelegate* delegate() { return delegate_.get(); }
  33. bool IsJavascriptErrorReportingEnabled() override;
  34. private:
  35. // help_app::mojom::PageHandlerFactory:
  36. void CreatePageHandler(
  37. mojo::PendingReceiver<help_app::mojom::PageHandler> receiver) override;
  38. std::unique_ptr<HelpAppPageHandler> page_handler_;
  39. mojo::Receiver<help_app::mojom::PageHandlerFactory> page_factory_receiver_{
  40. this};
  41. std::unique_ptr<HelpAppUIDelegate> delegate_;
  42. WEB_UI_CONTROLLER_TYPE_DECL();
  43. };
  44. } // namespace ash
  45. #endif // ASH_WEBUI_HELP_APP_UI_HELP_APP_UI_H_