| 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 "net/base/escape.h" | 29 #include "net/base/escape.h" |
| 29 #include "printing/metafile.h" | 30 #include "printing/metafile.h" |
| 30 #include "printing/metafile_impl.h" | 31 #include "printing/metafile_impl.h" |
| 31 #include "printing/units.h" | 32 #include "printing/units.h" |
| 32 #include "skia/ext/vector_platform_device_skia.h" | 33 #include "skia/ext/vector_platform_device_skia.h" |
| 33 #include "third_party/WebKit/public/platform/WebSize.h" | 34 #include "third_party/WebKit/public/platform/WebSize.h" |
| 34 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 35 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 35 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 36 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| 36 #include "third_party/WebKit/public/web/WebDocument.h" | 37 #include "third_party/WebKit/public/web/WebDocument.h" |
| 37 #include "third_party/WebKit/public/web/WebElement.h" | 38 #include "third_party/WebKit/public/web/WebElement.h" |
| 38 #include "third_party/WebKit/public/web/WebFrameClient.h" | 39 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 39 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 40 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 40 #include "third_party/WebKit/public/web/WebPlugin.h" | 41 #include "third_party/WebKit/public/web/WebPlugin.h" |
| 41 #include "third_party/WebKit/public/web/WebPluginDocument.h" | 42 #include "third_party/WebKit/public/web/WebPluginDocument.h" |
| 42 #include "third_party/WebKit/public/web/WebPrintParams.h" | 43 #include "third_party/WebKit/public/web/WebPrintParams.h" |
| 43 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" | 44 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" |
| 44 #include "third_party/WebKit/public/web/WebScriptSource.h" | 45 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 45 #include "third_party/WebKit/public/web/WebSettings.h" | 46 #include "third_party/WebKit/public/web/WebSettings.h" |
| 46 #include "third_party/WebKit/public/web/WebView.h" | 47 #include "third_party/WebKit/public/web/WebView.h" |
| 47 #include "third_party/WebKit/public/web/WebViewClient.h" | 48 #include "third_party/WebKit/public/web/WebViewClient.h" |
| 48 #include "ui/base/resource/resource_bundle.h" | 49 #include "ui/base/resource/resource_bundle.h" |
| 49 #include "webkit/common/webpreferences.h" | 50 |
| 51 using content::WebPreferences; |
| 50 | 52 |
| 51 namespace printing { | 53 namespace printing { |
| 52 | 54 |
| 53 namespace { | 55 namespace { |
| 54 | 56 |
| 55 enum PrintPreviewHelperEvents { | 57 enum PrintPreviewHelperEvents { |
| 56 PREVIEW_EVENT_REQUESTED, | 58 PREVIEW_EVENT_REQUESTED, |
| 57 PREVIEW_EVENT_CACHE_HIT, // Unused | 59 PREVIEW_EVENT_CACHE_HIT, // Unused |
| 58 PREVIEW_EVENT_CREATE_DOCUMENT, | 60 PREVIEW_EVENT_CREATE_DOCUMENT, |
| 59 PREVIEW_EVENT_NEW_SETTINGS, // Unused | 61 PREVIEW_EVENT_NEW_SETTINGS, // Unused |
| (...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 } | 2024 } |
| 2023 | 2025 |
| 2024 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 2026 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
| 2025 prep_frame_view_.reset(); | 2027 prep_frame_view_.reset(); |
| 2026 metafile_.reset(); | 2028 metafile_.reset(); |
| 2027 pages_to_render_.clear(); | 2029 pages_to_render_.clear(); |
| 2028 error_ = PREVIEW_ERROR_NONE; | 2030 error_ = PREVIEW_ERROR_NONE; |
| 2029 } | 2031 } |
| 2030 | 2032 |
| 2031 } // namespace printing | 2033 } // namespace printing |
| OLD | NEW |