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: K. Moon <kmoon@chromium.org> Cr-Commit-Position: refs/heads/master@{#835076}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
313d49f898
commit
bc23592cec
@ -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};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user