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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 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/printed_document.h" 5 #include "printing/printed_document.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "printing/page_number.h" 8 #include "printing/page_number.h"
9 #include "printing/printed_page.h" 9 #include "printing/printed_page.h"
10 #include "printing/printing_context_linux.h" 10 #include "printing/printing_context_chromeos.h"
11 11
12 namespace printing { 12 namespace printing {
13 13
14 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 14 void PrintedDocument::RenderPrintedPage(const PrintedPage& page,
15 void PrintedDocument::RenderPrintedPage( 15 PrintingContext* context) const {
16 const PrintedPage& page, PrintingContext* context) const { 16 #ifdef NDEBUG
17 #ifndef NDEBUG
18 { 17 {
19 // Make sure the page is from our list. 18 // Make sure the page is from our list.
20 base::AutoLock lock(lock_); 19 base::AutoLock lock(lock_);
21 DCHECK(&page == mutable_.pages_.find(page.page_number() - 1)->second.get()); 20 DCHECK(&page == mutable_.pages_.find(page.page_number() - 1)->second.get());
22 } 21 }
23 #endif 22 #endif
24 23
25 DCHECK(context); 24 DCHECK(context);
26 25
27 { 26 {
28 base::AutoLock lock(lock_); 27 base::AutoLock lock(lock_);
29 if (page.page_number() - 1 == mutable_.first_page) { 28 if (page.page_number() - 1 == mutable_.first_page) {
30 static_cast<PrintingContextLinux*>(context) 29 std::vector<char> buffer;
31 ->PrintDocument(*page.metafile()); 30
31 if (page.metafile()->GetDataAsVector(&buffer)) {
32 static_cast<PrintingContextChromeos*>(context)->StreamData(
33 buffer.data(), buffer.size());
34 } else {
35 LOG(WARNING) << "Failed to read data from metafile";
36 }
32 } 37 }
33 } 38 }
34 } 39 }
35 #endif // !OS_CHROMEOS && !OS_ANDROID
36 40
37 } // namespace printing 41 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698