Commit 7095383c authored by habib.virji's avatar habib.virji Committed by Commit bot

Change return type of PrintPage

PrintPage should not return a bool parameter. The return type has been changed to void.

To keep it compatible with the blink code, old function has been kept.

R=pdr
BUG=496765

Review URL: https://codereview.chromium.org/1149983008

Cr-Commit-Position: refs/heads/master@{#333715}
parent 4f7112f9
......@@ -1742,7 +1742,7 @@ int PepperPluginInstanceImpl::PrintBegin(const WebPrintParams& print_params) {
return num_pages;
}
bool PepperPluginInstanceImpl::PrintPage(int page_number,
void PepperPluginInstanceImpl::PrintPage(int page_number,
blink::WebCanvas* canvas) {
#if defined(ENABLE_PRINTING)
DCHECK(plugin_print_interface_);
......@@ -1757,16 +1757,13 @@ bool PepperPluginInstanceImpl::PrintPage(int page_number,
if (save_for_later) {
ranges_.push_back(page_range);
canvas_ = skia::SharePtr(canvas);
return true;
} else {
return PrintPageHelper(&page_range, 1, canvas);
PrintPageHelper(&page_range, 1, canvas);
}
#else // ENABLE_PRINTING
return false;
#endif
}
bool PepperPluginInstanceImpl::PrintPageHelper(
void PepperPluginInstanceImpl::PrintPageHelper(
PP_PrintPageNumberRange_Dev* page_ranges,
int num_ranges,
blink::WebCanvas* canvas) {
......@@ -1774,21 +1771,17 @@ bool PepperPluginInstanceImpl::PrintPageHelper(
scoped_refptr<PepperPluginInstanceImpl> ref(this);
DCHECK(plugin_print_interface_);
if (!plugin_print_interface_)
return false;
return;
PP_Resource print_output = plugin_print_interface_->PrintPages(
pp_instance(), page_ranges, num_ranges);
if (!print_output)
return false;
bool ret = false;
return;
if (current_print_settings_.format == PP_PRINTOUTPUTFORMAT_PDF)
ret = PrintPDFOutput(print_output, canvas);
PrintPDFOutput(print_output, canvas);
// Now we need to release the print output resource.
PluginModule::GetCore()->ReleaseResource(print_output);
return ret;
}
void PepperPluginInstanceImpl::PrintEnd() {
......
......@@ -255,7 +255,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
bool SupportsPrintInterface();
bool IsPrintScalingDisabled();
int PrintBegin(const blink::WebPrintParams& print_params);
bool PrintPage(int page_number, blink::WebCanvas* canvas);
void PrintPage(int page_number, blink::WebCanvas* canvas);
void PrintEnd();
bool GetPrintPresetOptionsFromDocument(
blink::WebPrintPresetOptions* preset_options);
......@@ -644,7 +644,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
void UpdateLayer(bool device_changed);
// Internal helper function for PrintPage().
bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges,
void PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges,
int num_ranges,
blink::WebCanvas* canvas);
......
......@@ -270,10 +270,16 @@ int PepperWebPluginImpl::printBegin(const WebPrintParams& print_params) {
return instance_->PrintBegin(print_params);
}
bool PepperWebPluginImpl::printPage(int page_number, blink::WebCanvas* canvas) {
void PepperWebPluginImpl::printPage(int page_number, blink::WebCanvas* canvas,
bool unused) {
return instance_->PrintPage(page_number, canvas);
}
bool PepperWebPluginImpl::printPage(int page_number, blink::WebCanvas* canvas) {
instance_->PrintPage(page_number, canvas);
return true;
}
void PepperWebPluginImpl::printEnd() { return instance_->PrintEnd(); }
bool PepperWebPluginImpl::getPrintPresetOptionsFromDocument(
......
......@@ -84,6 +84,8 @@ class PepperWebPluginImpl : public blink::WebPlugin {
virtual int printBegin(const blink::WebPrintParams& print_params) override;
virtual bool printPage(int page_number, blink::WebCanvas* canvas) override;
virtual void printPage(int page_number, blink::WebCanvas* canvas,
bool unused);
virtual void printEnd() override;
virtual bool canRotateView() override;
......
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