Remove return value from PrintDialogGtkInterface::UpdateSettings().
It always returns true. Change-Id: I25fee275c7c970dceb00dc13bd74abf1e72cea26 Reviewed-on: https://chromium-review.googlesource.com/1043053 Reviewed-by: Rebekah Potter <rbpotter@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#556105}
This commit is contained in:
chrome/browser/ui/libgtkui
printing
@ -8,7 +8,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -221,13 +223,13 @@ void PrintDialogGtk2::UseDefaultSettings() {
|
||||
InitPrintSettings(&settings);
|
||||
}
|
||||
|
||||
bool PrintDialogGtk2::UpdateSettings(printing::PrintSettings* settings) {
|
||||
void PrintDialogGtk2::UpdateSettings(printing::PrintSettings* settings) {
|
||||
if (!gtk_settings_) {
|
||||
gtk_settings_ =
|
||||
gtk_print_settings_copy(g_last_used_settings.Get().settings());
|
||||
}
|
||||
|
||||
std::unique_ptr<GtkPrinterList> printer_list(new GtkPrinterList);
|
||||
auto printer_list = std::make_unique<GtkPrinterList>();
|
||||
printer_ = printer_list->GetPrinterWithName(
|
||||
base::UTF16ToUTF8(settings->device_name()));
|
||||
if (printer_) {
|
||||
@ -269,6 +271,7 @@ bool PrintDialogGtk2::UpdateSettings(printing::PrintSettings* settings) {
|
||||
gtk_print_settings_set(gtk_settings_, kCUPSDuplex, cups_duplex_mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!page_setup_)
|
||||
page_setup_ = gtk_page_setup_new();
|
||||
|
||||
@ -317,7 +320,6 @@ bool PrintDialogGtk2::UpdateSettings(printing::PrintSettings* settings) {
|
||||
: GTK_PAGE_ORIENTATION_PORTRAIT);
|
||||
|
||||
InitPrintSettings(settings);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PrintDialogGtk2::ShowDialog(
|
||||
|
@ -39,7 +39,7 @@ class PrintDialogGtk2 : public printing::PrintDialogGtkInterface,
|
||||
|
||||
// printing::PrintDialogGtkInterface implementation.
|
||||
void UseDefaultSettings() override;
|
||||
bool UpdateSettings(printing::PrintSettings* settings) override;
|
||||
void UpdateSettings(printing::PrintSettings* settings) override;
|
||||
void ShowDialog(
|
||||
gfx::NativeView parent_view,
|
||||
bool has_selection,
|
||||
|
@ -23,8 +23,8 @@ class PrintDialogGtkInterface {
|
||||
virtual void UseDefaultSettings() = 0;
|
||||
|
||||
// Updates the dialog to use |settings|. Only used when printing without the
|
||||
// system print dialog. E.g. for Print Preview. Returns false on error.
|
||||
virtual bool UpdateSettings(PrintSettings* settings) = 0;
|
||||
// system print dialog. E.g. for Print Preview.
|
||||
virtual void UpdateSettings(PrintSettings* settings) = 0;
|
||||
|
||||
// Shows the dialog and handles the response with |callback|. Only used when
|
||||
// printing with the native print dialog.
|
||||
|
@ -4,6 +4,9 @@
|
||||
|
||||
#include "printing/printing_context_linux.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/values.h"
|
||||
@ -12,29 +15,27 @@
|
||||
#include "printing/print_job_constants.h"
|
||||
#include "printing/units.h"
|
||||
|
||||
namespace printing {
|
||||
|
||||
namespace {
|
||||
|
||||
// Function pointer for creating print dialogs. |callback| is only used when
|
||||
// |show_dialog| is true.
|
||||
printing::PrintDialogGtkInterface* (*create_dialog_func_)(
|
||||
printing::PrintingContextLinux* context) = NULL;
|
||||
PrintDialogGtkInterface* (*create_dialog_func_)(PrintingContextLinux* context) =
|
||||
nullptr;
|
||||
|
||||
// Function pointer for determining paper size.
|
||||
gfx::Size (*get_pdf_paper_size_)(
|
||||
printing::PrintingContextLinux* context) = NULL;
|
||||
gfx::Size (*get_pdf_paper_size_)(PrintingContextLinux* context) = nullptr;
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace printing {
|
||||
|
||||
// static
|
||||
std::unique_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) {
|
||||
return base::WrapUnique(new PrintingContextLinux(delegate));
|
||||
}
|
||||
|
||||
PrintingContextLinux::PrintingContextLinux(Delegate* delegate)
|
||||
: PrintingContext(delegate), print_dialog_(NULL) {
|
||||
}
|
||||
: PrintingContext(delegate), print_dialog_(nullptr) {}
|
||||
|
||||
PrintingContextLinux::~PrintingContextLinux() {
|
||||
ReleaseContext();
|
||||
@ -121,9 +122,7 @@ PrintingContext::Result PrintingContextLinux::UpdatePrinterSettings(
|
||||
print_dialog_->AddRefToDialog();
|
||||
}
|
||||
|
||||
if (!print_dialog_->UpdateSettings(&settings_))
|
||||
return OnError();
|
||||
|
||||
print_dialog_->UpdateSettings(&settings_);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -183,7 +182,7 @@ void PrintingContextLinux::ReleaseContext() {
|
||||
|
||||
printing::NativeDrawingContext PrintingContextLinux::context() const {
|
||||
// Intentional No-op.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace printing
|
||||
|
Reference in New Issue
Block a user