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/platform/WebCanvas.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/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 | 23 |
24 #if defined (USE_SKIA) | |
25 #include "third_party/skia/include/core/SkTypeface.h" | |
26 #if defined (OS_WIN) | |
27 #include <usp10.h> | |
28 #endif | |
29 #endif | |
30 | |
24 struct PrintMsg_Print_Params; | 31 struct PrintMsg_Print_Params; |
25 struct PrintMsg_PrintPage_Params; | 32 struct PrintMsg_PrintPage_Params; |
26 struct PrintMsg_PrintPages_Params; | 33 struct PrintMsg_PrintPages_Params; |
27 | 34 |
28 namespace base { | 35 namespace base { |
29 class DictionaryValue; | 36 class DictionaryValue; |
30 } | 37 } |
31 namespace printing { | 38 namespace printing { |
32 struct PageSizeMargins; | 39 struct PageSizeMargins; |
33 } | 40 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 // of the document and creating a new WebView with the contents. | 90 // of the document and creating a new WebView with the contents. |
84 class PrintWebViewHelper | 91 class PrintWebViewHelper |
85 : public content::RenderViewObserver, | 92 : public content::RenderViewObserver, |
86 public content::RenderViewObserverTracker<PrintWebViewHelper>, | 93 public content::RenderViewObserverTracker<PrintWebViewHelper>, |
87 public WebKit::WebViewClient, | 94 public WebKit::WebViewClient, |
88 public WebKit::WebFrameClient { | 95 public WebKit::WebFrameClient { |
89 public: | 96 public: |
90 explicit PrintWebViewHelper(content::RenderView* render_view); | 97 explicit PrintWebViewHelper(content::RenderView* render_view); |
91 virtual ~PrintWebViewHelper(); | 98 virtual ~PrintWebViewHelper(); |
92 | 99 |
100 #if defined(USE_SKIA) | |
101 static bool ConvertTextToGlyphs(SkTypeface* typeface, | |
102 const string16& text, | |
103 std::vector<uint16_t>* glyphs); | |
jungshik at Google
2012/01/06 22:38:45
As I wrote elsewhere, just getting an array of gly
| |
104 #endif | |
105 | |
93 protected: | 106 protected: |
94 // WebKit::WebViewClient override: | 107 // WebKit::WebViewClient override: |
95 virtual void didStopLoading(); | 108 virtual void didStopLoading(); |
96 | 109 |
97 private: | 110 private: |
98 friend class PrintWebViewHelperTestBase; | 111 friend class PrintWebViewHelperTestBase; |
99 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, | 112 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, |
100 BlockScriptInitiatedPrinting); | 113 BlockScriptInitiatedPrinting); |
101 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); | 114 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); |
102 | 115 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 base::TimeDelta document_render_time_; | 432 base::TimeDelta document_render_time_; |
420 base::TimeTicks begin_time_; | 433 base::TimeTicks begin_time_; |
421 | 434 |
422 enum PrintPreviewErrorBuckets error_; | 435 enum PrintPreviewErrorBuckets error_; |
423 | 436 |
424 State state_; | 437 State state_; |
425 }; | 438 }; |
426 | 439 |
427 PrintPreviewContext print_preview_context_; | 440 PrintPreviewContext print_preview_context_; |
428 | 441 |
442 #if defined(USE_SKIA) && defined(OS_WIN) | |
443 static SCRIPT_CACHE g_script_cache_; | |
444 static SCRIPT_ANALYSIS g_script_analysis_; | |
445 #endif | |
446 | |
429 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 447 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
430 }; | 448 }; |
431 | 449 |
432 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 450 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |