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

Side by Side Diff: chrome/browser/renderer_host/render_view_host_notification_task.h

Issue 6025009: Get rid of RenderViewHostDelegate::Resource and dispatch the IPC messages dir... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This file defines utility functions for sending notifications (calling 5 // This file defines utility functions for sending notifications (calling
6 // methods that return void and do not have out params) to the RenderViewHost 6 // methods that return void and do not have out params) to the RenderViewHost
7 // or one of its delegate interfaces. The notifications are dispatched 7 // or one of its delegate interfaces. The notifications are dispatched
8 // asynchronously, and only if the specified RenderViewHost still exists. 8 // asynchronously, and only if the specified RenderViewHost still exists.
9 9
10 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ 10 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 inline void CallRenderViewHostHelper(int render_process_id, int render_view_id, 63 inline void CallRenderViewHostHelper(int render_process_id, int render_view_id,
64 Method method, const Params& params) { 64 Method method, const Params& params) {
65 BrowserThread::PostTask( 65 BrowserThread::PostTask(
66 BrowserThread::UI, FROM_HERE, 66 BrowserThread::UI, FROM_HERE,
67 new RenderViewHostNotificationTask<Method, Params>(render_process_id, 67 new RenderViewHostNotificationTask<Method, Params>(render_process_id,
68 render_view_id, 68 render_view_id,
69 method, 69 method,
70 params)); 70 params));
71 } 71 }
72 72
73 // For proxying calls to RenderViewHostDelegate::Resource
74
75 class RenderViewHostToResourceDelegate {
76 public:
77 typedef RenderViewHostDelegate::Resource MappedType;
78 static MappedType* Map(RenderViewHost* rvh) {
79 return rvh ? rvh->delegate()->GetResourceDelegate() : NULL;
80 }
81 };
82
83 template <typename Method, typename Params>
84 inline void CallRenderViewHostResourceDelegateHelper(int render_process_id,
85 int render_view_id,
86 Method method,
87 const Params& params) {
88
89 BrowserThread::PostTask(
90 BrowserThread::UI, FROM_HERE,
91 new RenderViewHostNotificationTask<
92 Method, Params, RenderViewHostToResourceDelegate>(render_process_id,
93 render_view_id,
94 method,
95 params));
96 }
97
98 // For proxying calls to RenderViewHostDelegate::ContentSettings 73 // For proxying calls to RenderViewHostDelegate::ContentSettings
99 74
100 class RenderViewHostToContentSettingsDelegate { 75 class RenderViewHostToContentSettingsDelegate {
101 public: 76 public:
102 typedef RenderViewHostDelegate::ContentSettings MappedType; 77 typedef RenderViewHostDelegate::ContentSettings MappedType;
103 static MappedType* Map(RenderViewHost* rvh) { 78 static MappedType* Map(RenderViewHost* rvh) {
104 return rvh ? rvh->delegate()->GetContentSettingsDelegate() : NULL; 79 return rvh ? rvh->delegate()->GetContentSettingsDelegate() : NULL;
105 } 80 }
106 }; 81 };
107 82
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 Method method, 181 Method method,
207 const A& a, 182 const A& a,
208 const B& b) { 183 const B& b) {
209 internal::CallRenderViewHostHelper(render_process_id, 184 internal::CallRenderViewHostHelper(render_process_id,
210 render_view_id, 185 render_view_id,
211 method, 186 method,
212 MakeTuple(a, b)); 187 MakeTuple(a, b));
213 } 188 }
214 189
215 // ---------------------------------------------------------------------------- 190 // ----------------------------------------------------------------------------
216 // Proxy calls to the specified RenderViewHost's Resource delegate.
217
218 template <typename Method>
219 inline void CallRenderViewHostResourceDelegate(int render_process_id,
220 int render_view_id,
221 Method method) {
222 internal::CallRenderViewHostResourceDelegateHelper(render_process_id,
223 render_view_id,
224 method,
225 MakeTuple());
226 }
227
228 template <typename Method, typename A>
229 inline void CallRenderViewHostResourceDelegate(int render_process_id,
230 int render_view_id,
231 Method method,
232 const A& a) {
233 internal::CallRenderViewHostResourceDelegateHelper(render_process_id,
234 render_view_id,
235 method,
236 MakeTuple(a));
237 }
238
239 template <typename Method, typename A, typename B>
240 inline void CallRenderViewHostResourceDelegate(int render_process_id,
241 int render_view_id,
242 Method method,
243 const A& a,
244 const B& b) {
245 internal::CallRenderViewHostResourceDelegateHelper(render_process_id,
246 render_view_id,
247 method,
248 MakeTuple(a, b));
249 }
250
251 // ----------------------------------------------------------------------------
252 // Proxy calls to the specified RenderViewHost's ContentSettings delegate. 191 // Proxy calls to the specified RenderViewHost's ContentSettings delegate.
253 192
254 template <typename Method> 193 template <typename Method>
255 inline void CallRenderViewHostContentSettingsDelegate(int render_process_id, 194 inline void CallRenderViewHostContentSettingsDelegate(int render_process_id,
256 int render_view_id, 195 int render_view_id,
257 Method method) { 196 Method method) {
258 internal::CallRenderViewHostContentSettingsDelegateHelper(render_process_id, 197 internal::CallRenderViewHostContentSettingsDelegateHelper(render_process_id,
259 render_view_id, 198 render_view_id,
260 method, 199 method,
261 MakeTuple()); 200 MakeTuple());
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 internal::CallRenderViewHostSSLDelegateHelper( 328 internal::CallRenderViewHostSSLDelegateHelper(
390 render_process_id, 329 render_process_id,
391 render_view_id, 330 render_view_id,
392 method, 331 method,
393 MakeTuple(a, b)); 332 MakeTuple(a, b));
394 } 333 }
395 334
396 // ---------------------------------------------------------------------------- 335 // ----------------------------------------------------------------------------
397 336
398 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ 337 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_view_host_delegate.cc ('k') | chrome/browser/renderer_host/resource_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698