printing_metrics.mojom 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2022 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. module crosapi.mojom;
  5. import "mojo/public/mojom/base/values.mojom";
  6. import "mojo/public/mojom/base/file_path.mojom";
  7. // Listens to events dispatched by ash::PrintJobHistoryService in ash and
  8. // sends them to lacros. See chrome.printingMetrics.onPrintJobFinished event.
  9. // Next version: 1
  10. // Next method id: 1
  11. [Stable, Uuid="64680b44-074e-4aa0-93ce-3c0956e192a0"]
  12. interface PrintJobObserverForProfile {
  13. // Forwards OnPrintJobFinished() event from ash::PrintJobHistoryService
  14. // to the browser.
  15. //
  16. // The supplied value is the chrome.printintMetrics.PrintJobInfo object
  17. // serialized as base::Value.
  18. // See chrome/common/extensions/api/printing_metrics.idl for details.
  19. //
  20. // We use mojo_base.mojom.Value as the type because:
  21. // * The idl for the API is stable and can easily be serialized and
  22. // deserialized into base::Value
  23. // * Both the supplier and consumer of this information uses a type
  24. // interchangeable with mojo_base.mojom.Value. While we could add
  25. // a translation layer to a strongly typed mojom struct, this adds an
  26. // overhead and the potential for errors with no benefit.
  27. OnPrintJobFinished@0(mojo_base.mojom.Value print_job);
  28. };
  29. // PrintingMetricsForProfile processes chrome.printingMetrics API calls
  30. // for the associated profile on the ash side.
  31. // Next version: 1
  32. // Next method id: 1
  33. [Stable, Uuid="27ba5fb3-5624-4b6d-8909-8243a0ffd7aa"]
  34. interface PrintingMetricsForProfile {
  35. // Implements chrome.printingMetrics.getPrintJobs(...)
  36. //
  37. // The return values are chrome.printingMetrics.PrintJobInfo objects
  38. // serialized as base::Value.
  39. // See chrome/common/extensions/api/printing_metrics.idl for details.
  40. //
  41. // We use mojo_base.mojom.Value as the type because:
  42. // * The idl for the API is stable and can easily be serialized and
  43. // deserialized into base::Value
  44. // * Both the supplier and consumer of this information uses a type
  45. // interchangeable with mojo_base.mojom.Value. While we could add
  46. // a translation layer to a strongly typed mojom struct, this adds an
  47. // overhead and the potential for errors with no benefit.
  48. GetPrintJobs@0() => (array<mojo_base.mojom.Value> print_jobs);
  49. };
  50. // PrintingMetrics is the entry point for chrome.printingMetrics API
  51. // on the ash side.
  52. // Next version: 1
  53. // Next method id: 1
  54. [Stable, Uuid="e27e7b78-f2ce-4d06-8bc9-e247f8edf355"]
  55. interface PrintingMetrics {
  56. // Registers a service for the main profile and allows ash to
  57. // send printing events via |observer|.
  58. RegisterForMainProfile@0(pending_receiver<PrintingMetricsForProfile> receiver,
  59. pending_remote<PrintJobObserverForProfile> observer);
  60. };