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 <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
@@ -221,13 +223,13 @@ void PrintDialogGtk2::UseDefaultSettings() {
|
|||||||
InitPrintSettings(&settings);
|
InitPrintSettings(&settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintDialogGtk2::UpdateSettings(printing::PrintSettings* settings) {
|
void PrintDialogGtk2::UpdateSettings(printing::PrintSettings* settings) {
|
||||||
if (!gtk_settings_) {
|
if (!gtk_settings_) {
|
||||||
gtk_settings_ =
|
gtk_settings_ =
|
||||||
gtk_print_settings_copy(g_last_used_settings.Get().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(
|
printer_ = printer_list->GetPrinterWithName(
|
||||||
base::UTF16ToUTF8(settings->device_name()));
|
base::UTF16ToUTF8(settings->device_name()));
|
||||||
if (printer_) {
|
if (printer_) {
|
||||||
@@ -269,6 +271,7 @@ bool PrintDialogGtk2::UpdateSettings(printing::PrintSettings* settings) {
|
|||||||
gtk_print_settings_set(gtk_settings_, kCUPSDuplex, cups_duplex_mode);
|
gtk_print_settings_set(gtk_settings_, kCUPSDuplex, cups_duplex_mode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!page_setup_)
|
if (!page_setup_)
|
||||||
page_setup_ = gtk_page_setup_new();
|
page_setup_ = gtk_page_setup_new();
|
||||||
|
|
||||||
@@ -317,7 +320,6 @@ bool PrintDialogGtk2::UpdateSettings(printing::PrintSettings* settings) {
|
|||||||
: GTK_PAGE_ORIENTATION_PORTRAIT);
|
: GTK_PAGE_ORIENTATION_PORTRAIT);
|
||||||
|
|
||||||
InitPrintSettings(settings);
|
InitPrintSettings(settings);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintDialogGtk2::ShowDialog(
|
void PrintDialogGtk2::ShowDialog(
|
||||||
|
@@ -39,7 +39,7 @@ class PrintDialogGtk2 : public printing::PrintDialogGtkInterface,
|
|||||||
|
|
||||||
// printing::PrintDialogGtkInterface implementation.
|
// printing::PrintDialogGtkInterface implementation.
|
||||||
void UseDefaultSettings() override;
|
void UseDefaultSettings() override;
|
||||||
bool UpdateSettings(printing::PrintSettings* settings) override;
|
void UpdateSettings(printing::PrintSettings* settings) override;
|
||||||
void ShowDialog(
|
void ShowDialog(
|
||||||
gfx::NativeView parent_view,
|
gfx::NativeView parent_view,
|
||||||
bool has_selection,
|
bool has_selection,
|
||||||
|
@@ -23,8 +23,8 @@ class PrintDialogGtkInterface {
|
|||||||
virtual void UseDefaultSettings() = 0;
|
virtual void UseDefaultSettings() = 0;
|
||||||
|
|
||||||
// Updates the dialog to use |settings|. Only used when printing without the
|
// Updates the dialog to use |settings|. Only used when printing without the
|
||||||
// system print dialog. E.g. for Print Preview. Returns false on error.
|
// system print dialog. E.g. for Print Preview.
|
||||||
virtual bool UpdateSettings(PrintSettings* settings) = 0;
|
virtual void UpdateSettings(PrintSettings* settings) = 0;
|
||||||
|
|
||||||
// Shows the dialog and handles the response with |callback|. Only used when
|
// Shows the dialog and handles the response with |callback|. Only used when
|
||||||
// printing with the native print dialog.
|
// printing with the native print dialog.
|
||||||
|
@@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
#include "printing/printing_context_linux.h"
|
#include "printing/printing_context_linux.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
@@ -12,29 +15,27 @@
|
|||||||
#include "printing/print_job_constants.h"
|
#include "printing/print_job_constants.h"
|
||||||
#include "printing/units.h"
|
#include "printing/units.h"
|
||||||
|
|
||||||
|
namespace printing {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Function pointer for creating print dialogs. |callback| is only used when
|
// Function pointer for creating print dialogs. |callback| is only used when
|
||||||
// |show_dialog| is true.
|
// |show_dialog| is true.
|
||||||
printing::PrintDialogGtkInterface* (*create_dialog_func_)(
|
PrintDialogGtkInterface* (*create_dialog_func_)(PrintingContextLinux* context) =
|
||||||
printing::PrintingContextLinux* context) = NULL;
|
nullptr;
|
||||||
|
|
||||||
// Function pointer for determining paper size.
|
// Function pointer for determining paper size.
|
||||||
gfx::Size (*get_pdf_paper_size_)(
|
gfx::Size (*get_pdf_paper_size_)(PrintingContextLinux* context) = nullptr;
|
||||||
printing::PrintingContextLinux* context) = NULL;
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace printing {
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
std::unique_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) {
|
std::unique_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) {
|
||||||
return base::WrapUnique(new PrintingContextLinux(delegate));
|
return base::WrapUnique(new PrintingContextLinux(delegate));
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintingContextLinux::PrintingContextLinux(Delegate* delegate)
|
PrintingContextLinux::PrintingContextLinux(Delegate* delegate)
|
||||||
: PrintingContext(delegate), print_dialog_(NULL) {
|
: PrintingContext(delegate), print_dialog_(nullptr) {}
|
||||||
}
|
|
||||||
|
|
||||||
PrintingContextLinux::~PrintingContextLinux() {
|
PrintingContextLinux::~PrintingContextLinux() {
|
||||||
ReleaseContext();
|
ReleaseContext();
|
||||||
@@ -121,9 +122,7 @@ PrintingContext::Result PrintingContextLinux::UpdatePrinterSettings(
|
|||||||
print_dialog_->AddRefToDialog();
|
print_dialog_->AddRefToDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!print_dialog_->UpdateSettings(&settings_))
|
print_dialog_->UpdateSettings(&settings_);
|
||||||
return OnError();
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +182,7 @@ void PrintingContextLinux::ReleaseContext() {
|
|||||||
|
|
||||||
printing::NativeDrawingContext PrintingContextLinux::context() const {
|
printing::NativeDrawingContext PrintingContextLinux::context() const {
|
||||||
// Intentional No-op.
|
// Intentional No-op.
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace printing
|
} // namespace printing
|
||||||
|
Reference in New Issue
Block a user