Chromium Code Reviews| Index: printing/print_destination_interface_win.cc |
| diff --git a/printing/print_destination_interface_win.cc b/printing/print_destination_interface_win.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..97247e65b3fa043e512d14e9b97a7a2286f48ca9 |
| --- /dev/null |
| +++ b/printing/print_destination_interface_win.cc |
| @@ -0,0 +1,48 @@ |
| +// 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 PrintDestinationInterfaceWin : public PrintDestinationInterface { |
| + public: |
| + PrintDestinationInterfaceWin() |
| + : 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() { |
| + return new PrintDestinationInterfaceWin; |
|
robertshield
2012/06/28 17:48:54
Should this do a base::win::IsMetroProcess() check
MAD
2012/06/28 19:05:51
Done.
|
| +} |
| + |
| +} // namespace printing |