shimless_rma.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2021 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_SHIMLESS_RMA_SHIMLESS_RMA_H_
  5. #define ASH_WEBUI_SHIMLESS_RMA_SHIMLESS_RMA_H_
  6. #include <memory>
  7. #include "ash/webui/shimless_rma/backend/shimless_rma_service.h"
  8. #include "ash/webui/shimless_rma/mojom/shimless_rma.mojom-forward.h"
  9. #include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h" // nogncheck
  10. #include "mojo/public/cpp/bindings/pending_receiver.h"
  11. #include "ui/web_dialogs/web_dialog_ui.h"
  12. namespace content {
  13. class WebUI;
  14. } // namespace content
  15. namespace ash {
  16. namespace shimless_rma {
  17. class ShimlessRmaDelegate;
  18. // Returns true if RMA is allowed on the device.
  19. bool IsShimlessRmaAllowed();
  20. // Returns true if the kLaunchRma switch is detected and RMA is allowed.
  21. bool HasLaunchRmaSwitchAndIsAllowed();
  22. } // namespace shimless_rma
  23. // The WebUI for ShimlessRMA or chrome://shimless-rma.
  24. class ShimlessRMADialogUI : public ui::MojoWebDialogUI {
  25. public:
  26. ShimlessRMADialogUI(
  27. content::WebUI* web_ui,
  28. std::unique_ptr<shimless_rma::ShimlessRmaDelegate> shimless_rma_delegate);
  29. ~ShimlessRMADialogUI() override;
  30. ShimlessRMADialogUI(const ShimlessRMADialogUI&) = delete;
  31. ShimlessRMADialogUI& operator=(const ShimlessRMADialogUI&) = delete;
  32. void BindInterface(
  33. mojo::PendingReceiver<chromeos::network_config::mojom::CrosNetworkConfig>
  34. receiver);
  35. void BindInterface(
  36. mojo::PendingReceiver<shimless_rma::mojom::ShimlessRmaService> receiver);
  37. private:
  38. std::unique_ptr<shimless_rma::ShimlessRmaService> shimless_rma_manager_;
  39. WEB_UI_CONTROLLER_TYPE_DECL();
  40. };
  41. } // namespace ash
  42. #endif // ASH_WEBUI_SHIMLESS_RMA_SHIMLESS_RMA_H_