[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 1 | // Copyright (c) 2011 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" |
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 8 | #include "printing/page_number.h" |
9 | #include "printing/printed_page.h" | ||||
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 10 | #include "printing/printing_context_cairo.h" |
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 11 | |
12 | namespace printing { | ||||
13 | |||||
14 | void PrintedDocument::RenderPrintedPage( | ||||
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 15 | const PrintedPage& page, PrintingContext* context) const { |
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 16 | #ifndef NDEBUG |
17 | { | ||||
18 | // Make sure the page is from our list. | ||||
[email protected] | 20305ec | 2011-01-21 04:55:52 | [diff] [blame] | 19 | base::AutoLock lock(lock_); |
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 20 | DCHECK(&page == mutable_.pages_.find(page.page_number() - 1)->second.get()); |
21 | } | ||||
22 | #endif | ||||
23 | |||||
[email protected] | 3b52c98 | 2010-09-27 20:40:36 | [diff] [blame] | 24 | DCHECK(context); |
25 | |||||
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 26 | #if !defined(OS_CHROMEOS) |
[email protected] | da4eefd | 2011-03-03 23:40:27 | [diff] [blame^] | 27 | { |
28 | base::AutoLock lock(lock_); | ||||
29 | if (page.page_number() - 1 == mutable_.first_page) { | ||||
30 | reinterpret_cast<PrintingContextCairo*>(context)->PrintDocument( | ||||
31 | page.native_metafile()); | ||||
32 | } | ||||
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 33 | } |
34 | #endif // !defined(OS_CHROMEOS) | ||||
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 35 | } |
36 | |||||
[email protected] | e059878 | 2010-10-07 22:01:52 | [diff] [blame] | 37 | void PrintedDocument::DrawHeaderFooter(gfx::NativeDrawingContext context, |
38 | std::wstring text, | ||||
39 | gfx::Rect bounds) const { | ||||
40 | NOTIMPLEMENTED(); | ||||
41 | } | ||||
42 | |||||
[email protected] | b75dca8 | 2009-10-13 18:46:21 | [diff] [blame] | 43 | } // namespace printing |