fixup! [M120 Migration][NaCl][PPFWK] Upgradable pepper plugin requirement
[platform/framework/web/chromium-efl.git] / pdf / parsed_params.h
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.
4
5 #ifndef PDF_PARSED_PARAMS_H_
6 #define PDF_PARSED_PARAMS_H_
7
8 #include <string>
9
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"
13
14 namespace blink {
15 struct WebPluginParams;
16 }  // namespace blink
17
18 namespace chrome_pdf {
19
20 struct ParsedParams {
21   ParsedParams();
22   ParsedParams(const ParsedParams& other);
23   ParsedParams& operator=(const ParsedParams& other);
24   ParsedParams(ParsedParams&& other);
25   ParsedParams& operator=(ParsedParams&& other);
26   ~ParsedParams();
27
28   // The plugin source URL. Must not be empty.
29   std::string src_url;
30
31   // The document original URL. Must not be empty.
32   std::string original_url;
33
34   // The top-level URL.
35   std::string top_level_url;
36
37   // Whether the plugin should occupy the entire frame.
38   bool full_frame = false;
39
40   // The background color for the PDF viewer.
41   SkColor background_color = SK_ColorTRANSPARENT;
42
43   // Whether to execute JavaScript and maybe XFA.
44   PDFiumFormFiller::ScriptOption script_option =
45       PDFiumFormFiller::DefaultScriptOption();
46
47   // Whether the PDF was edited previously in annotation mode.
48   bool has_edits = false;
49
50   // Whether the PDF viewer uses Skia renderer. When set to false, the PDF
51   // viewer uses AGG renderer.
52   bool use_skia = false;
53 };
54
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);
59
60 }  // namespace chrome_pdf
61
62 #endif  // PDF_PARSED_PARAMS_H_