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
3 // found in the LICENSE file.
5 #include "printing/printed_document.h"
7 #include "base/logging.h"
10 #include "printing/metafile.h"
11 #include "printing/printing_context_chromeos.h"
16 bool PrintedDocument::RenderPrintedDocument(PrintingContext* context) {
20 if (context->NewPage() != PrintingContext::OK)
23 base::AutoLock lock(lock_);
24 std::vector<char> buffer;
25 const MetafilePlayer* metafile = GetMetafile();
27 if (metafile->GetDataAsVector(&buffer)) {
28 static_cast<PrintingContextChromeos*>(context)->StreamData(buffer);
30 LOG(WARNING) << "Failed to read data from metafile";
33 return context->PageDone() == PrintingContext::OK;
37 #endif // defined(USE_CUPS)
40 } // namespace printing