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
   48

ash / webui / print_management / backend / print_management_handler.h [blame]

// Copyright 2023 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_PRINT_MANAGEMENT_BACKEND_PRINT_MANAGEMENT_HANDLER_H_
#define ASH_WEBUI_PRINT_MANAGEMENT_BACKEND_PRINT_MANAGEMENT_HANDLER_H_

#include <memory>

#include "chromeos/components/print_management/mojom/printing_manager.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"

namespace ash::printing::printing_manager {

class PrintManagementDelegate;

class PrintManagementHandler : public chromeos::printing::printing_manager::
                                   mojom::PrintManagementHandler {
 public:
  explicit PrintManagementHandler(
      std::unique_ptr<PrintManagementDelegate> delegate);
  PrintManagementHandler(const PrintManagementHandler&) = delete;
  PrintManagementHandler& operator=(const PrintManagementHandler&) = delete;
  ~PrintManagementHandler() override;

  // PrintManagementHandler:
  void LaunchPrinterSettings(
      chromeos::printing::printing_manager::mojom::LaunchSource source)
      override;
  void RecordGetPrintJobsRequestDuration(uint32_t duration) override;

  void BindInterface(
      mojo::PendingReceiver<
          chromeos::printing::printing_manager::mojom::PrintManagementHandler>
          receiver);

 private:
  mojo::Receiver<
      chromeos::printing::printing_manager::mojom::PrintManagementHandler>
      receiver_{this};
  // Used to call browser functions from ash.
  std::unique_ptr<PrintManagementDelegate> delegate_;
};

}  // namespace ash::printing::printing_manager

#endif  // ASH_WEBUI_PRINT_MANAGEMENT_BACKEND_PRINT_MANAGEMENT_HANDLER_H_