[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "printing/printed_document.h" | ||||
6 | |||||
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 7 | #include "base/logging.h" |
Lei Zhang | 933d34b | 2017-11-13 20:59:29 | [diff] [blame] | 8 | #include "build/build_config.h" |
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame] | 9 | #include "printing/printing_context_linux.h" |
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 10 | |
Lei Zhang | 933d34b | 2017-11-13 20:59:29 | [diff] [blame] | 11 | #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
12 | #error "This file is not used on Android / ChromeOS" | ||||
13 | #endif | ||||
14 | |||||
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 15 | namespace printing { |
16 | |||||
rbpotter | 80cbe04 | 2017-12-08 07:00:52 | [diff] [blame] | 17 | bool PrintedDocument::RenderPrintedDocument(PrintingContext* context) { |
[email protected] | 3b52c98 | 2010-09-27 20:40:36 | [diff] [blame] | 18 | DCHECK(context); |
19 | |||||
rbpotter | 80cbe04 | 2017-12-08 07:00:52 | [diff] [blame] | 20 | if (context->NewPage() != PrintingContext::OK) |
21 | return false; | ||||
[email protected] | da4eefd | 2011-03-03 23:40:27 | [diff] [blame] | 22 | { |
23 | base::AutoLock lock(lock_); | ||||
rbpotter | 80cbe04 | 2017-12-08 07:00:52 | [diff] [blame] | 24 | const MetafilePlayer* metafile = GetMetafile(); |
25 | DCHECK(metafile); | ||||
26 | static_cast<PrintingContextLinux*>(context)->PrintDocument(*metafile); | ||||
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 27 | } |
rbpotter | 80cbe04 | 2017-12-08 07:00:52 | [diff] [blame] | 28 | return context->PageDone() == PrintingContext::OK; |
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 29 | } |
30 | |||||
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 31 | } // namespace printing |