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

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

Issue 10826026: Add a printing resource (as a new style resource) to fetch the default print settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/proxy/printing_resource.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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, 126 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents,
127 OnHostMsgRequestInputEvents) 127 OnHostMsgRequestInputEvents)
128 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, 128 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents,
129 OnHostMsgClearInputEvents) 129 OnHostMsgClearInputEvents)
130 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent_ACK, 130 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent_ACK,
131 OnMsgHandleInputEventAck) 131 OnMsgHandleInputEventAck)
132 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse, 132 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse,
133 OnHostMsgLockMouse) 133 OnHostMsgLockMouse)
134 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse, 134 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse,
135 OnHostMsgUnlockMouse) 135 OnHostMsgUnlockMouse)
136 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPInstance_GetDefaultPrintSettings,
137 OnHostMsgGetDefaultPrintSettings)
138 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor, 136 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor,
139 OnHostMsgSetCursor) 137 OnHostMsgSetCursor)
140 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType, 138 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType,
141 OnHostMsgSetTextInputType) 139 OnHostMsgSetTextInputType)
142 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateCaretPosition, 140 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateCaretPosition,
143 OnHostMsgUpdateCaretPosition) 141 OnHostMsgUpdateCaretPosition)
144 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_CancelCompositionText, 142 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_CancelCompositionText,
145 OnHostMsgCancelCompositionText) 143 OnHostMsgCancelCompositionText)
146 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText, 144 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText,
147 OnHostMsgUpdateSurroundingText) 145 OnHostMsgUpdateSurroundingText)
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 dispatcher()->Send(new PpapiHostMsg_PPBInstance_LockMouse( 601 dispatcher()->Send(new PpapiHostMsg_PPBInstance_LockMouse(
604 API_ID_PPB_INSTANCE, instance)); 602 API_ID_PPB_INSTANCE, instance));
605 return PP_OK_COMPLETIONPENDING; 603 return PP_OK_COMPLETIONPENDING;
606 } 604 }
607 605
608 void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) { 606 void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) {
609 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UnlockMouse( 607 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UnlockMouse(
610 API_ID_PPB_INSTANCE, instance)); 608 API_ID_PPB_INSTANCE, instance));
611 } 609 }
612 610
613 PP_Bool PPB_Instance_Proxy::GetDefaultPrintSettings(
614 PP_Instance instance,
615 PP_PrintSettings_Dev* print_settings) {
616 if (!print_settings)
617 return PP_FALSE;
618
619 bool result;
620 dispatcher()->Send(new PpapiHostMsg_PPBPInstance_GetDefaultPrintSettings(
621 API_ID_PPB_INSTANCE, instance, print_settings, &result));
622
623 return PP_FromBool(result);
624 }
625
626 void PPB_Instance_Proxy::SetTextInputType(PP_Instance instance, 611 void PPB_Instance_Proxy::SetTextInputType(PP_Instance instance,
627 PP_TextInput_Type type) { 612 PP_TextInput_Type type) {
628 CancelAnyPendingRequestSurroundingText(instance); 613 CancelAnyPendingRequestSurroundingText(instance);
629 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetTextInputType( 614 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetTextInputType(
630 API_ID_PPB_INSTANCE, instance, type)); 615 API_ID_PPB_INSTANCE, instance, type));
631 } 616 }
632 617
633 void PPB_Instance_Proxy::UpdateCaretPosition(PP_Instance instance, 618 void PPB_Instance_Proxy::UpdateCaretPosition(PP_Instance instance,
634 const PP_Rect& caret, 619 const PP_Rect& caret,
635 const PP_Rect& bounding_box) { 620 const PP_Rect& bounding_box) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 if (enter.succeeded()) 799 if (enter.succeeded())
815 enter.SetResult(enter.functions()->LockMouse(instance, enter.callback())); 800 enter.SetResult(enter.functions()->LockMouse(instance, enter.callback()));
816 } 801 }
817 802
818 void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) { 803 void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) {
819 EnterInstanceNoLock enter(instance); 804 EnterInstanceNoLock enter(instance);
820 if (enter.succeeded()) 805 if (enter.succeeded())
821 enter.functions()->UnlockMouse(instance); 806 enter.functions()->UnlockMouse(instance);
822 } 807 }
823 808
824 void PPB_Instance_Proxy::OnHostMsgGetDefaultPrintSettings(
825 PP_Instance instance,
826 PP_PrintSettings_Dev* settings,
827 bool* result) {
828 // TODO(raymes): This just returns some generic settings. Actually hook this
829 // up to the browser to return the real defaults.
830 PP_PrintSettings_Dev default_settings = {
831 // |printable_area|: all of the sheet of paper.
832 { { 0, 0 }, { 612, 792 } },
833 // |content_area|: 0.5" margins all around.
834 { { 36, 36 }, { 540, 720 } },
835 // |paper_size|: 8.5" x 11" (US letter).
836 { 612, 792 },
837 300, // |dpi|.
838 PP_PRINTORIENTATION_NORMAL, // |orientation|.
839 PP_PRINTSCALINGOPTION_NONE, // |print_scaling_option|.
840 PP_FALSE, // |grayscale|.
841 PP_PRINTOUTPUTFORMAT_PDF // |format|.
842 };
843 *settings = default_settings;
844 *result = true;
845 }
846
847 #if !defined(OS_NACL) 809 #if !defined(OS_NACL)
848 void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument( 810 void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument(
849 PP_Instance instance, 811 PP_Instance instance,
850 SerializedVarReceiveInput relative, 812 SerializedVarReceiveInput relative,
851 SerializedVarReturnValue result) { 813 SerializedVarReturnValue result) {
852 EnterInstanceNoLock enter(instance); 814 EnterInstanceNoLock enter(instance);
853 if (enter.succeeded()) { 815 if (enter.succeeded()) {
854 result.Return(dispatcher(), 816 result.Return(dispatcher(),
855 enter.functions()->ResolveRelativeToDocument( 817 enter.functions()->ResolveRelativeToDocument(
856 instance, relative.Get(dispatcher()), NULL)); 818 instance, relative.Get(dispatcher()), NULL));
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 PP_Instance instance) { 1027 PP_Instance instance) {
1066 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1028 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1067 GetInstanceData(instance); 1029 GetInstanceData(instance);
1068 if (!data) 1030 if (!data)
1069 return; // Instance was probably deleted. 1031 return; // Instance was probably deleted.
1070 data->should_do_request_surrounding_text = false; 1032 data->should_do_request_surrounding_text = false;
1071 } 1033 }
1072 1034
1073 } // namespace proxy 1035 } // namespace proxy
1074 } // namespace ppapi 1036 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/proxy/printing_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698