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

Unified Diff: printing/print_destination_win.cc

Issue 10483006: Print support for Windows Metro... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to ToT... Created 8 years, 6 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
« no previous file with comments | « printing/print_destination_none.cc ('k') | printing/printing.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/print_destination_win.cc
diff --git a/printing/print_destination_win.cc b/printing/print_destination_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dc99469121a6acd654d48964677f4c467b8df263
--- /dev/null
+++ b/printing/print_destination_win.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 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.
+
+#include "printing/print_destination_interface.h"
+
+#include "base/win/metro.h"
+
+namespace printing {
+
+class PrintDestinationWin : public PrintDestinationInterface {
+ public:
+ PrintDestinationWin()
+ : metro_set_print_page_count_(NULL),
+ metro_set_print_page_content_(NULL) {
+ HMODULE metro_module = base::win::GetMetroModule();
+ if (metro_module != NULL) {
+ metro_set_print_page_count_ =
+ reinterpret_cast<MetroSetPrintPageCount>(
+ ::GetProcAddress(metro_module, "MetroSetPrintPageCount"));
+ metro_set_print_page_content_ =
+ reinterpret_cast<MetroSetPrintPageContent>(
+ ::GetProcAddress(metro_module, "MetroSetPrintPageContent"));
+ }
+ }
+ virtual void SetPageCount(int page_count) {
+ if (metro_set_print_page_count_)
+ metro_set_print_page_count_(page_count);
+ }
+
+ virtual void SetPageContent(int page_number,
+ void* content,
+ size_t content_size) {
+ if (metro_set_print_page_content_)
+ metro_set_print_page_content_(page_number - 1, content, content_size);
+ }
+ private:
+ typedef void (*MetroSetPrintPageCount)(INT);
+ typedef void (*MetroSetPrintPageContent)(INT, VOID*, UINT32);
+ MetroSetPrintPageCount metro_set_print_page_count_;
+ MetroSetPrintPageContent metro_set_print_page_content_;
+};
+
+PrintDestinationInterface* CreatePrintDestination() {
+ // We currently only support the Metro print destination.
+ if (base::win::IsMetroProcess())
+ return new PrintDestinationWin;
+ else
+ return NULL;
+}
+
+} // namespace printing
« no previous file with comments | « printing/print_destination_none.cc ('k') | printing/printing.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698