| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/printing/print_dialog_gtk.h" | 5 #include "chrome/browser/printing/print_dialog_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtkprintjob.h> | 7 #include <gtk/gtkprintjob.h> |
| 8 #include <gtk/gtkprintunixdialog.h> | 8 #include <gtk/gtkprintunixdialog.h> |
| 9 #include <gtk/gtkpagesetupunixdialog.h> | 9 #include <gtk/gtkpagesetupunixdialog.h> |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // static | 84 // static |
| 85 void PrintDialogGtk::CreateDialogImpl(const FilePath& path) { | 85 void PrintDialogGtk::CreateDialogImpl(const FilePath& path) { |
| 86 // Only show one print dialog at once. This is to prevent a page from | 86 // Only show one print dialog at once. This is to prevent a page from |
| 87 // locking up the system with | 87 // locking up the system with |
| 88 // | 88 // |
| 89 // while(true){print();} | 89 // while(true){print();} |
| 90 base::AutoLock lock(DialogLock()); | 90 base::AutoLock lock(DialogLock()); |
| 91 if (g_print_dialog) { | 91 if (g_print_dialog) { |
| 92 // Clean up the temporary file. | 92 // Clean up the temporary file. |
| 93 base::FileUtilProxy::Delete( | 93 base::FileUtilProxy::GetInstance()->Delete( |
| 94 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 94 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
| 95 path, false, NULL); | 95 path, false, NULL); |
| 96 return; | 96 return; |
| 97 } | 97 } |
| 98 | 98 |
| 99 g_print_dialog = new PrintDialogGtk(path); | 99 g_print_dialog = new PrintDialogGtk(path); |
| 100 } | 100 } |
| 101 | 101 |
| 102 PrintDialogGtk::PrintDialogGtk(const FilePath& path_to_pdf) | 102 PrintDialogGtk::PrintDialogGtk(const FilePath& path_to_pdf) |
| 103 : path_to_pdf_(path_to_pdf), | 103 : path_to_pdf_(path_to_pdf), |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 void PrintDialogGtk::OnJobCompleted(GtkPrintJob* job, GError* error) { | 172 void PrintDialogGtk::OnJobCompleted(GtkPrintJob* job, GError* error) { |
| 173 gtk_widget_destroy(dialog_); | 173 gtk_widget_destroy(dialog_); |
| 174 | 174 |
| 175 if (error) | 175 if (error) |
| 176 LOG(ERROR) << "Printing failed: " << error->message; | 176 LOG(ERROR) << "Printing failed: " << error->message; |
| 177 | 177 |
| 178 if (job) | 178 if (job) |
| 179 g_object_unref(job); | 179 g_object_unref(job); |
| 180 | 180 |
| 181 base::FileUtilProxy::Delete( | 181 base::FileUtilProxy::GetInstance()->Delete( |
| 182 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 182 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
| 183 path_to_pdf_, | 183 path_to_pdf_, |
| 184 false, | 184 false, |
| 185 NULL); | 185 NULL); |
| 186 | 186 |
| 187 delete this; | 187 delete this; |
| 188 } | 188 } |
| OLD | NEW |