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 13 matching lines...) Expand all Loading... |
24 return this; | 24 return this; |
25 } | 25 } |
26 | 26 |
27 int32_t PrintingResource::GetDefaultPrintSettings( | 27 int32_t PrintingResource::GetDefaultPrintSettings( |
28 PP_PrintSettings_Dev* print_settings, | 28 PP_PrintSettings_Dev* print_settings, |
29 scoped_refptr<TrackedCallback> callback) { | 29 scoped_refptr<TrackedCallback> callback) { |
30 if (!print_settings) | 30 if (!print_settings) |
31 return PP_ERROR_BADARGUMENT; | 31 return PP_ERROR_BADARGUMENT; |
32 | 32 |
33 if (!sent_create_to_browser()) | 33 if (!sent_create_to_browser()) |
34 SendCreateToBrowser(PpapiHostMsg_Printing_Create()); | 34 SendCreate(BROWSER, PpapiHostMsg_Printing_Create()); |
35 | 35 |
36 CallBrowser<PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply>( | 36 Call<PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply>( |
| 37 BROWSER, |
37 PpapiHostMsg_Printing_GetDefaultPrintSettings(), | 38 PpapiHostMsg_Printing_GetDefaultPrintSettings(), |
38 base::Bind(&PrintingResource::OnPluginMsgGetDefaultPrintSettingsReply, | 39 base::Bind(&PrintingResource::OnPluginMsgGetDefaultPrintSettingsReply, |
39 this, print_settings, callback)); | 40 this, print_settings, callback)); |
40 return PP_OK_COMPLETIONPENDING; | 41 return PP_OK_COMPLETIONPENDING; |
41 } | 42 } |
42 | 43 |
43 void PrintingResource::OnPluginMsgGetDefaultPrintSettingsReply( | 44 void PrintingResource::OnPluginMsgGetDefaultPrintSettingsReply( |
44 PP_PrintSettings_Dev* settings_out, | 45 PP_PrintSettings_Dev* settings_out, |
45 scoped_refptr<TrackedCallback> callback, | 46 scoped_refptr<TrackedCallback> callback, |
46 const ResourceMessageReplyParams& params, | 47 const ResourceMessageReplyParams& params, |
47 const PP_PrintSettings_Dev& settings) { | 48 const PP_PrintSettings_Dev& settings) { |
48 if (params.result() == PP_OK) | 49 if (params.result() == PP_OK) |
49 *settings_out = settings; | 50 *settings_out = settings; |
50 | 51 |
51 // Notify the plugin of the new data. | 52 // Notify the plugin of the new data. |
52 TrackedCallback::ClearAndRun(&callback, params.result()); | 53 TrackedCallback::ClearAndRun(&callback, params.result()); |
53 // DANGER: May delete |this|! | 54 // DANGER: May delete |this|! |
54 } | 55 } |
55 | 56 |
56 } // namespace proxy | 57 } // namespace proxy |
57 } // namespace ppapi | 58 } // namespace ppapi |
OLD | NEW |