summaryrefslogtreecommitdiff
path: root/chromium/components/printing/service/public/interfaces/pdf_compositor.mojom
blob: 202d289a4cd5cfe379a6422f37c94e43d06d7947 (plain)
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
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module printing.mojom;

import "url/mojom/url.mojom";

const string kServiceName = "pdf_compositor";

interface PdfCompositor {
  // The status of composition and conversion execution.
  // These values are persisted to logs. Entries should not be renumbered and
  // numeric values should never be reused.
  enum Status {
    SUCCESS = 0,
    HANDLE_MAP_ERROR = 1,
    CONTENT_FORMAT_ERROR = 2,
    COMPOSTING_FAILURE = 3,
  };

  // Notifies that a subframe is unavailable, such as the render frame process
  // hosting it crashed or terminated. The subframe will be composited with no
  // content in the composited result.
  // |frame_guid| is this subframe's global unique id.
  NotifyUnavailableSubframe(uint64 frame_guid);

  // Adds the content of a subframe for composition.
  // |frame_guid| is this subframe's global unique id.
  // |serialized_content| points to a buffer of a serialized Skia picture which
  //                      has the painted content of this frame.
  // |subframe_content_map| records content id and its corresponding frame's
  //                        global unique id.
  AddSubframeContent(uint64 frame_guid, handle<shared_buffer> serialized_content,
                     map<uint32, uint64> subframe_content_info);

  // Requests to composite a page and convert it into a PDF file.
  // |frame_guid| is the global unique id of the frame to be composited.
  // |page_num| is zero-based sequence number of page.
  // |sk_handle| points to a buffer of a Skia MultiPictureDocument which has
  //             the drawing content of this frame or a page of this frame.
  // |subframe_content_map| records content id and its corresponding frame's
  //                        global unique id.
  CompositePageToPdf(uint64 frame_guid, uint32 page_num,
                     handle<shared_buffer> sk_handle,
                     map<uint32, uint64> subframe_content_info)
      => (Status status, handle<shared_buffer>? pdf_handle);

  // Requests to composite the entire document and convert it into a PDF file.
  // All the arguments carry the same meaning as CompositePageToPdf() above,
  // except this call doesn't have |page_num|.
  CompositeDocumentToPdf(uint64 frame_guid, handle<shared_buffer> sk_handle,
                         map<uint32, uint64> subframe_content_info)
      => (Status status, handle<shared_buffer>? pdf_handle);

  // Sets the URL which is committed in the main frame of the WebContents,
  // for use in crash diagnosis.
  SetWebContentsURL(url.mojom.Url url);
};