| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h" | 5 #include "chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h" |
| 6 | 6 |
| 7 #include <gtk/gtkunixprint.h> | 7 #include <gtk/gtkunixprint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 gtk_print_job_send(print_job, OnJobCompletedThunk, this, NULL); | 528 gtk_print_job_send(print_job, OnJobCompletedThunk, this, NULL); |
| 529 } | 529 } |
| 530 | 530 |
| 531 void PrintDialogGtk2::OnJobCompleted(GtkPrintJob* print_job, | 531 void PrintDialogGtk2::OnJobCompleted(GtkPrintJob* print_job, |
| 532 const GError* error) { | 532 const GError* error) { |
| 533 if (error) | 533 if (error) |
| 534 LOG(ERROR) << "Printing failed: " << error->message; | 534 LOG(ERROR) << "Printing failed: " << error->message; |
| 535 if (print_job) | 535 if (print_job) |
| 536 g_object_unref(print_job); | 536 g_object_unref(print_job); |
| 537 base::FileUtilProxy::DeleteFile( | 537 base::FileUtilProxy::DeleteFile( |
| 538 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(), | 538 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get(), |
| 539 path_to_pdf_, | 539 path_to_pdf_, false, base::FileUtilProxy::StatusCallback()); |
| 540 false, | |
| 541 base::FileUtilProxy::StatusCallback()); | |
| 542 // Printing finished. Matches AddRef() in PrintDocument(); | 540 // Printing finished. Matches AddRef() in PrintDocument(); |
| 543 Release(); | 541 Release(); |
| 544 } | 542 } |
| 545 | 543 |
| 546 void PrintDialogGtk2::InitPrintSettings(PrintSettings* settings) { | 544 void PrintDialogGtk2::InitPrintSettings(PrintSettings* settings) { |
| 547 InitPrintSettingsGtk(gtk_settings_, page_setup_, settings); | 545 InitPrintSettingsGtk(gtk_settings_, page_setup_, settings); |
| 548 context_->InitWithSettings(*settings); | 546 context_->InitWithSettings(*settings); |
| 549 } | 547 } |
| 550 | 548 |
| 551 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) { | 549 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) { |
| 552 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window); | 550 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window); |
| 553 | 551 |
| 554 libgtk2ui::ClearAuraTransientParent(dialog_); | 552 libgtk2ui::ClearAuraTransientParent(dialog_); |
| 555 window->RemoveObserver(this); | 553 window->RemoveObserver(this); |
| 556 if (!callback_.is_null()) { | 554 if (!callback_.is_null()) { |
| 557 callback_.Run(PrintingContextLinux::CANCEL); | 555 callback_.Run(PrintingContextLinux::CANCEL); |
| 558 callback_.Reset(); | 556 callback_.Reset(); |
| 559 } | 557 } |
| 560 } | 558 } |
| OLD | NEW |