1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PDF_PARSED_PARAMS_H_
6 #define PDF_PARSED_PARAMS_H_
10 #include "pdf/pdfium/pdfium_form_filler.h"
11 #include "third_party/abseil-cpp/absl/types/optional.h"
12 #include "third_party/skia/include/core/SkColor.h"
15 struct WebPluginParams;
18 namespace chrome_pdf {
22 ParsedParams(const ParsedParams& other);
23 ParsedParams& operator=(const ParsedParams& other);
24 ParsedParams(ParsedParams&& other);
25 ParsedParams& operator=(ParsedParams&& other);
28 // The plugin source URL. Must not be empty.
31 // The document original URL. Must not be empty.
32 std::string original_url;
35 std::string top_level_url;
37 // Whether the plugin should occupy the entire frame.
38 bool full_frame = false;
40 // The background color for the PDF viewer.
41 SkColor background_color = SK_ColorTRANSPARENT;
43 // Whether to execute JavaScript and maybe XFA.
44 PDFiumFormFiller::ScriptOption script_option =
45 PDFiumFormFiller::DefaultScriptOption();
47 // Whether the PDF was edited previously in annotation mode.
48 bool has_edits = false;
50 // Whether the PDF viewer uses Skia renderer. When set to false, the PDF
51 // viewer uses AGG renderer.
52 bool use_skia = false;
55 // Creates an `ParsedParams` by parsing a `blink::WebPluginParams`. If
56 // `blink::WebPluginParams` is invalid, returns absl::nullopt.
57 absl::optional<ParsedParams> ParseWebPluginParams(
58 const blink::WebPluginParams& params);
60 } // namespace chrome_pdf
62 #endif // PDF_PARSED_PARAMS_H_