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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_printing_host.cc

Issue 281803003: Add PPAPI_BEGIN_MESSAGE_MAP and PPAPI_END_MESSAGE_MAP to be used when dispatching IPCs using PPAPI_… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 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
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 "content/browser/renderer_host/pepper/pepper_printing_host.h" 5 #include "content/browser/renderer_host/pepper/pepper_printing_host.h"
6 6
7 #include "ppapi/c/dev/pp_print_settings_dev.h" 7 #include "ppapi/c/dev/pp_print_settings_dev.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/host/dispatch_host_message.h" 9 #include "ppapi/host/dispatch_host_message.h"
10 #include "ppapi/host/host_message_context.h" 10 #include "ppapi/host/host_message_context.h"
11 #include "ppapi/host/ppapi_host.h" 11 #include "ppapi/host/ppapi_host.h"
12 #include "ppapi/proxy/ppapi_messages.h" 12 #include "ppapi/proxy/ppapi_messages.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 PepperPrintingHost::PepperPrintingHost( 16 PepperPrintingHost::PepperPrintingHost(
17 ppapi::host::PpapiHost* host, 17 ppapi::host::PpapiHost* host,
18 PP_Instance instance, 18 PP_Instance instance,
19 PP_Resource resource, 19 PP_Resource resource,
20 scoped_ptr<PepperPrintSettingsManager> print_settings_manager) 20 scoped_ptr<PepperPrintSettingsManager> print_settings_manager)
21 : ResourceHost(host, instance, resource), 21 : ResourceHost(host, instance, resource),
22 print_settings_manager_(print_settings_manager.Pass()), 22 print_settings_manager_(print_settings_manager.Pass()),
23 weak_factory_(this) {} 23 weak_factory_(this) {}
24 24
25 PepperPrintingHost::~PepperPrintingHost() {} 25 PepperPrintingHost::~PepperPrintingHost() {}
26 26
27 int32_t PepperPrintingHost::OnResourceMessageReceived( 27 int32_t PepperPrintingHost::OnResourceMessageReceived(
28 const IPC::Message& msg, 28 const IPC::Message& msg,
29 ppapi::host::HostMessageContext* context) { 29 ppapi::host::HostMessageContext* context) {
30 IPC_BEGIN_MESSAGE_MAP(PepperPrintingHost, msg) 30 PPAPI_BEGIN_MESSAGE_MAP(PepperPrintingHost, msg)
31 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( 31 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
32 PpapiHostMsg_Printing_GetDefaultPrintSettings, OnGetDefaultPrintSettings) 32 PpapiHostMsg_Printing_GetDefaultPrintSettings,
33 IPC_END_MESSAGE_MAP() 33 OnGetDefaultPrintSettings)
34 PPAPI_END_MESSAGE_MAP()
34 return PP_ERROR_FAILED; 35 return PP_ERROR_FAILED;
35 } 36 }
36 37
37 int32_t PepperPrintingHost::OnGetDefaultPrintSettings( 38 int32_t PepperPrintingHost::OnGetDefaultPrintSettings(
38 ppapi::host::HostMessageContext* context) { 39 ppapi::host::HostMessageContext* context) {
39 print_settings_manager_->GetDefaultPrintSettings( 40 print_settings_manager_->GetDefaultPrintSettings(
40 base::Bind(&PepperPrintingHost::PrintSettingsCallback, 41 base::Bind(&PepperPrintingHost::PrintSettingsCallback,
41 weak_factory_.GetWeakPtr(), 42 weak_factory_.GetWeakPtr(),
42 context->MakeReplyMessageContext())); 43 context->MakeReplyMessageContext()));
43 return PP_OK_COMPLETIONPENDING; 44 return PP_OK_COMPLETIONPENDING;
44 } 45 }
45 46
46 void PepperPrintingHost::PrintSettingsCallback( 47 void PepperPrintingHost::PrintSettingsCallback(
47 ppapi::host::ReplyMessageContext reply_context, 48 ppapi::host::ReplyMessageContext reply_context,
48 PepperPrintSettingsManager::Result result) { 49 PepperPrintSettingsManager::Result result) {
49 reply_context.params.set_result(result.second); 50 reply_context.params.set_result(result.second);
50 host()->SendReply( 51 host()->SendReply(
51 reply_context, 52 reply_context,
52 PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply(result.first)); 53 PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply(result.first));
53 } 54 }
54 55
55 } // namespace content 56 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698