summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/proxy')
-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
4 files changed, 63 insertions, 0 deletions
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,