OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 | 5 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 |
6 | 6 |
7 #include "android_webview/renderer/print_web_view_helper.h" | 7 #include "android_webview/renderer/print_web_view_helper.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "android_webview/common/print_messages.h" | 11 #include "android_webview/common/print_messages.h" |
12 #include "base/auto_reset.h" | 12 #include "base/auto_reset.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/process/process_handle.h" | 18 #include "base/process/process_handle.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "content/public/common/webpreferences.h" |
22 #include "content/public/renderer/render_thread.h" | 23 #include "content/public/renderer/render_thread.h" |
23 #include "content/public/renderer/render_view.h" | 24 #include "content/public/renderer/render_view.h" |
24 #include "content/public/renderer/web_preferences.h" | 25 #include "content/public/renderer/web_preferences.h" |
25 #include "net/base/escape.h" | 26 #include "net/base/escape.h" |
26 #include "printing/metafile.h" | 27 #include "printing/metafile.h" |
27 #include "printing/metafile_impl.h" | 28 #include "printing/metafile_impl.h" |
28 #include "printing/units.h" | 29 #include "printing/units.h" |
29 #include "skia/ext/vector_platform_device_skia.h" | 30 #include "skia/ext/vector_platform_device_skia.h" |
30 #include "third_party/WebKit/public/platform/WebSize.h" | 31 #include "third_party/WebKit/public/platform/WebSize.h" |
31 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 32 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
32 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 33 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
33 #include "third_party/WebKit/public/web/WebDocument.h" | 34 #include "third_party/WebKit/public/web/WebDocument.h" |
34 #include "third_party/WebKit/public/web/WebElement.h" | 35 #include "third_party/WebKit/public/web/WebElement.h" |
35 #include "third_party/WebKit/public/web/WebFrame.h" | 36 #include "third_party/WebKit/public/web/WebFrame.h" |
36 #include "third_party/WebKit/public/web/WebFrameClient.h" | 37 #include "third_party/WebKit/public/web/WebFrameClient.h" |
37 #include "third_party/WebKit/public/web/WebPlugin.h" | 38 #include "third_party/WebKit/public/web/WebPlugin.h" |
38 #include "third_party/WebKit/public/web/WebPluginDocument.h" | 39 #include "third_party/WebKit/public/web/WebPluginDocument.h" |
39 #include "third_party/WebKit/public/web/WebPrintParams.h" | 40 #include "third_party/WebKit/public/web/WebPrintParams.h" |
40 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" | 41 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" |
41 #include "third_party/WebKit/public/web/WebScriptSource.h" | 42 #include "third_party/WebKit/public/web/WebScriptSource.h" |
42 #include "third_party/WebKit/public/web/WebSettings.h" | 43 #include "third_party/WebKit/public/web/WebSettings.h" |
43 #include "third_party/WebKit/public/web/WebView.h" | 44 #include "third_party/WebKit/public/web/WebView.h" |
44 #include "third_party/WebKit/public/web/WebViewClient.h" | 45 #include "third_party/WebKit/public/web/WebViewClient.h" |
45 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
46 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
47 #include "webkit/common/webpreferences.h" | |
48 | 48 |
49 // This code is copied from chrome/renderer/printing. Code is slightly | 49 // This code is copied from chrome/renderer/printing. Code is slightly |
50 // modified to run it with webview, and the modifications are marked | 50 // modified to run it with webview, and the modifications are marked |
51 // using OS_ANDROID. | 51 // using OS_ANDROID. |
52 // TODO(sgurun): remove the code as part of componentization of printing. | 52 // TODO(sgurun): remove the code as part of componentization of printing. |
53 | 53 |
54 namespace printing { | 54 namespace printing { |
55 | 55 |
56 namespace { | 56 namespace { |
57 | 57 |
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 } | 1998 } |
1999 | 1999 |
2000 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 2000 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
2001 prep_frame_view_.reset(); | 2001 prep_frame_view_.reset(); |
2002 metafile_.reset(); | 2002 metafile_.reset(); |
2003 pages_to_render_.clear(); | 2003 pages_to_render_.clear(); |
2004 error_ = PREVIEW_ERROR_NONE; | 2004 error_ = PREVIEW_ERROR_NONE; |
2005 } | 2005 } |
2006 | 2006 |
2007 } // namespace printing | 2007 } // namespace printing |
OLD | NEW |