summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ppapi/api/dev/pp_print_settings_dev.idl45
-rw-r--r--ppapi/api/dev/ppb_printing_dev.idl22
-rw-r--r--ppapi/api/dev/ppp_printing_dev.idl41
-rw-r--r--ppapi/c/dev/pp_print_settings_dev.h76
-rw-r--r--ppapi/c/dev/ppb_printing_dev.h49
-rw-r--r--ppapi/c/dev/ppp_printing_dev.h49
-rw-r--r--ppapi/cpp/dev/printing_dev.cc16
-rw-r--r--ppapi/cpp/dev/printing_dev.h7
-rw-r--r--ppapi/ppapi_shared.gypi1
-rw-r--r--ppapi/ppapi_sources.gypi1
-rw-r--r--ppapi/proxy/interface_list.cc1
-rw-r--r--ppapi/proxy/ppapi_messages.h18
-rw-r--r--ppapi/proxy/ppb_instance_proxy.cc38
-rw-r--r--ppapi/proxy/ppb_instance_proxy.h6
-rw-r--r--ppapi/tests/all_c_includes.h1
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h2
-rw-r--r--ppapi/thunk/ppb_instance_api.h6
-rw-r--r--ppapi/thunk/ppb_printing_thunk.cc33
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc1
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc7
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h3
21 files changed, 336 insertions, 87 deletions
diff --git a/ppapi/api/dev/pp_print_settings_dev.idl b/ppapi/api/dev/pp_print_settings_dev.idl
new file mode 100644
index 0000000..fafcc08
--- /dev/null
+++ b/ppapi/api/dev/pp_print_settings_dev.idl
@@ -0,0 +1,45 @@
+/* Copyright (c) 2012 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.
+ */
+
+/**
+ * This file defines the struct for PrintSettings.
+ */
+
+[assert_size(4)]
+enum PP_PrintOrientation_Dev {
+ PP_PRINTORIENTATION_NORMAL = 0,
+ PP_PRINTORIENTATION_ROTATED_90_CW = 1,
+ PP_PRINTORIENTATION_ROTATED_180 = 2,
+ PP_PRINTORIENTATION_ROTATED_90_CCW = 3
+};
+
+[assert_size(4)]
+enum PP_PrintOutputFormat_Dev {
+ PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0,
+ PP_PRINTOUTPUTFORMAT_PDF = 1u << 1,
+ PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2,
+ PP_PRINTOUTPUTFORMAT_EMF = 1u << 3
+};
+
+[assert_size(4)]
+enum PP_PrintScalingOption_Dev {
+ PP_PRINTSCALINGOPTION_NONE = 0,
+ PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA = 1,
+ PP_PRINTSCALINGOPTION_SOURCE_SIZE = 2
+};
+
+[assert_size(60)]
+struct PP_PrintSettings_Dev {
+ /** This is the size of the printable area in points (1/72 of an inch). */
+ PP_Rect printable_area;
+ PP_Rect content_area;
+ PP_Size paper_size;
+ int32_t dpi;
+ PP_PrintOrientation_Dev orientation;
+ PP_PrintScalingOption_Dev print_scaling_option;
+ PP_Bool grayscale;
+ /** Note that Chrome currently only supports PDF printing. */
+ PP_PrintOutputFormat_Dev format;
+};
diff --git a/ppapi/api/dev/ppb_printing_dev.idl b/ppapi/api/dev/ppb_printing_dev.idl
new file mode 100644
index 0000000..5627858
--- /dev/null
+++ b/ppapi/api/dev/ppb_printing_dev.idl
@@ -0,0 +1,22 @@
+/* Copyright (c) 2012 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.
+ */
+
+/**
+ * Definition of the PPB_Printing interface.
+ */
+
+// Note: This version should always match the PPP_Printing_Dev interface.
+label Chrome {
+ M21 = 0.6
+};
+
+interface PPB_Printing_Dev {
+ /**
+ * Outputs the default print settings for the default printer into
+ * <code>print_settings</code>. Returns <code>PP_FALSE</code> on error.
+ */
+ PP_Bool GetDefaultPrintSettings([in] PP_Instance instance,
+ [out] PP_PrintSettings_Dev print_settings);
+};
diff --git a/ppapi/api/dev/ppp_printing_dev.idl b/ppapi/api/dev/ppp_printing_dev.idl
index d89916e..df107ab 100644
--- a/ppapi/api/dev/ppp_printing_dev.idl
+++ b/ppapi/api/dev/ppp_printing_dev.idl
@@ -4,50 +4,14 @@
*/
/**
- * Implementation of the Printing interface.
+ * Definition of the PPP_Printing interface.
*/
+// Note: This version should always match the PPB_Printing_Dev interface.
label Chrome {
M21 = 0.6
};
-[assert_size(4)]
-enum PP_PrintOrientation_Dev {
- PP_PRINTORIENTATION_NORMAL = 0,
- PP_PRINTORIENTATION_ROTATED_90_CW = 1,
- PP_PRINTORIENTATION_ROTATED_180 = 2,
- PP_PRINTORIENTATION_ROTATED_90_CCW = 3
-};
-
-[assert_size(4)]
-enum PP_PrintOutputFormat_Dev {
- PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0,
- PP_PRINTOUTPUTFORMAT_PDF = 1u << 1,
- PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2,
- PP_PRINTOUTPUTFORMAT_EMF = 1u << 3
-};
-
-[assert_size(4)]
-enum PP_PrintScalingOption_Dev {
- PP_PRINTSCALINGOPTION_NONE = 0,
- PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA = 1,
- PP_PRINTSCALINGOPTION_SOURCE_SIZE = 2
-};
-
-[assert_size(60)]
-struct PP_PrintSettings_Dev {
- /** This is the size of the printable area in points (1/72 of an inch) */
- PP_Rect printable_area;
- PP_Rect content_area;
- PP_Size paper_size;
- int32_t dpi;
- PP_PrintOrientation_Dev orientation;
- PP_PrintScalingOption_Dev print_scaling_option;
- PP_Bool grayscale;
- /** Note that Chrome currently only supports PDF printing. */
- PP_PrintOutputFormat_Dev format;
-};
-
/**
* Specifies a contiguous range of page numbers to be printed.
* The page numbers use a zero-based index.
@@ -94,4 +58,3 @@ interface PPP_Printing_Dev {
*/
PP_Bool IsScalingDisabled([in] PP_Instance instance);
};
-
diff --git a/ppapi/c/dev/pp_print_settings_dev.h b/ppapi/c/dev/pp_print_settings_dev.h
new file mode 100644
index 0000000..93e21d4
--- /dev/null
+++ b/ppapi/c/dev/pp_print_settings_dev.h
@@ -0,0 +1,76 @@
+/* Copyright (c) 2012 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.
+ */
+
+/* From dev/pp_print_settings_dev.idl modified Wed Jun 13 09:14:31 2012. */
+
+#ifndef PPAPI_C_DEV_PP_PRINT_SETTINGS_DEV_H_
+#define PPAPI_C_DEV_PP_PRINT_SETTINGS_DEV_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/c/pp_stdint.h"
+
+/**
+ * @file
+ * This file defines the struct for PrintSettings.
+ */
+
+
+/**
+ * @addtogroup Enums
+ * @{
+ */
+typedef enum {
+ PP_PRINTORIENTATION_NORMAL = 0,
+ PP_PRINTORIENTATION_ROTATED_90_CW = 1,
+ PP_PRINTORIENTATION_ROTATED_180 = 2,
+ PP_PRINTORIENTATION_ROTATED_90_CCW = 3
+} PP_PrintOrientation_Dev;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4);
+
+typedef enum {
+ PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0,
+ PP_PRINTOUTPUTFORMAT_PDF = 1u << 1,
+ PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2,
+ PP_PRINTOUTPUTFORMAT_EMF = 1u << 3
+} PP_PrintOutputFormat_Dev;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4);
+
+typedef enum {
+ PP_PRINTSCALINGOPTION_NONE = 0,
+ PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA = 1,
+ PP_PRINTSCALINGOPTION_SOURCE_SIZE = 2
+} PP_PrintScalingOption_Dev;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintScalingOption_Dev, 4);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+struct PP_PrintSettings_Dev {
+ /** This is the size of the printable area in points (1/72 of an inch). */
+ struct PP_Rect printable_area;
+ struct PP_Rect content_area;
+ struct PP_Size paper_size;
+ int32_t dpi;
+ PP_PrintOrientation_Dev orientation;
+ PP_PrintScalingOption_Dev print_scaling_option;
+ PP_Bool grayscale;
+ /** Note that Chrome currently only supports PDF printing. */
+ PP_PrintOutputFormat_Dev format;
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 60);
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_DEV_PP_PRINT_SETTINGS_DEV_H_ */
+
diff --git a/ppapi/c/dev/ppb_printing_dev.h b/ppapi/c/dev/ppb_printing_dev.h
new file mode 100644
index 0000000..97a59fa
--- /dev/null
+++ b/ppapi/c/dev/ppb_printing_dev.h
@@ -0,0 +1,49 @@
+/* Copyright (c) 2012 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.
+ */
+
+/* From dev/ppb_printing_dev.idl modified Wed Jun 13 09:16:33 2012. */
+
+#ifndef PPAPI_C_DEV_PPB_PRINTING_DEV_H_
+#define PPAPI_C_DEV_PPB_PRINTING_DEV_H_
+
+#include "ppapi/c/dev/pp_print_settings_dev.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_PRINTING_DEV_INTERFACE_0_6 "PPB_Printing(Dev);0.6"
+#define PPB_PRINTING_DEV_INTERFACE PPB_PRINTING_DEV_INTERFACE_0_6
+
+/**
+ * @file
+ * Definition of the PPB_Printing interface.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+struct PPB_Printing_Dev_0_6 {
+ /**
+ * Outputs the default print settings for the default printer into
+ * <code>print_settings</code>. Returns <code>PP_FALSE</code> on error.
+ */
+ PP_Bool (*GetDefaultPrintSettings)(
+ PP_Instance instance,
+ struct PP_PrintSettings_Dev* print_settings);
+};
+
+typedef struct PPB_Printing_Dev_0_6 PPB_Printing_Dev;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_DEV_PPB_PRINTING_DEV_H_ */
+
diff --git a/ppapi/c/dev/ppp_printing_dev.h b/ppapi/c/dev/ppp_printing_dev.h
index 5da2df8..94d8ac7 100644
--- a/ppapi/c/dev/ppp_printing_dev.h
+++ b/ppapi/c/dev/ppp_printing_dev.h
@@ -3,11 +3,12 @@
* found in the LICENSE file.
*/
-/* From dev/ppp_printing_dev.idl modified Tue May 15 15:17:01 2012. */
+/* From dev/ppp_printing_dev.idl modified Wed Jun 13 09:20:40 2012. */
#ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_
#define PPAPI_C_DEV_PPP_PRINTING_DEV_H_
+#include "ppapi/c/dev/pp_print_settings_dev.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
@@ -22,58 +23,14 @@
/**
* @file
- * Implementation of the Printing interface.
+ * Definition of the PPP_Printing interface.
*/
/**
- * @addtogroup Enums
- * @{
- */
-typedef enum {
- PP_PRINTORIENTATION_NORMAL = 0,
- PP_PRINTORIENTATION_ROTATED_90_CW = 1,
- PP_PRINTORIENTATION_ROTATED_180 = 2,
- PP_PRINTORIENTATION_ROTATED_90_CCW = 3
-} PP_PrintOrientation_Dev;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4);
-
-typedef enum {
- PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0,
- PP_PRINTOUTPUTFORMAT_PDF = 1u << 1,
- PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2,
- PP_PRINTOUTPUTFORMAT_EMF = 1u << 3
-} PP_PrintOutputFormat_Dev;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4);
-
-typedef enum {
- PP_PRINTSCALINGOPTION_NONE = 0,
- PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA = 1,
- PP_PRINTSCALINGOPTION_SOURCE_SIZE = 2
-} PP_PrintScalingOption_Dev;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintScalingOption_Dev, 4);
-/**
- * @}
- */
-
-/**
* @addtogroup Structs
* @{
*/
-struct PP_PrintSettings_Dev {
- /** This is the size of the printable area in points (1/72 of an inch) */
- struct PP_Rect printable_area;
- struct PP_Rect content_area;
- struct PP_Size paper_size;
- int32_t dpi;
- PP_PrintOrientation_Dev orientation;
- PP_PrintScalingOption_Dev print_scaling_option;
- PP_Bool grayscale;
- /** Note that Chrome currently only supports PDF printing. */
- PP_PrintOutputFormat_Dev format;
-};
-PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 60);
-
/**
* Specifies a contiguous range of page numbers to be printed.
* The page numbers use a zero-based index.
diff --git a/ppapi/cpp/dev/printing_dev.cc b/ppapi/cpp/dev/printing_dev.cc
index 72affff..15c571f 100644
--- a/ppapi/cpp/dev/printing_dev.cc
+++ b/ppapi/cpp/dev/printing_dev.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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 "ppapi/cpp/dev/printing_dev.h"
+#include "ppapi/c/dev/ppb_printing_dev.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/instance_handle.h"
#include "ppapi/cpp/module.h"
@@ -15,6 +16,10 @@ namespace {
static const char kPPPPrintingInterface[] = PPP_PRINTING_DEV_INTERFACE;
+template <> const char* interface_name<PPB_Printing_Dev_0_6>() {
+ return PPB_PRINTING_DEV_INTERFACE_0_6;
+}
+
uint32_t QuerySupportedFormats(PP_Instance instance) {
void* object =
Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
@@ -81,4 +86,13 @@ Printing_Dev::~Printing_Dev() {
kPPPPrintingInterface, this);
}
+bool Printing_Dev::GetDefaultPrintSettings(
+ PP_PrintSettings_Dev* print_settings) {
+ if (!has_interface<PPB_Printing_Dev_0_6>())
+ return PP_FALSE;
+ return PP_ToBool(
+ get_interface<PPB_Printing_Dev_0_6>()->GetDefaultPrintSettings(
+ associated_instance_.pp_instance(), print_settings));
+}
+
} // namespace pp
diff --git a/ppapi/cpp/dev/printing_dev.h b/ppapi/cpp/dev/printing_dev.h
index 734015f..8ce981f 100644
--- a/ppapi/cpp/dev/printing_dev.h
+++ b/ppapi/cpp/dev/printing_dev.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -30,6 +30,11 @@ class Printing_Dev {
virtual void PrintEnd() = 0;
virtual bool IsPrintScalingDisabled() = 0;
+ // PPB_Printing_Dev functions.
+ // Outputs the default print settings for the default printer into
+ // |print_settings|. Returns false on error.
+ bool GetDefaultPrintSettings(PP_PrintSettings_Dev* print_settings);
+
private:
InstanceHandle associated_instance_;
};
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index 4167c05..7cb5499 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -225,6 +225,7 @@
'thunk/ppb_network_monitor_private_api.h',
'thunk/ppb_network_monitor_private_thunk.cc',
'thunk/ppb_pdf_api.h',
+ 'thunk/ppb_printing_thunk.cc',
'thunk/ppb_resource_array_api.h',
'thunk/ppb_resource_array_thunk.cc',
'thunk/ppb_scrollbar_api.h',
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi
index 5dcbd51..d7c6c4d 100644
--- a/ppapi/ppapi_sources.gypi
+++ b/ppapi/ppapi_sources.gypi
@@ -70,6 +70,7 @@
'c/dev/ppb_ime_input_event_dev.h',
'c/dev/ppb_memory_dev.h',
'c/dev/ppb_message_loop_dev.h',
+ 'c/dev/ppb_printing_dev.h',
'c/dev/ppb_resource_array_dev.h',
'c/dev/ppb_scrollbar_dev.h',
'c/dev/ppb_testing_dev.h',
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index fc5f1ce..f801276 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -20,6 +20,7 @@
#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/c/dev/ppb_message_loop_dev.h"
#include "ppapi/c/dev/ppb_opengles2ext_dev.h"
+#include "ppapi/c/dev/ppb_printing_dev.h"
#include "ppapi/c/dev/ppb_resource_array_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/dev/ppb_text_input_dev.h"
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index a62d87d..5f3c6bd 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -62,6 +62,9 @@ IPC_ENUM_TRAITS(PP_InputEvent_Type)
IPC_ENUM_TRAITS(PP_NetAddressFamily_Private)
IPC_ENUM_TRAITS(PP_NetworkListType_Private)
IPC_ENUM_TRAITS(PP_NetworkListState_Private)
+IPC_ENUM_TRAITS(PP_PrintOrientation_Dev)
+IPC_ENUM_TRAITS(PP_PrintOutputFormat_Dev)
+IPC_ENUM_TRAITS(PP_PrintScalingOption_Dev)
IPC_ENUM_TRAITS(PP_TextInput_Type)
IPC_ENUM_TRAITS(PP_VideoDecodeError_Dev)
IPC_ENUM_TRAITS(PP_VideoDecoder_Profile)
@@ -113,6 +116,17 @@ IPC_STRUCT_TRAITS_BEGIN(PP_HostResolver_Private_Hint)
IPC_STRUCT_TRAITS_MEMBER(flags)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(PP_PrintSettings_Dev)
+ IPC_STRUCT_TRAITS_MEMBER(printable_area)
+ IPC_STRUCT_TRAITS_MEMBER(content_area)
+ IPC_STRUCT_TRAITS_MEMBER(paper_size)
+ IPC_STRUCT_TRAITS_MEMBER(dpi)
+ IPC_STRUCT_TRAITS_MEMBER(orientation)
+ IPC_STRUCT_TRAITS_MEMBER(print_scaling_option)
+ IPC_STRUCT_TRAITS_MEMBER(grayscale)
+ IPC_STRUCT_TRAITS_MEMBER(format)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(ppapi::DeviceRefData)
IPC_STRUCT_TRAITS_MEMBER(type)
IPC_STRUCT_TRAITS_MEMBER(name)
@@ -935,6 +949,10 @@ IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBInstance_LockMouse,
PP_Instance /* instance */)
IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBInstance_UnlockMouse,
PP_Instance /* instance */)
+IPC_SYNC_MESSAGE_ROUTED1_2(PpapiHostMsg_PPBPInstance_GetDefaultPrintSettings,
+ PP_Instance /* instance */,
+ PP_PrintSettings_Dev /* settings */,
+ bool /* result */)
IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument,
PP_Instance /* instance */,
ppapi::proxy::SerializedVar /* relative */,
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index ac6fc8f..4cbb5ca 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -124,6 +124,8 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
OnHostMsgLockMouse)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse,
OnHostMsgUnlockMouse)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPInstance_GetDefaultPrintSettings,
+ OnHostMsgGetDefaultPrintSettings)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor,
OnHostMsgSetCursor)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType,
@@ -458,6 +460,19 @@ void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) {
API_ID_PPB_INSTANCE, instance));
}
+PP_Bool PPB_Instance_Proxy::GetDefaultPrintSettings(
+ PP_Instance instance,
+ PP_PrintSettings_Dev* print_settings) {
+ if (!print_settings)
+ return PP_FALSE;
+
+ bool result;
+ dispatcher()->Send(new PpapiHostMsg_PPBPInstance_GetDefaultPrintSettings(
+ API_ID_PPB_INSTANCE, instance, print_settings, &result));
+
+ return PP_FromBool(result);
+}
+
void PPB_Instance_Proxy::SetTextInputType(PP_Instance instance,
PP_TextInput_Type type) {
dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetTextInputType(
@@ -650,6 +665,29 @@ void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) {
enter.functions()->UnlockMouse(instance);
}
+void PPB_Instance_Proxy::OnHostMsgGetDefaultPrintSettings(
+ PP_Instance instance,
+ PP_PrintSettings_Dev* settings,
+ bool* result) {
+ // TODO(raymes): This just returns some generic settings. Actually hook this
+ // up to the browser to return the real defaults.
+ PP_PrintSettings_Dev default_settings = {
+ // |printable_area|: all of the sheet of paper.
+ { { 0, 0 }, { 612, 792 } },
+ // |content_area|: 0.5" margins all around.
+ { { 36, 36 }, { 540, 720 } },
+ // |paper_size|: 8.5" x 11" (US letter).
+ { 612, 792 },
+ 300, // |dpi|.
+ PP_PRINTORIENTATION_NORMAL, // |orientation|.
+ PP_PRINTSCALINGOPTION_NONE, // |print_scaling_option|.
+ PP_FALSE, // |grayscale|.
+ PP_PRINTOUTPUTFORMAT_PDF // |format|.
+ };
+ *settings = default_settings;
+ *result = true;
+}
+
#if !defined(OS_NACL)
void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument(
PP_Instance instance,
diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h
index b508a25..7a84ec8 100644
--- a/ppapi/proxy/ppb_instance_proxy.h
+++ b/ppapi/proxy/ppb_instance_proxy.h
@@ -87,6 +87,9 @@ class PPB_Instance_Proxy : public InterfaceProxy,
virtual int32_t LockMouse(PP_Instance instance,
PP_CompletionCallback callback) OVERRIDE;
virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
+ virtual PP_Bool GetDefaultPrintSettings(
+ PP_Instance instance,
+ PP_PrintSettings_Dev* print_settings) OVERRIDE;
virtual void SetTextInputType(PP_Instance instance,
PP_TextInput_Type type) OVERRIDE;
virtual void UpdateCaretPosition(PP_Instance instance,
@@ -153,6 +156,9 @@ class PPB_Instance_Proxy : public InterfaceProxy,
SerializedVarReceiveInput message);
void OnHostMsgLockMouse(PP_Instance instance);
void OnHostMsgUnlockMouse(PP_Instance instance);
+ void OnHostMsgGetDefaultPrintSettings(PP_Instance instance,
+ PP_PrintSettings_Dev* settings,
+ bool* result);
void OnHostMsgSetCursor(PP_Instance instance,
int32_t type,
const ppapi::HostResource& custom_image,
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index d4f3a0c..9dae089 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -25,6 +25,7 @@
#include "ppapi/c/dev/ppb_ime_input_event_dev.h"
#include "ppapi/c/dev/ppb_layer_compositor_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
+#include "ppapi/c/dev/ppb_printing_dev.h"
#include "ppapi/c/dev/ppb_resource_array_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index f23bb48..b606823 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -51,6 +51,8 @@ PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_1,
UNPROXIED_IFACE(PPB_LayerCompositor, PPB_LAYER_COMPOSITOR_DEV_INTERFACE_0_2,
PPB_LayerCompositor_Dev_0_2)
PROXIED_IFACE(NoAPIName, PPB_MEMORY_DEV_INTERFACE_0_1, PPB_Memory_Dev_0_1)
+PROXIED_IFACE(PPB_Instance, PPB_PRINTING_DEV_INTERFACE_0_6,
+ PPB_Printing_Dev_0_6)
PROXIED_IFACE(NoAPIName, PPB_RESOURCEARRAY_DEV_INTERFACE_0_1,
PPB_ResourceArray_Dev_0_1)
UNPROXIED_IFACE(PPB_Scrollbar, PPB_SCROLLBAR_DEV_INTERFACE_0_5,
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index c8cc230..97fd0b6 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -5,6 +5,7 @@
#ifndef PPAPI_THUNK_INSTANCE_API_H_
#define PPAPI_THUNK_INSTANCE_API_H_
+#include "ppapi/c/dev/pp_print_settings_dev.h"
#include "ppapi/c/dev/ppb_console_dev.h"
#include "ppapi/c/dev/ppb_text_input_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
@@ -111,6 +112,11 @@ class PPB_Instance_API {
PP_CompletionCallback callback) = 0;
virtual void UnlockMouse(PP_Instance instance) = 0;
+ // Printing.
+ virtual PP_Bool GetDefaultPrintSettings(
+ PP_Instance instance,
+ PP_PrintSettings_Dev* print_settings) = 0;
+
// TextInput.
virtual void SetTextInputType(PP_Instance instance,
PP_TextInput_Type type) = 0;
diff --git a/ppapi/thunk/ppb_printing_thunk.cc b/ppapi/thunk/ppb_printing_thunk.cc
new file mode 100644
index 0000000..6602189
--- /dev/null
+++ b/ppapi/thunk/ppb_printing_thunk.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 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 "ppapi/c/dev/ppb_printing_dev.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool GetDefaultPrintSettings(PP_Instance instance,
+ PP_PrintSettings_Dev* print_settings) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->GetDefaultPrintSettings(instance, print_settings);
+}
+
+const PPB_Printing_Dev g_ppb_printing_dev_thunk = {
+ &GetDefaultPrintSettings,
+};
+
+} // namespace
+
+const PPB_Printing_Dev_0_6* GetPPB_Printing_Dev_0_6_Thunk() {
+ return &g_ppb_printing_dev_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 9a3b1fe..3d7f072 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -29,6 +29,7 @@
#include "ppapi/c/dev/ppb_layer_compositor_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/c/dev/ppb_opengles2ext_dev.h"
+#include "ppapi/c/dev/ppb_printing_dev.h"
#include "ppapi/c/dev/ppb_resource_array_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 9973100..5cb484f 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -1977,6 +1977,13 @@ void PluginInstance::UnlockMouse(PP_Instance instance) {
delegate()->UnlockMouse(this);
}
+PP_Bool PluginInstance::GetDefaultPrintSettings(
+ PP_Instance instance,
+ PP_PrintSettings_Dev* print_settings) {
+ // TODO(raymes): Not implemented for in-process.
+ return PP_FALSE;
+}
+
void PluginInstance::SetTextInputType(PP_Instance instance,
PP_TextInput_Type type) {
int itype = type;
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index ffd184b..d1a9404e 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -378,6 +378,9 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
virtual int32_t LockMouse(PP_Instance instance,
PP_CompletionCallback callback) OVERRIDE;
virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
+ virtual PP_Bool GetDefaultPrintSettings(
+ PP_Instance instance,
+ PP_PrintSettings_Dev* print_settings) OVERRIDE;
virtual void SetTextInputType(PP_Instance instance,
PP_TextInput_Type type) OVERRIDE;
virtual void UpdateCaretPosition(PP_Instance instance,