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 #include "chrome/renderer/printing/print_web_view_helper.h" | 5 #include "chrome/renderer/printing/print_web_view_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/process/process_handle.h" | 15 #include "base/process/process_handle.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/print_messages.h" | 20 #include "chrome/common/print_messages.h" |
21 #include "chrome/common/render_messages.h" | 21 #include "chrome/common/render_messages.h" |
22 #include "chrome/renderer/prerender/prerender_helper.h" | 22 #include "chrome/renderer/prerender/prerender_helper.h" |
| 23 #include "content/public/common/webpreferences.h" |
23 #include "content/public/renderer/render_frame.h" | 24 #include "content/public/renderer/render_frame.h" |
24 #include "content/public/renderer/render_thread.h" | 25 #include "content/public/renderer/render_thread.h" |
25 #include "content/public/renderer/render_view.h" | 26 #include "content/public/renderer/render_view.h" |
26 #include "content/public/renderer/web_preferences.h" | 27 #include "content/public/renderer/web_preferences.h" |
27 #include "grit/browser_resources.h" | 28 #include "grit/browser_resources.h" |
28 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
29 #include "net/base/escape.h" | 30 #include "net/base/escape.h" |
30 #include "printing/metafile.h" | 31 #include "printing/metafile.h" |
31 #include "printing/metafile_impl.h" | 32 #include "printing/metafile_impl.h" |
32 #include "printing/units.h" | 33 #include "printing/units.h" |
33 #include "skia/ext/vector_platform_device_skia.h" | 34 #include "skia/ext/vector_platform_device_skia.h" |
34 #include "third_party/WebKit/public/platform/WebSize.h" | 35 #include "third_party/WebKit/public/platform/WebSize.h" |
35 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 36 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
36 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 37 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
37 #include "third_party/WebKit/public/web/WebDocument.h" | 38 #include "third_party/WebKit/public/web/WebDocument.h" |
38 #include "third_party/WebKit/public/web/WebElement.h" | 39 #include "third_party/WebKit/public/web/WebElement.h" |
39 #include "third_party/WebKit/public/web/WebFrame.h" | 40 #include "third_party/WebKit/public/web/WebFrame.h" |
40 #include "third_party/WebKit/public/web/WebFrameClient.h" | 41 #include "third_party/WebKit/public/web/WebFrameClient.h" |
41 #include "third_party/WebKit/public/web/WebPlugin.h" | 42 #include "third_party/WebKit/public/web/WebPlugin.h" |
42 #include "third_party/WebKit/public/web/WebPluginDocument.h" | 43 #include "third_party/WebKit/public/web/WebPluginDocument.h" |
43 #include "third_party/WebKit/public/web/WebPrintParams.h" | 44 #include "third_party/WebKit/public/web/WebPrintParams.h" |
44 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" | 45 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" |
45 #include "third_party/WebKit/public/web/WebScriptSource.h" | 46 #include "third_party/WebKit/public/web/WebScriptSource.h" |
46 #include "third_party/WebKit/public/web/WebSettings.h" | 47 #include "third_party/WebKit/public/web/WebSettings.h" |
47 #include "third_party/WebKit/public/web/WebView.h" | 48 #include "third_party/WebKit/public/web/WebView.h" |
48 #include "third_party/WebKit/public/web/WebViewClient.h" | 49 #include "third_party/WebKit/public/web/WebViewClient.h" |
49 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
50 #include "ui/base/resource/resource_bundle.h" | 51 #include "ui/base/resource/resource_bundle.h" |
51 #include "webkit/common/webpreferences.h" | |
52 | 52 |
53 namespace printing { | 53 namespace printing { |
54 | 54 |
55 namespace { | 55 namespace { |
56 | 56 |
57 enum PrintPreviewHelperEvents { | 57 enum PrintPreviewHelperEvents { |
58 PREVIEW_EVENT_REQUESTED, | 58 PREVIEW_EVENT_REQUESTED, |
59 PREVIEW_EVENT_CACHE_HIT, // Unused | 59 PREVIEW_EVENT_CACHE_HIT, // Unused |
60 PREVIEW_EVENT_CREATE_DOCUMENT, | 60 PREVIEW_EVENT_CREATE_DOCUMENT, |
61 PREVIEW_EVENT_NEW_SETTINGS, // Unused | 61 PREVIEW_EVENT_NEW_SETTINGS, // Unused |
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 } | 1992 } |
1993 | 1993 |
1994 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1994 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
1995 prep_frame_view_.reset(); | 1995 prep_frame_view_.reset(); |
1996 metafile_.reset(); | 1996 metafile_.reset(); |
1997 pages_to_render_.clear(); | 1997 pages_to_render_.clear(); |
1998 error_ = PREVIEW_ERROR_NONE; | 1998 error_ = PREVIEW_ERROR_NONE; |
1999 } | 1999 } |
2000 | 2000 |
2001 } // namespace printing | 2001 } // namespace printing |
OLD | NEW |