OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <fcntl.h> | 7 #include <fcntl.h> |
8 #include <gtk/gtkunixprint.h> | 8 #include <gtk/gtkunixprint.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 AddRef(); | 268 AddRef(); |
269 | 269 |
270 bool error = false; | 270 bool error = false; |
271 if (!file_util::CreateTemporaryFile(&path_to_pdf_)) { | 271 if (!file_util::CreateTemporaryFile(&path_to_pdf_)) { |
272 LOG(ERROR) << "Creating temporary file failed"; | 272 LOG(ERROR) << "Creating temporary file failed"; |
273 error = true; | 273 error = true; |
274 } | 274 } |
275 | 275 |
276 if (!error && !metafile->SaveTo(path_to_pdf_)) { | 276 if (!error && !metafile->SaveTo(path_to_pdf_)) { |
277 LOG(ERROR) << "Saving metafile failed"; | 277 LOG(ERROR) << "Saving metafile failed"; |
278 file_util::Delete(path_to_pdf_, false); | 278 base::Delete(path_to_pdf_, false); |
279 error = true; | 279 error = true; |
280 } | 280 } |
281 | 281 |
282 if (error) { | 282 if (error) { |
283 // Matches AddRef() above. | 283 // Matches AddRef() above. |
284 Release(); | 284 Release(); |
285 } else { | 285 } else { |
286 // No errors, continue printing. | 286 // No errors, continue printing. |
287 BrowserThread::PostTask( | 287 BrowserThread::PostTask( |
288 BrowserThread::UI, FROM_HERE, | 288 BrowserThread::UI, FROM_HERE, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // Printing finished. Matches AddRef() in PrintDocument(); | 414 // Printing finished. Matches AddRef() in PrintDocument(); |
415 Release(); | 415 Release(); |
416 } | 416 } |
417 | 417 |
418 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges, | 418 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges, |
419 PrintSettings* settings) { | 419 PrintSettings* settings) { |
420 printing::PrintSettingsInitializerGtk::InitPrintSettings( | 420 printing::PrintSettingsInitializerGtk::InitPrintSettings( |
421 gtk_settings_, page_setup_, page_ranges, false, settings); | 421 gtk_settings_, page_setup_, page_ranges, false, settings); |
422 context_->InitWithSettings(*settings); | 422 context_->InitWithSettings(*settings); |
423 } | 423 } |
OLD | NEW |