Various fixes related to the C++11/14 update (see issue #3140)

- Convert scoped_ptr to std::unique_ptr from <memory>
- Convert arraysize to base::size from include/base/cef_cxx17_backports.h
- Convert NULL to nullptr
- Include include/base/cef_callback.h instead of include/base/cef_bind.h
- Implicit conversion of CefRefPtr<T> or scoped_refptr<T> to T* is gone;
  use .get() instead

See the issue for additional details.
This commit is contained in:
Marshall Greenblatt
2021-06-17 16:08:01 -04:00
parent 5d438ced79
commit 17fc2b3e3b
141 changed files with 580 additions and 627 deletions

View File

@@ -10,7 +10,7 @@
#include <gtk/gtk.h>
#include <gtk/gtkunixprint.h>
#include "include/base/cef_bind.h"
#include "include/base/cef_callback.h"
#include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/wrapper/cef_helpers.h"
@@ -95,7 +95,7 @@ StickyPrintSettingGtk* GetLastUsedSettings() {
class GtkPrinterList {
public:
GtkPrinterList() : default_printer_(nullptr) {
gtk_enumerate_printers(SetPrinter, this, NULL, TRUE);
gtk_enumerate_printers(SetPrinter, this, nullptr, TRUE);
}
~GtkPrinterList() {
@@ -105,11 +105,11 @@ class GtkPrinterList {
}
}
// Can return NULL if there's no default printer. E.g. Printer on a laptop
// Can return nullptr if there's no default printer. E.g. Printer on a laptop
// is "home_printer", but the laptop is at work.
GtkPrinter* default_printer() { return default_printer_; }
// Can return NULL if the printer cannot be found due to:
// Can return nullptr if the printer cannot be found due to:
// - Printer list out of sync with printer dialog UI.
// - Querying for non-existant printers like 'Print to PDF'.
GtkPrinter* GetPrinterWithName(const std::string& name) {
@@ -272,8 +272,8 @@ void InitPrintSettings(GtkPrintSettings* settings,
printable_area_device_units, true);
}
// Returns the GtkWindow* for the browser. Will return NULL when using the Views
// framework.
// Returns the GtkWindow* for the browser. Will return nullptr when using the
// Views framework.
GtkWindow* GetWindow(CefRefPtr<CefBrowser> browser) {
scoped_refptr<RootWindow> root_window =
RootWindow::GetForBrowser(browser->GetIdentifier());
@@ -410,9 +410,9 @@ struct ClientPrintHandlerGtk::PrintHandler {
ScopedGdkThreadsEnter scoped_gdk_threads;
// TODO(estade): We need a window title here.
dialog_ = gtk_print_unix_dialog_new(NULL, parent);
dialog_ = gtk_print_unix_dialog_new(nullptr, parent);
g_signal_connect(dialog_, "delete-event",
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
G_CALLBACK(gtk_widget_hide_on_delete), nullptr);
// Set modal so user cannot focus the same tab and press print again.
gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
@@ -441,8 +441,8 @@ struct ClientPrintHandlerGtk::PrintHandler {
bool OnPrintJob(const CefString& document_name,
const CefString& pdf_file_path,
CefRefPtr<CefPrintJobCallback> callback) {
// If |printer_| is NULL then somehow the GTK printer list changed out under
// us. In which case, just bail out.
// If |printer_| is nullptr then somehow the GTK printer list changed out
// under us. In which case, just bail out.
if (!printer_)
return false;
@@ -456,8 +456,8 @@ struct ClientPrintHandlerGtk::PrintHandler {
GtkPrintJob* print_job = gtk_print_job_new(
document_name.ToString().c_str(), printer_, gtk_settings_, page_setup_);
gtk_print_job_set_source_file(print_job, pdf_file_path.ToString().c_str(),
NULL);
gtk_print_job_send(print_job, OnJobCompletedThunk, this, NULL);
nullptr);
gtk_print_job_send(print_job, OnJobCompletedThunk, this, nullptr);
return true;
}