1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47

ash / webui / growth_internals / growth_internals_ui.h [blame]

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_GROWTH_INTERNALS_GROWTH_INTERNALS_UI_H_
#define ASH_WEBUI_GROWTH_INTERNALS_GROWTH_INTERNALS_UI_H_

#include <memory>

#include "ash/webui/common/chrome_os_webui_config.h"
#include "ash/webui/growth_internals/constants.h"
#include "ash/webui/growth_internals/growth_internals.mojom-forward.h"
#include "content/public/common/url_constants.h"
#include "ui/webui/mojo_web_ui_controller.h"

namespace ash {

class GrowthInternalsPageHandler;
class GrowthInternalsUI;

class GrowthInternalsUIConfig : public ChromeOSWebUIConfig<GrowthInternalsUI> {
 public:
  GrowthInternalsUIConfig()
      : ChromeOSWebUIConfig<GrowthInternalsUI>(content::kChromeUIScheme,
                                               kGrowthInternalsHost) {}

  // content::WebUIConfig:
  bool IsWebUIEnabled(content::BrowserContext* browser_context) override;
};

class GrowthInternalsUI : public ui::MojoWebUIController {
 public:
  explicit GrowthInternalsUI(content::WebUI* web_ui);
  ~GrowthInternalsUI() override;

  void BindInterface(
      mojo::PendingReceiver<growth::mojom::PageHandler> receiver);

 private:
  std::unique_ptr<GrowthInternalsPageHandler> page_handler_;

  WEB_UI_CONTROLLER_TYPE_DECL();
};

}  // namespace ash

#endif  // ASH_WEBUI_GROWTH_INTERNALS_GROWTH_INTERNALS_UI_H_