Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4254)

Unified Diff: chrome/renderer/pepper/pepper_printing_renderer_host.cc

Issue 375253002: [Chrome] Support NumCopies print preset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/pepper/pepper_printing_renderer_host.h ('k') | pdf/instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/pepper/pepper_printing_renderer_host.cc
diff --git a/chrome/renderer/pepper/pepper_printing_renderer_host.cc b/chrome/renderer/pepper/pepper_printing_renderer_host.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a342e42d7e1b12284214414d5581dd0527ead24e
--- /dev/null
+++ b/chrome/renderer/pepper/pepper_printing_renderer_host.cc
@@ -0,0 +1,63 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/renderer/pepper/pepper_printing_renderer_host.h"
+
+#include "chrome/common/print_messages.h"
+#include "chrome/common/render_messages.h"
+#include "chrome/renderer/printing/print_web_view_helper.h"
+#include "content/public/renderer/pepper_plugin_instance.h"
+#include "content/public/renderer/render_thread.h"
+#include "content/public/renderer/render_view.h"
+#include "content/public/renderer/renderer_ppapi_host.h"
+#include "ppapi/host/dispatch_host_message.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "third_party/WebKit/public/web/WebDocument.h"
+#include "third_party/WebKit/public/web/WebElement.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "third_party/WebKit/public/web/WebPluginContainer.h"
+#include "third_party/WebKit/public/web/WebView.h"
+
+PepperPrintingRendererHost::PepperPrintingRendererHost(
+ content::RendererPpapiHost* host,
+ PP_Instance instance,
+ PP_Resource resource)
+ : ppapi::host::ResourceHost(host->GetPpapiHost(), instance, resource),
+ host_(host) {
+}
+
+PepperPrintingRendererHost::~PepperPrintingRendererHost() {
+}
+
+int32_t PepperPrintingRendererHost::OnResourceMessageReceived(
+ const IPC::Message& msg,
+ ppapi::host::HostMessageContext* context) {
+ PPAPI_BEGIN_MESSAGE_MAP(PepperPrintingRendererHost, msg)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(
+ PpapiHostMsg_PrintHost_SetPrintPresetOptionsFromDocument,
+ OnHostMsgSetPrintPresetOptionsFromDocument)
+ PPAPI_END_MESSAGE_MAP()
+ return PP_ERROR_FAILED;
+}
+
+int32_t PepperPrintingRendererHost::OnHostMsgSetPrintPresetOptionsFromDocument(
+ ppapi::host::HostMessageContext* context,
+ PP_PrintPresetOptions_Dev& print_options) {
+#if defined(ENABLE_FULL_PRINTING)
+ content::PepperPluginInstance* instance =
+ host_->GetPluginInstance(pp_instance());
+ if (!instance)
+ return PP_ERROR_FAILED;
+
+ PrintHostMsg_SetOptionsFromDocument_Params params;
+ params.is_scaling_disabled = print_options.is_scaling_disabled;
+ params.copies = print_options.copies;
+
+ content::RenderView* render_view = instance->GetRenderView();
+ render_view->Send(new PrintHostMsg_SetOptionsFromDocument(
+ render_view->GetRoutingID(), params));
+ return PP_OK;
+#endif
+ return PP_ERROR_FAILED;
+}
« no previous file with comments | « chrome/renderer/pepper/pepper_printing_renderer_host.h ('k') | pdf/instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698