| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "printing/printing_context_chromeos.h" | 5 #include "printing/printing_context_chromeos.h" |
| 6 | 6 |
| 7 #include <cups/cups.h> | 7 #include <cups/cups.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <unicode/ulocdata.h> | 9 #include <unicode/ulocdata.h> |
| 10 | 10 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (!printer) { | 273 if (!printer) { |
| 274 LOG(WARNING) << "Could not initialize device"; | 274 LOG(WARNING) << "Could not initialize device"; |
| 275 return OnError(); | 275 return OnError(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 printer_ = std::move(printer); | 278 printer_ = std::move(printer); |
| 279 | 279 |
| 280 return OK; | 280 return OK; |
| 281 } | 281 } |
| 282 | 282 |
| 283 PrintingContext::Result PrintingContextChromeos::InitWithSettings( | |
| 284 const PrintSettings& settings) { | |
| 285 DCHECK(!in_print_job_); | |
| 286 | |
| 287 settings_ = settings; | |
| 288 | |
| 289 return OK; | |
| 290 } | |
| 291 | |
| 292 PrintingContext::Result PrintingContextChromeos::NewDocument( | 283 PrintingContext::Result PrintingContextChromeos::NewDocument( |
| 293 const base::string16& document_name) { | 284 const base::string16& document_name) { |
| 294 DCHECK(!in_print_job_); | 285 DCHECK(!in_print_job_); |
| 295 in_print_job_ = true; | 286 in_print_job_ = true; |
| 296 | 287 |
| 297 std::string converted_name = base::UTF16ToUTF8(document_name); | 288 std::string converted_name = base::UTF16ToUTF8(document_name); |
| 298 std::string title = base::UTF16ToUTF8(settings_.title()); | 289 std::string title = base::UTF16ToUTF8(settings_.title()); |
| 299 std::vector<ScopedCupsOption> cups_options = SettingsToCupsOptions(settings_); | 290 std::vector<ScopedCupsOption> cups_options = SettingsToCupsOptions(settings_); |
| 300 | 291 |
| 301 std::vector<cups_option_t> options; | 292 std::vector<cups_option_t> options; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 DCHECK(in_print_job_); | 383 DCHECK(in_print_job_); |
| 393 DCHECK(printer_); | 384 DCHECK(printer_); |
| 394 | 385 |
| 395 if (!printer_->StreamData(buffer)) | 386 if (!printer_->StreamData(buffer)) |
| 396 return OnError(); | 387 return OnError(); |
| 397 | 388 |
| 398 return OK; | 389 return OK; |
| 399 } | 390 } |
| 400 | 391 |
| 401 } // namespace printing | 392 } // namespace printing |
| OLD | NEW |