scanning_ui.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_SCANNING_SCANNING_UI_H_
  5. #define ASH_WEBUI_SCANNING_SCANNING_UI_H_
  6. #include <memory>
  7. #include "ash/webui/common/mojom/accessibility_features.mojom.h"
  8. #include "ash/webui/scanning/mojom/scanning.mojom-forward.h"
  9. #include "ash/webui/scanning/scanning_handler.h"
  10. #include "base/callback.h"
  11. #include "mojo/public/cpp/bindings/pending_receiver.h"
  12. #include "ui/webui/mojo_web_ui_controller.h"
  13. namespace content {
  14. class WebUI;
  15. } // namespace content
  16. namespace ash {
  17. class AccessibilityFeatures;
  18. class ScanningAppDelegate;
  19. // The WebUI for chrome://scanning.
  20. class ScanningUI : public ui::MojoWebUIController {
  21. public:
  22. using BindScanServiceCallback = base::RepeatingCallback<void(
  23. mojo::PendingReceiver<scanning::mojom::ScanService>)>;
  24. // |callback| should bind the pending receiver to an implementation of
  25. // ash::scanning::mojom::ScanService.
  26. ScanningUI(content::WebUI* web_ui,
  27. BindScanServiceCallback callback,
  28. std::unique_ptr<ScanningAppDelegate> scanning_app_delegate);
  29. ~ScanningUI() override;
  30. ScanningUI(const ScanningUI&) = delete;
  31. ScanningUI& operator=(const ScanningUI&) = delete;
  32. // Instantiates the implementor of the ash::scanning::mojom::ScanService
  33. // Mojo interface by passing the pending receiver that will be internally
  34. // bound.
  35. void BindInterface(
  36. mojo::PendingReceiver<scanning::mojom::ScanService> pending_receiver);
  37. // Instantiates the implementor of the
  38. // ash::common::mojom::AccessibilityFeatures Mojo interface by passing the
  39. // pending receiver that will be internally bound.
  40. void BindInterface(mojo::PendingReceiver<common::mojom::AccessibilityFeatures>
  41. pending_receiver);
  42. private:
  43. const BindScanServiceCallback bind_pending_receiver_callback_;
  44. std::unique_ptr<AccessibilityFeatures> accessibility_features_;
  45. WEB_UI_CONTROLLER_TYPE_DECL();
  46. };
  47. } // namespace ash
  48. #endif // ASH_WEBUI_SCANNING_SCANNING_UI_H_