| 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> |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/file_util_proxy.h" | 17 #include "base/file_util_proxy.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/message_loop_proxy.h" | 19 #include "base/message_loop_proxy.h" |
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 21 #include "base/values.h" |
| 22 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_list.h" |
| 22 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
| 23 #include "printing/metafile.h" | 25 #include "printing/metafile.h" |
| 24 #include "printing/print_job_constants.h" | 26 #include "printing/print_job_constants.h" |
| 25 #include "printing/print_settings.h" | 27 #include "printing/print_settings.h" |
| 26 #include "printing/print_settings_initializer_gtk.h" | 28 #include "printing/print_settings_initializer_gtk.h" |
| 27 | 29 |
| 28 using content::BrowserThread; | 30 using content::BrowserThread; |
| 29 using printing::PageRanges; | 31 using printing::PageRanges; |
| 30 using printing::PrintSettings; | 32 using printing::PrintSettings; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 147 |
| 146 if (!page_setup_) | 148 if (!page_setup_) |
| 147 page_setup_ = gtk_page_setup_new(); | 149 page_setup_ = gtk_page_setup_new(); |
| 148 | 150 |
| 149 // No page range to initialize for default settings. | 151 // No page range to initialize for default settings. |
| 150 PageRanges ranges_vector; | 152 PageRanges ranges_vector; |
| 151 PrintSettings settings; | 153 PrintSettings settings; |
| 152 InitPrintSettings(ranges_vector, &settings); | 154 InitPrintSettings(ranges_vector, &settings); |
| 153 } | 155 } |
| 154 | 156 |
| 155 bool PrintDialogGtk::UpdateSettings(const DictionaryValue& job_settings, | 157 bool PrintDialogGtk::UpdateSettings(const base::DictionaryValue& job_settings, |
| 156 const printing::PageRanges& ranges, | 158 const printing::PageRanges& ranges, |
| 157 printing::PrintSettings* settings) { | 159 printing::PrintSettings* settings) { |
| 158 bool collate; | 160 bool collate; |
| 159 int color; | 161 int color; |
| 160 bool landscape; | 162 bool landscape; |
| 161 bool print_to_pdf; | 163 bool print_to_pdf; |
| 162 int copies; | 164 int copies; |
| 163 int duplex_mode; | 165 int duplex_mode; |
| 164 std::string device_name; | 166 std::string device_name; |
| 165 | 167 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 // Printing finished. Matches AddRef() in PrintDocument(); | 421 // Printing finished. Matches AddRef() in PrintDocument(); |
| 420 Release(); | 422 Release(); |
| 421 } | 423 } |
| 422 | 424 |
| 423 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges, | 425 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges, |
| 424 PrintSettings* settings) { | 426 PrintSettings* settings) { |
| 425 printing::PrintSettingsInitializerGtk::InitPrintSettings( | 427 printing::PrintSettingsInitializerGtk::InitPrintSettings( |
| 426 gtk_settings_, page_setup_, page_ranges, false, settings); | 428 gtk_settings_, page_setup_, page_ranges, false, settings); |
| 427 context_->InitWithSettings(*settings); | 429 context_->InitWithSettings(*settings); |
| 428 } | 430 } |
| OLD | NEW |