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

Side by Side Diff: ppapi/proxy/plugin_resource_callback.h

Issue 11022005: Converted PluginResource reply message handling to use base::Callback (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/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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_PROXY_PLUGIN_RESOURCE_CALLBACK_H_
6 #define PPAPI_PROXY_PLUGIN_RESOURCE_CALLBACK_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "ipc/ipc_message.h"
10 #include "ppapi/proxy/dispatch_reply_message.h"
11 #include "ppapi/proxy/resource_message_params.h"
12
13 namespace ppapi {
14 namespace proxy {
15
16 // |PluginResourceCallback| wraps a |base::Callback| on the plugin side which
17 // will be triggered in response to a particular message type being received.
18 // |MsgClass| is the reply message type that the callback will be called with
19 // and |CallbackType| is the type of the |base::Callback| that will be called.
20 class PluginResourceCallbackBase
21 : public base::RefCounted<PluginResourceCallbackBase> {
22 public:
23 virtual void Run(const ResourceMessageReplyParams& params,
24 const IPC::Message& msg) = 0;
25 protected:
26 friend class base::RefCounted<PluginResourceCallbackBase>;
27 virtual ~PluginResourceCallbackBase() {}
28 };
29
30 template<typename MsgClass, typename CallbackType>
31 class PluginResourceCallback : public PluginResourceCallbackBase {
32 public:
33 explicit PluginResourceCallback(
34 const CallbackType& callback) : callback_(callback) {}
brettw 2012/10/02 19:40:00 The : should go on the next line when not everythi
raymes 2012/10/03 21:43:50 Done.
35
36 virtual void Run(
37 const ResourceMessageReplyParams& reply_params,
38 const IPC::Message& msg) OVERRIDE {
39 DispatchResourceReplyOrDefaultParams<MsgClass>(
40 &callback_, &CallbackType::Run, reply_params, msg);
41 }
42
43 private:
44 virtual ~PluginResourceCallback() {}
45
46 CallbackType callback_;
47 };
48
49 } // namespace proxy
50 } // namespace ppapi
51
52 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_CALLBACK_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_resource.cc ('k') | ppapi/proxy/printing_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698