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

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

Issue 11106019: PluginResource: Avoid having two sets of similar methods for talking with browser and renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 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/plugin_resource.cc ('k') | ppapi/proxy/websocket_resource.cc » ('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/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
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
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_resource.cc ('k') | ppapi/proxy/websocket_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698