Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: printing/printed_document_chromeos.cc

Issue 2117713002: Print directly to CUPS using the IPP APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ippRead
Patch Set: Update patch Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: printing/printed_document_chromeos.cc
diff --git a/printing/printed_document_linux.cc b/printing/printed_document_chromeos.cc
similarity index 51%
copy from printing/printed_document_linux.cc
copy to printing/printed_document_chromeos.cc
index a104171ad56c144060be35c94c83fa36f937c1b5..5aedb981a58a63df1fdf41ab977cf847ff3fb20e 100644
--- a/printing/printed_document_linux.cc
+++ b/printing/printed_document_chromeos.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,14 +7,13 @@
#include "base/logging.h"
#include "printing/page_number.h"
#include "printing/printed_page.h"
-#include "printing/printing_context_linux.h"
+#include "printing/printing_context_chromeos.h"
namespace printing {
-#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
-void PrintedDocument::RenderPrintedPage(
- const PrintedPage& page, PrintingContext* context) const {
-#ifndef NDEBUG
+void PrintedDocument::RenderPrintedPage(const PrintedPage& page,
+ PrintingContext* context) const {
+#ifdef NDEBUG
{
// Make sure the page is from our list.
base::AutoLock lock(lock_);
@@ -27,11 +26,16 @@ void PrintedDocument::RenderPrintedPage(
{
base::AutoLock lock(lock_);
if (page.page_number() - 1 == mutable_.first_page) {
- static_cast<PrintingContextLinux*>(context)
- ->PrintDocument(*page.metafile());
+ std::vector<char> buffer;
+
+ if (page.metafile()->GetDataAsVector(&buffer)) {
+ static_cast<PrintingContextChromeos*>(context)->StreamData(
+ buffer.data(), buffer.size());
+ } else {
+ LOG(WARNING) << "Failed to read data from metafile";
+ }
}
}
}
-#endif // !OS_CHROMEOS && !OS_ANDROID
} // namespace printing

Powered by Google App Engine
This is Rietveld 408576698