| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_PRINT_DOCUMENT_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_PRINT_DOCUMENT_SOURCE_H_ |
| 6 #define CHROME_BROWSER_UI_METRO_DRIVER_PRINT_DOCUMENT_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_METRO_DRIVER_PRINT_DOCUMENT_SOURCE_H_ |
| 7 | 7 |
| 8 #include <documentsource.h> | 8 #include <documentsource.h> |
| 9 #include <printpreview.h> | 9 #include <printpreview.h> |
| 10 #include <windows.graphics.printing.h> | 10 #include <windows.graphics.printing.h> |
| 11 | 11 |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_vector.h" |
| 17 #include "base/synchronization/condition_variable.h" | 17 #include "base/synchronization/condition_variable.h" |
| 18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 19 #include "win8/metro_driver/winrt_utils.h" | 19 #include "win8/metro_driver/winrt_utils.h" |
| 20 | 20 |
| 21 // Hack to be removed once we don't need to build with an SDK earlier than | 21 // Hack to be removed once we don't need to build with an SDK earlier than |
| 22 // 8441 where the name of the interface has been changed. | 22 // 8441 where the name of the interface has been changed. |
| 23 // TODO(mad): remove once we don't run mixed SDK/OS anymore. | 23 // TODO(mad): remove once we don't run mixed SDK/OS anymore. |
| 24 #ifndef __IPrintPreviewDxgiPackageTarget_FWD_DEFINED__ | 24 #ifndef __IPrintPreviewDxgiPackageTarget_FWD_DEFINED__ |
| 25 typedef IPrintPreviewDXGIPackageTarget IPrintPreviewDxgiPackageTarget; | 25 typedef IPrintPreviewDXGIPackageTarget IPrintPreviewDxgiPackageTarget; |
| 26 #endif | 26 #endif |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 DirectXContext directx_context_; | 118 DirectXContext directx_context_; |
| 119 | 119 |
| 120 // Once page data is available, it's added to this vector. | 120 // Once page data is available, it's added to this vector. |
| 121 std::vector<mswr::ComPtr<IStream>> pages_; | 121 std::vector<mswr::ComPtr<IStream>> pages_; |
| 122 | 122 |
| 123 // When page count is set, the size of this vector is set to that number. | 123 // When page count is set, the size of this vector is set to that number. |
| 124 // Then, every time page data is added to pages_, the associated condition | 124 // Then, every time page data is added to pages_, the associated condition |
| 125 // variable in this vector is signaled. This is only filled when we receive | 125 // variable in this vector is signaled. This is only filled when we receive |
| 126 // the page count, so we must wait on page_count_ready_ before accessing | 126 // the page count, so we must wait on page_count_ready_ before accessing |
| 127 // the content of this vector. | 127 // the content of this vector. |
| 128 std::vector<scoped_ptr<base::ConditionVariable> > pages_ready_state_; | 128 ScopedVector<base::ConditionVariable> pages_ready_state_; |
| 129 | 129 |
| 130 // This event is signaled when we receive a page count from Chrome. We should | 130 // This event is signaled when we receive a page count from Chrome. We should |
| 131 // not receive any page data before the count, so we can check this event | 131 // not receive any page data before the count, so we can check this event |
| 132 // while waiting for pages too, in case we ask for page data before we got | 132 // while waiting for pages too, in case we ask for page data before we got |
| 133 // the count, so before we properly initialized pages_ready_state_. | 133 // the count, so before we properly initialized pages_ready_state_. |
| 134 base::WaitableEvent page_count_ready_; | 134 base::WaitableEvent page_count_ready_; |
| 135 | 135 |
| 136 // The preview target interface set from within GetPreviewPageCollection | 136 // The preview target interface set from within GetPreviewPageCollection |
| 137 // but used from within MakePage. | 137 // but used from within MakePage. |
| 138 mswr::ComPtr<IPrintPreviewDxgiPackageTarget> dxgi_preview_target_; | 138 mswr::ComPtr<IPrintPreviewDxgiPackageTarget> dxgi_preview_target_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 155 // asynchronous callbacks. | 155 // asynchronous callbacks. |
| 156 bool aborted_; | 156 bool aborted_; |
| 157 | 157 |
| 158 // TODO(mad): remove once we don't run mixed SDK/OS anymore. | 158 // TODO(mad): remove once we don't run mixed SDK/OS anymore. |
| 159 bool using_old_preview_interface_; | 159 bool using_old_preview_interface_; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 } // namespace metro_driver | 162 } // namespace metro_driver |
| 163 | 163 |
| 164 #endif // CHROME_BROWSER_UI_METRO_DRIVER_PRINT_DOCUMENT_SOURCE_H_ | 164 #endif // CHROME_BROWSER_UI_METRO_DRIVER_PRINT_DOCUMENT_SOURCE_H_ |
| OLD | NEW |