| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/message_loop.h" | |
| 14 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
| 15 #include "chrome/browser/browser_window.h" | 14 #include "chrome/browser/browser_window.h" |
| 15 #include "chrome/browser/chrome_thread.h" |
| 16 #include "chrome/browser/tab_contents/infobar_delegate.h" | 16 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 17 #include "chrome/browser/tab_contents/tab_contents.h" | 17 #include "chrome/browser/tab_contents/tab_contents.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // This is a temporary infobar designed to help gauge how many users are trying | 21 // This is a temporary infobar designed to help gauge how many users are trying |
| 22 // to print to printers that don't support PDF. | 22 // to print to printers that don't support PDF. |
| 23 class PdfUnsupportedInfoBarDelegate : public LinkInfoBarDelegate { | 23 class PdfUnsupportedInfoBarDelegate : public LinkInfoBarDelegate { |
| 24 public: | 24 public: |
| 25 explicit PdfUnsupportedInfoBarDelegate(Browser* browser) | 25 explicit PdfUnsupportedInfoBarDelegate(Browser* browser) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 Browser* browser_; | 55 Browser* browser_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 // static | 60 // static |
| 61 void PrintDialogGtk::CreatePrintDialogForPdf(const FilePath& path, | 61 void PrintDialogGtk::CreatePrintDialogForPdf(const FilePath& path) { |
| 62 MessageLoop* loop) { | 62 ChromeThread::PostTask( |
| 63 loop->PostTask(FROM_HERE, | 63 ChromeThread::UI, FROM_HERE, |
| 64 NewRunnableFunction(&PrintDialogGtk::CreateDialogImpl, path)); | 64 NewRunnableFunction(&PrintDialogGtk::CreateDialogImpl, path)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // static | 67 // static |
| 68 void PrintDialogGtk::CreateDialogImpl(const FilePath& path) { | 68 void PrintDialogGtk::CreateDialogImpl(const FilePath& path) { |
| 69 new PrintDialogGtk(path); | 69 new PrintDialogGtk(path); |
| 70 } | 70 } |
| 71 | 71 |
| 72 PrintDialogGtk::PrintDialogGtk(const FilePath& path_to_pdf) | 72 PrintDialogGtk::PrintDialogGtk(const FilePath& path_to_pdf) |
| 73 : path_to_pdf_(path_to_pdf), | 73 : path_to_pdf_(path_to_pdf), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 if (error) | 133 if (error) |
| 134 LOG(ERROR) << "Printing failed: " << error->message; | 134 LOG(ERROR) << "Printing failed: " << error->message; |
| 135 | 135 |
| 136 if (job) | 136 if (job) |
| 137 g_object_unref(job); | 137 g_object_unref(job); |
| 138 | 138 |
| 139 file_util::Delete(path_to_pdf_, false); | 139 file_util::Delete(path_to_pdf_, false); |
| 140 | 140 |
| 141 delete this; | 141 delete this; |
| 142 } | 142 } |
| OLD | NEW |