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

Side by Side Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 10544085: Added PPB function to return default print settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/tests/all_c_includes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ppapi/proxy/ppb_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/pp_time.h" 8 #include "ppapi/c/pp_time.h"
9 #include "ppapi/c/pp_var.h" 9 #include "ppapi/c/pp_var.h"
10 #include "ppapi/c/ppb_audio_config.h" 10 #include "ppapi/c/ppb_audio_config.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, 117 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents,
118 OnHostMsgRequestInputEvents) 118 OnHostMsgRequestInputEvents)
119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, 119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents,
120 OnHostMsgClearInputEvents) 120 OnHostMsgClearInputEvents)
121 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent_ACK, 121 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent_ACK,
122 OnMsgHandleInputEventAck) 122 OnMsgHandleInputEventAck)
123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse, 123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse,
124 OnHostMsgLockMouse) 124 OnHostMsgLockMouse)
125 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse, 125 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse,
126 OnHostMsgUnlockMouse) 126 OnHostMsgUnlockMouse)
127 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPInstance_GetDefaultPrintSettings,
128 OnHostMsgGetDefaultPrintSettings)
127 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor, 129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor,
128 OnHostMsgSetCursor) 130 OnHostMsgSetCursor)
129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType, 131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType,
130 OnHostMsgSetTextInputType) 132 OnHostMsgSetTextInputType)
131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateCaretPosition, 133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateCaretPosition,
132 OnHostMsgUpdateCaretPosition) 134 OnHostMsgUpdateCaretPosition)
133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_CancelCompositionText, 135 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_CancelCompositionText,
134 OnHostMsgCancelCompositionText) 136 OnHostMsgCancelCompositionText)
135 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText, 137 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText,
136 OnHostMsgUpdateSurroundingText) 138 OnHostMsgUpdateSurroundingText)
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 dispatcher()->Send(new PpapiHostMsg_PPBInstance_LockMouse( 453 dispatcher()->Send(new PpapiHostMsg_PPBInstance_LockMouse(
452 API_ID_PPB_INSTANCE, instance)); 454 API_ID_PPB_INSTANCE, instance));
453 return PP_OK_COMPLETIONPENDING; 455 return PP_OK_COMPLETIONPENDING;
454 } 456 }
455 457
456 void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) { 458 void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) {
457 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UnlockMouse( 459 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UnlockMouse(
458 API_ID_PPB_INSTANCE, instance)); 460 API_ID_PPB_INSTANCE, instance));
459 } 461 }
460 462
463 PP_Bool PPB_Instance_Proxy::GetDefaultPrintSettings(
464 PP_Instance instance,
465 PP_PrintSettings_Dev* print_settings) {
466 if (!print_settings)
467 return PP_FALSE;
468
469 bool result;
470 dispatcher()->Send(new PpapiHostMsg_PPBPInstance_GetDefaultPrintSettings(
471 API_ID_PPB_INSTANCE, instance, print_settings, &result));
472
473 return PP_FromBool(result);
474 }
475
461 void PPB_Instance_Proxy::SetTextInputType(PP_Instance instance, 476 void PPB_Instance_Proxy::SetTextInputType(PP_Instance instance,
462 PP_TextInput_Type type) { 477 PP_TextInput_Type type) {
463 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetTextInputType( 478 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetTextInputType(
464 API_ID_PPB_INSTANCE, instance, type)); 479 API_ID_PPB_INSTANCE, instance, type));
465 } 480 }
466 481
467 void PPB_Instance_Proxy::UpdateCaretPosition(PP_Instance instance, 482 void PPB_Instance_Proxy::UpdateCaretPosition(PP_Instance instance,
468 const PP_Rect& caret, 483 const PP_Rect& caret,
469 const PP_Rect& bounding_box) { 484 const PP_Rect& bounding_box) {
470 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UpdateCaretPosition( 485 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UpdateCaretPosition(
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 if (result != PP_OK_COMPLETIONPENDING) 658 if (result != PP_OK_COMPLETIONPENDING)
644 cb.Run(result); 659 cb.Run(result);
645 } 660 }
646 661
647 void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) { 662 void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) {
648 EnterInstanceNoLock enter(instance); 663 EnterInstanceNoLock enter(instance);
649 if (enter.succeeded()) 664 if (enter.succeeded())
650 enter.functions()->UnlockMouse(instance); 665 enter.functions()->UnlockMouse(instance);
651 } 666 }
652 667
668 void PPB_Instance_Proxy::OnHostMsgGetDefaultPrintSettings(
669 PP_Instance instance,
670 PP_PrintSettings_Dev* settings,
671 bool* result) {
672 // TODO(raymes): This just returns some generic settings. Actually hook this
673 // up to the browser to return the real defaults.
674 PP_PrintSettings_Dev default_settings = {
675 // |printable_area|: all of the sheet of paper.
676 { { 0, 0 }, { 612, 792 } },
677 // |content_area|: 0.5" margins all around.
678 { { 36, 36 }, { 540, 720 } },
679 // |paper_size|: 8.5" x 11" (US letter).
680 { 612, 792 },
681 300, // |dpi|.
682 PP_PRINTORIENTATION_NORMAL, // |orientation|.
683 PP_PRINTSCALINGOPTION_NONE, // |print_scaling_option|.
684 PP_FALSE, // |grayscale|.
685 PP_PRINTOUTPUTFORMAT_PDF // |format|.
686 };
687 *settings = default_settings;
688 *result = true;
689 }
690
653 #if !defined(OS_NACL) 691 #if !defined(OS_NACL)
654 void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument( 692 void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument(
655 PP_Instance instance, 693 PP_Instance instance,
656 SerializedVarReceiveInput relative, 694 SerializedVarReceiveInput relative,
657 SerializedVarReturnValue result) { 695 SerializedVarReturnValue result) {
658 EnterInstanceNoLock enter(instance); 696 EnterInstanceNoLock enter(instance);
659 if (enter.succeeded()) { 697 if (enter.succeeded()) {
660 result.Return(dispatcher(), 698 result.Return(dispatcher(),
661 enter.functions()->ResolveRelativeToDocument( 699 enter.functions()->ResolveRelativeToDocument(
662 instance, relative.Get(dispatcher()), NULL)); 700 instance, relative.Get(dispatcher()), NULL));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 } 802 }
765 803
766 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, 804 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result,
767 PP_Instance instance) { 805 PP_Instance instance) {
768 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( 806 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete(
769 API_ID_PPB_INSTANCE, instance, result)); 807 API_ID_PPB_INSTANCE, instance, result));
770 } 808 }
771 809
772 } // namespace proxy 810 } // namespace proxy
773 } // namespace ppapi 811 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/tests/all_c_includes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698