OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "content/public/renderer/render_view_observer.h" | 14 #include "content/public/renderer/render_view_observer.h" |
15 #include "content/public/renderer/render_view_observer_tracker.h" | 15 #include "content/public/renderer/render_view_observer_tracker.h" |
16 #include "printing/metafile.h" | 16 #include "printing/metafile.h" |
17 #include "printing/metafile_impl.h" | 17 #include "printing/metafile_impl.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" |
22 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
23 #if defined(OS_WIN) && defined(USE_SKIA) | |
24 #include "skia/ext/SkFontHost_sandbox_win.h" | |
25 #endif | |
23 | 26 |
24 struct PrintMsg_Print_Params; | 27 struct PrintMsg_Print_Params; |
25 struct PrintMsg_PrintPage_Params; | 28 struct PrintMsg_PrintPage_Params; |
26 struct PrintMsg_PrintPages_Params; | 29 struct PrintMsg_PrintPages_Params; |
27 | 30 |
28 namespace base { | 31 namespace base { |
29 class DictionaryValue; | 32 class DictionaryValue; |
30 } | 33 } |
31 namespace printing { | 34 namespace printing { |
32 struct PageSizeMargins; | 35 struct PageSizeMargins; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 80 |
78 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); | 81 DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); |
79 }; | 82 }; |
80 | 83 |
81 // PrintWebViewHelper handles most of the printing grunt work for RenderView. | 84 // PrintWebViewHelper handles most of the printing grunt work for RenderView. |
82 // We plan on making print asynchronous and that will require copying the DOM | 85 // We plan on making print asynchronous and that will require copying the DOM |
83 // of the document and creating a new WebView with the contents. | 86 // of the document and creating a new WebView with the contents. |
84 class PrintWebViewHelper | 87 class PrintWebViewHelper |
85 : public content::RenderViewObserver, | 88 : public content::RenderViewObserver, |
86 public content::RenderViewObserverTracker<PrintWebViewHelper>, | 89 public content::RenderViewObserverTracker<PrintWebViewHelper>, |
90 #if defined(OS_WIN) && defined(USE_SKIA) | |
91 public skia::ISandboxSupport, | |
vandebo (ex-Chrome)
2011/11/16 05:42:55
This seems like the wrong place for this, it's not
| |
92 #endif | |
87 public WebKit::WebViewClient, | 93 public WebKit::WebViewClient, |
88 public WebKit::WebFrameClient { | 94 public WebKit::WebFrameClient { |
89 public: | 95 public: |
90 explicit PrintWebViewHelper(content::RenderView* render_view); | 96 explicit PrintWebViewHelper(content::RenderView* render_view); |
91 virtual ~PrintWebViewHelper(); | 97 virtual ~PrintWebViewHelper(); |
92 | 98 |
93 protected: | 99 protected: |
94 // WebKit::WebViewClient override: | 100 // WebKit::WebViewClient override: |
95 virtual void didStopLoading(); | 101 virtual void didStopLoading(); |
96 | 102 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 const float& scale_factor, int page_number, | 231 const float& scale_factor, int page_number, |
226 WebKit::WebFrame* frame, bool is_preview, | 232 WebKit::WebFrame* frame, bool is_preview, |
227 printing::Metafile* metafile); | 233 printing::Metafile* metafile); |
228 #elif defined(OS_POSIX) | 234 #elif defined(OS_POSIX) |
229 bool RenderPages(const PrintMsg_PrintPages_Params& params, | 235 bool RenderPages(const PrintMsg_PrintPages_Params& params, |
230 WebKit::WebFrame* frame, const WebKit::WebNode& node, | 236 WebKit::WebFrame* frame, const WebKit::WebNode& node, |
231 int* page_count, PrepareFrameAndViewForPrint* prepare, | 237 int* page_count, PrepareFrameAndViewForPrint* prepare, |
232 printing::Metafile* metafile); | 238 printing::Metafile* metafile); |
233 #endif // defined(OS_WIN) | 239 #endif // defined(OS_WIN) |
234 | 240 |
241 #if defined(OS_WIN) && defined(USE_SKIA) | |
242 virtual void EnsureFontLoad(LOGFONT logfont); | |
243 #endif | |
244 | |
235 // Helper methods ----------------------------------------------------------- | 245 // Helper methods ----------------------------------------------------------- |
236 | 246 |
237 bool CopyAndPrint(WebKit::WebFrame* web_frame); | 247 bool CopyAndPrint(WebKit::WebFrame* web_frame); |
238 | 248 |
239 bool CopyMetafileDataToSharedMem(printing::Metafile* metafile, | 249 bool CopyMetafileDataToSharedMem(printing::Metafile* metafile, |
240 base::SharedMemoryHandle* shared_mem_handle); | 250 base::SharedMemoryHandle* shared_mem_handle); |
241 | 251 |
242 static void GetPageSizeAndMarginsInPoints( | 252 static void GetPageSizeAndMarginsInPoints( |
243 WebKit::WebFrame* frame, | 253 WebKit::WebFrame* frame, |
244 int page_index, | 254 int page_index, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 | 434 |
425 State state_; | 435 State state_; |
426 }; | 436 }; |
427 | 437 |
428 PrintPreviewContext print_preview_context_; | 438 PrintPreviewContext print_preview_context_; |
429 | 439 |
430 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 440 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
431 }; | 441 }; |
432 | 442 |
433 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 443 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |