Commit bc23592c authored by Hui Yingst's avatar Hui Yingst Committed by Chromium LUCI CQ

Set the background color and the toolbar height for PdfViewWebPlugin.

Bug: 1099020
Change-Id: I1cf7d7f1403bc9639568b451b409660edc9e264d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560911
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: default avatarK. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835076}
parent 313d49f8
......@@ -103,8 +103,19 @@ bool PdfViewWebPlugin::Initialize(blink::WebPluginContainer* container) {
std::string stream_url;
for (size_t i = 0; i < initial_params_.attribute_names.size(); ++i) {
if (initial_params_.attribute_names[i] == "stream-url")
if (initial_params_.attribute_names[i] == "stream-url") {
stream_url = initial_params_.attribute_values[i].Utf8();
} else if (initial_params_.attribute_names[i] == "background-color") {
if (!base::HexStringToUInt(initial_params_.attribute_values[i].Utf8(),
&background_color_)) {
return false;
}
} else if (initial_params_.attribute_names[i] == "top-toolbar-height") {
if (!base::StringToInt(initial_params_.attribute_values[i].Utf8(),
&top_toolbar_height_in_viewport_coords_)) {
return false;
}
}
}
// Contents of `initial_params_` no longer needed.
......@@ -268,7 +279,7 @@ bool PdfViewWebPlugin::IsPrintPreview() {
}
uint32_t PdfViewWebPlugin::GetBackgroundColor() {
return 0;
return background_color_;
}
void PdfViewWebPlugin::IsSelectingChanged(bool is_selecting) {}
......
......@@ -128,6 +128,12 @@ class PdfViewWebPlugin final : public PdfViewPluginBase,
blink::WebPluginParams initial_params_;
blink::WebPluginContainer* container_ = nullptr;
// The background color of the PDF viewer.
uint32_t background_color_ = 0;
// The blank space above the first page of the document reserved for the
// toolbar.
int top_toolbar_height_in_viewport_coords_ = 0;
base::WeakPtrFactory<PdfViewWebPlugin> weak_factory_{this};
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment