Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/printing_resource.h" | 5 #include "ppapi/proxy/printing_resource.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/proxy/dispatch_reply_message.h" | 10 #include "ppapi/proxy/dispatch_reply_message.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 SendCreate(BROWSER, PpapiHostMsg_Printing_Create()); | 34 SendCreate(BROWSER, PpapiHostMsg_Printing_Create()); |
| 35 | 35 |
| 36 Call<PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply>( | 36 Call<PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply>( |
| 37 BROWSER, | 37 BROWSER, |
| 38 PpapiHostMsg_Printing_GetDefaultPrintSettings(), | 38 PpapiHostMsg_Printing_GetDefaultPrintSettings(), |
| 39 base::Bind(&PrintingResource::OnPluginMsgGetDefaultPrintSettingsReply, | 39 base::Bind(&PrintingResource::OnPluginMsgGetDefaultPrintSettingsReply, |
| 40 this, print_settings, callback)); | 40 this, print_settings, callback)); |
| 41 return PP_OK_COMPLETIONPENDING; | 41 return PP_OK_COMPLETIONPENDING; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void PrintingResource::SetPrintPresetOptionsFromDocument( | |
| 45 PP_PrintPresetOptions_Dev* print_options) { | |
| 46 if (!sent_create_to_browser()) | |
| 47 SendCreate(RENDERER, PpapiHostMsg_PrintHost_Create()); | |
| 48 | |
| 49 Post(RENDERER, | |
| 50 PpapiHostMsg_PrintHost_SetPrintPresetOptionsFromDocument( | |
|
Vitaly Buka (NO REVIEWS)
2014/09/03 21:36:24
why do you use Post here and not Call<> as above?
Nikhil
2014/09/04 11:42:53
Call<> expects a response and a callback should be
| |
| 51 *print_options)); | |
| 52 } | |
| 53 | |
| 44 void PrintingResource::OnPluginMsgGetDefaultPrintSettingsReply( | 54 void PrintingResource::OnPluginMsgGetDefaultPrintSettingsReply( |
| 45 PP_PrintSettings_Dev* settings_out, | 55 PP_PrintSettings_Dev* settings_out, |
| 46 scoped_refptr<TrackedCallback> callback, | 56 scoped_refptr<TrackedCallback> callback, |
| 47 const ResourceMessageReplyParams& params, | 57 const ResourceMessageReplyParams& params, |
| 48 const PP_PrintSettings_Dev& settings) { | 58 const PP_PrintSettings_Dev& settings) { |
| 49 if (params.result() == PP_OK) | 59 if (params.result() == PP_OK) |
| 50 *settings_out = settings; | 60 *settings_out = settings; |
| 51 | 61 |
| 52 // Notify the plugin of the new data. | 62 // Notify the plugin of the new data. |
| 53 callback->Run(params.result()); | 63 callback->Run(params.result()); |
| 54 // DANGER: May delete |this|! | 64 // DANGER: May delete |this|! |
| 55 } | 65 } |
| 56 | 66 |
| 57 } // namespace proxy | 67 } // namespace proxy |
| 58 } // namespace ppapi | 68 } // namespace ppapi |
| OLD | NEW |