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

Side by Side Diff: content/browser/renderer_host/pepper/browser_ppapi_host_impl.h

Issue 245443005: Move IPC::MessageFilter and router to a separate file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Oops, add ipc_message_filter_router.h/cc Created 6 years, 8 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "content/browser/renderer_host/pepper/content_browser_pepper_host_facto ry.h" 16 #include "content/browser/renderer_host/pepper/content_browser_pepper_host_facto ry.h"
17 #include "content/browser/renderer_host/pepper/ssl_context_helper.h" 17 #include "content/browser/renderer_host/pepper/ssl_context_helper.h"
18 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
19 #include "content/common/pepper_renderer_instance_data.h" 19 #include "content/common/pepper_renderer_instance_data.h"
20 #include "content/public/browser/browser_ppapi_host.h" 20 #include "content/public/browser/browser_ppapi_host.h"
21 #include "content/public/common/process_type.h" 21 #include "content/public/common/process_type.h"
22 #include "ipc/ipc_channel_proxy.h" 22 #include "ipc/ipc_message_filter.h"
23 #include "ppapi/host/ppapi_host.h" 23 #include "ppapi/host/ppapi_host.h"
24 24
25 namespace content { 25 namespace content {
26 26
27 class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { 27 class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
28 public: 28 public:
29 // The creator is responsible for calling set_plugin_process_handle as soon 29 // The creator is responsible for calling set_plugin_process_handle as soon
30 // as it is known (we start the process asynchronously so it won't be known 30 // as it is known (we start the process asynchronously so it won't be known
31 // when this object is created). 31 // when this object is created).
32 // |external_plugin| signfies that this is a proxy created for an embedder's 32 // |external_plugin| signfies that this is a proxy created for an embedder's
(...skipping 29 matching lines...) Expand all
62 62
63 bool external_plugin() const { return external_plugin_; } 63 bool external_plugin() const { return external_plugin_; }
64 64
65 // These two functions are notifications that an instance has been created 65 // These two functions are notifications that an instance has been created
66 // or destroyed. They allow us to maintain a mapping of PP_Instance to data 66 // or destroyed. They allow us to maintain a mapping of PP_Instance to data
67 // associated with the instance including view IDs in the browser process. 67 // associated with the instance including view IDs in the browser process.
68 void AddInstance(PP_Instance instance, 68 void AddInstance(PP_Instance instance,
69 const PepperRendererInstanceData& instance_data); 69 const PepperRendererInstanceData& instance_data);
70 void DeleteInstance(PP_Instance instance); 70 void DeleteInstance(PP_Instance instance);
71 71
72 scoped_refptr<IPC::ChannelProxy::MessageFilter> message_filter() { 72 scoped_refptr<IPC::MessageFilter> message_filter() {
73 return message_filter_; 73 return message_filter_;
74 } 74 }
75 75
76 const scoped_refptr<SSLContextHelper>& ssl_context_helper() const { 76 const scoped_refptr<SSLContextHelper>& ssl_context_helper() const {
77 return ssl_context_helper_; 77 return ssl_context_helper_;
78 } 78 }
79 79
80 private: 80 private:
81 friend class BrowserPpapiHostTest; 81 friend class BrowserPpapiHostTest;
82 82
83 // Implementing MessageFilter on BrowserPpapiHostImpl makes it ref-counted, 83 // Implementing MessageFilter on BrowserPpapiHostImpl makes it ref-counted,
84 // preventing us from returning these to embedders without holding a 84 // preventing us from returning these to embedders without holding a
85 // reference. To avoid that, define a message filter object. 85 // reference. To avoid that, define a message filter object.
86 class HostMessageFilter : public IPC::ChannelProxy::MessageFilter { 86 class HostMessageFilter : public IPC::MessageFilter {
87 public: 87 public:
88 HostMessageFilter(ppapi::host::PpapiHost* ppapi_host, 88 HostMessageFilter(ppapi::host::PpapiHost* ppapi_host,
89 BrowserPpapiHostImpl* browser_ppapi_host_impl); 89 BrowserPpapiHostImpl* browser_ppapi_host_impl);
90 90
91 // IPC::ChannelProxy::MessageFilter. 91 // IPC::MessageFilter.
92 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 92 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
93 93
94 void OnHostDestroyed(); 94 void OnHostDestroyed();
95 95
96 private: 96 private:
97 virtual ~HostMessageFilter(); 97 virtual ~HostMessageFilter();
98 98
99 void OnKeepalive(); 99 void OnKeepalive();
100 void OnHostMsgLogInterfaceUsage(int hash) const; 100 void OnHostMsgLogInterfaceUsage(int hash) const;
101 101
(...skipping 28 matching lines...) Expand all
130 scoped_refptr<HostMessageFilter> message_filter_; 130 scoped_refptr<HostMessageFilter> message_filter_;
131 131
132 BrowserPpapiHost::OnKeepaliveCallback on_keepalive_callback_; 132 BrowserPpapiHost::OnKeepaliveCallback on_keepalive_callback_;
133 133
134 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); 134 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl);
135 }; 135 };
136 136
137 } // namespace content 137 } // namespace content
138 138
139 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ 139 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698