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 COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
6 #define COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "content/public/renderer/render_view_observer.h" | 16 #include "content/public/renderer/render_view_observer.h" |
17 #include "content/public/renderer/render_view_observer_tracker.h" | 17 #include "content/public/renderer/render_view_observer_tracker.h" |
18 #include "printing/pdf_metafile_skia.h" | 18 #include "printing/pdf_metafile_skia.h" |
19 #include "third_party/WebKit/public/platform/WebCanvas.h" | 19 #include "third_party/WebKit/public/platform/WebCanvas.h" |
20 #include "third_party/WebKit/public/web/WebNode.h" | 20 #include "third_party/WebKit/public/web/WebNode.h" |
21 #include "third_party/WebKit/public/web/WebPrintParams.h" | 21 #include "third_party/WebKit/public/web/WebPrintParams.h" |
22 #include "ui/gfx/geometry/size.h" | 22 #include "ui/gfx/geometry/size.h" |
23 | 23 |
24 struct PrintMsg_Print_Params; | 24 struct PrintMsg_Print_Params; |
25 struct PrintMsg_PrintPage_Params; | 25 struct PrintMsg_PrintPage_Params; |
26 struct PrintMsg_PrintPages_Params; | 26 struct PrintMsg_PrintPages_Params; |
27 struct PrintHostMsg_SetOptionsFromDocument_Params; | 27 struct PrintHostMsg_SetOptionsFromDocument_Params; |
28 | 28 |
| 29 // RenderVIewTest-based tests crash on Android |
| 30 // http://crbug.com/187500 |
| 31 #if defined(OS_ANDROID) |
| 32 #define MAYBE_PrintWebViewHelperTest DISABLED_PrintWebViewHelperTest |
| 33 #define MAYBE_PrintWebViewHelperPreviewTest \ |
| 34 DISABLED_PrintWebViewHelperPreviewTest |
| 35 #else |
| 36 #define MAYBE_PrintWebViewHelperTest PrintWebViewHelperTest |
| 37 #define MAYBE_PrintWebViewHelperPreviewTest PrintWebViewHelperPreviewTest |
| 38 #endif // defined(OS_ANDROID) |
| 39 |
29 namespace base { | 40 namespace base { |
30 class DictionaryValue; | 41 class DictionaryValue; |
31 } | 42 } |
32 | 43 |
33 namespace blink { | 44 namespace blink { |
34 class WebFrame; | 45 class WebFrame; |
35 class WebView; | 46 class WebView; |
36 } | 47 } |
37 | 48 |
38 namespace printing { | 49 namespace printing { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Disable print preview and switch to system dialog printing even if full | 119 // Disable print preview and switch to system dialog printing even if full |
109 // printing is build-in. This method is used by CEF. | 120 // printing is build-in. This method is used by CEF. |
110 static void DisablePreview(); | 121 static void DisablePreview(); |
111 | 122 |
112 bool IsPrintingEnabled(); | 123 bool IsPrintingEnabled(); |
113 | 124 |
114 void PrintNode(const blink::WebNode& node); | 125 void PrintNode(const blink::WebNode& node); |
115 | 126 |
116 private: | 127 private: |
117 friend class PrintWebViewHelperTestBase; | 128 friend class PrintWebViewHelperTestBase; |
118 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, | 129 FRIEND_TEST_ALL_PREFIXES(MAYBE_PrintWebViewHelperPreviewTest, |
119 BlockScriptInitiatedPrinting); | 130 BlockScriptInitiatedPrinting); |
120 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); | 131 FRIEND_TEST_ALL_PREFIXES(MAYBE_PrintWebViewHelperTest, OnPrintPages); |
121 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, | 132 FRIEND_TEST_ALL_PREFIXES(MAYBE_PrintWebViewHelperTest, |
122 BlockScriptInitiatedPrinting); | 133 BlockScriptInitiatedPrinting); |
123 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, | 134 FRIEND_TEST_ALL_PREFIXES(MAYBE_PrintWebViewHelperTest, |
124 BlockScriptInitiatedPrintingFromPopup); | 135 BlockScriptInitiatedPrintingFromPopup); |
125 #if defined(OS_WIN) || defined(OS_MACOSX) | 136 #if defined(OS_WIN) || defined(OS_MACOSX) |
126 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintLayoutTest); | 137 FRIEND_TEST_ALL_PREFIXES(MAYBE_PrintWebViewHelperTest, PrintLayoutTest); |
127 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintWithIframe); | 138 FRIEND_TEST_ALL_PREFIXES(MAYBE_PrintWebViewHelperTest, PrintWithIframe); |
128 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 139 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
129 | 140 |
130 enum PrintingResult { | 141 enum PrintingResult { |
131 OK, | 142 OK, |
132 FAIL_PRINT_INIT, | 143 FAIL_PRINT_INIT, |
133 FAIL_PRINT, | 144 FAIL_PRINT, |
134 FAIL_PREVIEW, | 145 FAIL_PREVIEW, |
135 }; | 146 }; |
136 | 147 |
137 enum PrintPreviewErrorBuckets { | 148 enum PrintPreviewErrorBuckets { |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 base::Closure on_stop_loading_closure_; | 516 base::Closure on_stop_loading_closure_; |
506 | 517 |
507 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 518 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
508 | 519 |
509 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 520 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
510 }; | 521 }; |
511 | 522 |
512 } // namespace printing | 523 } // namespace printing |
513 | 524 |
514 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 525 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |