diagnostics_ui.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_DIAGNOSTICS_UI_DIAGNOSTICS_UI_H_
  5. #define ASH_WEBUI_DIAGNOSTICS_UI_DIAGNOSTICS_UI_H_
  6. #include "ash/webui/common/backend/plural_string_handler.h"
  7. #include "ash/webui/diagnostics_ui/backend/session_log_handler.h"
  8. #include "ash/webui/diagnostics_ui/diagnostics_metrics.h"
  9. #include "ash/webui/diagnostics_ui/diagnostics_metrics_message_handler.h"
  10. #include "ash/webui/diagnostics_ui/mojom/input_data_provider.mojom-forward.h"
  11. #include "ash/webui/diagnostics_ui/mojom/network_health_provider.mojom-forward.h"
  12. #include "ash/webui/diagnostics_ui/mojom/system_data_provider.mojom-forward.h"
  13. #include "ash/webui/diagnostics_ui/mojom/system_routine_controller.mojom-forward.h"
  14. #include "base/time/time.h"
  15. #include "mojo/public/cpp/bindings/pending_receiver.h"
  16. #include "ui/web_dialogs/web_dialog_ui.h"
  17. namespace base {
  18. class FilePath;
  19. } // namespace base
  20. namespace ash {
  21. class HoldingSpaceClient;
  22. namespace diagnostics {
  23. class DiagnosticsManager;
  24. class InputDataProvider;
  25. } // namespace diagnostics
  26. // The WebDialogUI for chrome://diagnostics.
  27. class DiagnosticsDialogUI : public ui::MojoWebDialogUI {
  28. public:
  29. explicit DiagnosticsDialogUI(
  30. content::WebUI* web_ui,
  31. const diagnostics::SessionLogHandler::SelectFilePolicyCreator&
  32. select_file_policy_creator,
  33. HoldingSpaceClient* holding_space_client,
  34. const base::FilePath& log_directory_path);
  35. ~DiagnosticsDialogUI() override;
  36. DiagnosticsDialogUI(const DiagnosticsDialogUI&) = delete;
  37. DiagnosticsDialogUI& operator=(const DiagnosticsDialogUI&) = delete;
  38. void BindInterface(
  39. mojo::PendingReceiver<diagnostics::mojom::NetworkHealthProvider>
  40. receiver);
  41. void BindInterface(
  42. mojo::PendingReceiver<diagnostics::mojom::SystemDataProvider> receiver);
  43. void BindInterface(
  44. mojo::PendingReceiver<diagnostics::mojom::SystemRoutineController>
  45. receiver);
  46. void BindInterface(
  47. mojo::PendingReceiver<diagnostics::mojom::InputDataProvider> receiver);
  48. private:
  49. WEB_UI_CONTROLLER_TYPE_DECL();
  50. // Timestamp of when the app was opened. Used to calculate a duration for
  51. // metrics.
  52. base::Time open_timestamp_;
  53. std::unique_ptr<diagnostics::DiagnosticsManager> diagnostics_manager_;
  54. std::unique_ptr<diagnostics::metrics::DiagnosticsMetrics>
  55. diagnostics_metrics_;
  56. std::unique_ptr<diagnostics::InputDataProvider> input_data_provider_;
  57. };
  58. } // namespace ash
  59. #endif // ASH_WEBUI_DIAGNOSTICS_UI_DIAGNOSTICS_UI_H_